perfsim.helpers#
Module contents#
Submodules#
perfsim.helpers.cost_calculator module#
- class perfsim.helpers.cost_calculator.CostCalculator[source]#
Bases:
object
Prevent instantiation of this class.
- ALWAYS_ALLOC_CPU_PRICE_PER_VCPU_SEC = 1.8e-05#
- ALWAYS_ALLOC_CPU_FREE_TIER_VPU_SEC_PER_MONTH = 240000#
- ALWAYS_ALLOC_MEM_PRICE_PER_GB_SEC = 2e-06#
- ALWAYS_ALLOC_MEM_FREE_TIER_GB_SEC_PER_MONTH = 450000#
- ONLY_ALLOC_DURING_REQ_CPU_PRICE_PER_VCPU_SEC = 2.4e-05#
- ONLY_ALLOC_DURING_REQ_CPU_PRICE_PER_VCPU_SEC_IDLE = 2.5e-06#
- ONLY_ALLOC_DURING_REQ_FREE_TIER_VPU_SEC_PER_MONTH = 180000#
- ONLY_ALLOC_DURING_REQ_MEM_PRICE_PER_GB_SEC = 2.5e-06#
- ONLY_ALLOC_DURING_REQ_MEM_PRICE_PER_GB_SEC_IDLE = 2.5e-06#
- ONLY_ALLOC_DURING_REQ_MEM_FREE_TIER_GB_SEC_PER_MONTH = 360000#
- ONLY_ALLOC_DURING_REQ_PRICE = 4e-07#
- ONLY_ALLOC_DURING_REQ_REQ_FREE_TIER_COUNT = 2000000#
- concurrent_requests_per_container = 200#
- requests = 3000000#
- request_execution_time = 2#
- static cost_for_always_allocated_instance(duration_in_sec, cores, memory, storage)[source]#
Calculate the cost of an instance that is always allocated.
- Parameters:
duration_in_sec (
float
)cores (
int
)memory (
int
)storage (
int
)
- Return type:
float
- Returns:
- static cost_for_only_allocated_during_request_instance(duration_in_sec, cores, memory, storage, concurrent_requests, requests, request_exec_time_ns)[source]#
Calculate the cost of an instance that is only allocated during a request.
- Parameters:
duration_in_sec (
float
)cores (
int
)memory (
int
)storage (
int
)concurrent_requests (
int
)requests (
int
)request_exec_time_ns (
int
)
- Return type:
float
- Returns:
perfsim.helpers.debug_dict module#
perfsim.helpers.logger module#
- class perfsim.helpers.logger.Logger(simulation=None)[source]#
Bases:
object
This class represents a logger that logs the simulation events.
- Parameters:
simulation (
Simulation
)
- lb_timer = []#
- tick_timer = []#
- core_sorting_timer = []#
-
sim:
Simulation
#
- print_subchains(scm)[source]#
- Parameters:
scm (
ServiceChainManager
)
perfsim.helpers.plotter module#
- class perfsim.helpers.plotter.Plotter[source]#
Bases:
object
This class is responsible for plotting the simulation results.
- static draw_timeline_graph(results)[source]#
Draw the timeline graph.
- Parameters:
results (
SimulationScenarioResultDict
)
- static draw_figures(load_generator, scenario_name, show_events=True, path_to_save_results='/home/runner/work/perfsim/perfsim/docs/results/')[source]#
Draw the figures for the simulation results.
- Parameters:
load_generator (
LoadGenerator
)scenario_name (
str
)show_events (
bool
)path_to_save_results (
str
)
- Return type:
None
- static draw_graph(G, name, save_dir, output_type='html', with_labels=False, relabel=False, node_labels_map=None, show=False)[source]#
Draw a graph.
- Parameters:
G
name
save_dir (
str
)output_type (
str
)with_labels (
bool
)relabel (
bool
)node_labels_map
show (
bool
)
- Returns:
- static convert_networkx_graph_to_cytoscape_json(G, edge_labels=None, node_style=None, edge_style=None, layout='euler')[source]#
Convert a NetworkX graph to a Cytoscape JSON object.
- Parameters:
G
edge_labels (
dict
)node_style (
dict
)edge_style (
dict
)layout
- Return type:
str
- Returns:
perfsim.helpers.utils module#
- class perfsim.helpers.utils.Utils[source]#
Bases:
object
- static mkdir_p(dir_path)[source]#
Creates a directory. equivalent to using mkdir -p on the command line
- Parameters:
dir_path (
str
) – path to the directory
- static save_file(file_path, content)[source]#
Save a file with the given content
- Parameters:
file_path (
str
)content (
Any
)
- Returns: