-
Notifications
You must be signed in to change notification settings - Fork 5
/
main.py
65 lines (48 loc) · 2.41 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
from qgate_perf.parallel_executor import ParallelExecutor
from qgate_perf.parallel_probe import ParallelProbe
from qgate_perf.run_setup import RunSetup
import click
import logging
import time
def prf_gil_impact(run_setup: RunSetup) -> ParallelProbe:
""" Function for performance testing"""
# INIT - contain executor synchonization, if needed
probe = ParallelProbe(run_setup)
# if run_setup.is_init:
# print(f"!!!!!!!!!!!!!!! {run_setup.bulk_row} x {run_setup.bulk_col}")
while (True):
# START - probe, only for this specific code part
probe.start()
for r in range(run_setup.bulk_row * run_setup.bulk_col):
time.sleep(0.001)
# STOP - probe
if probe.stop():
break
return probe
@click.command()
@click.option("--input", help="input directory (default is directory 'input')", default="input")
@click.option("--output", help="output directory (default is directory 'output')", default="output")
def graph(input, output):
"""Generate graphs based in input data."""
logging.basicConfig()
logging.getLogger().setLevel(logging.INFO)
generator = ParallelExecutor(prf_gil_impact,
label="GIL_impact",
detail_output=True,
output_file="output/prf_calc3.txt",
init_each_bulk=True)
# generator.one_shot()
# generator.test_call(RunSetup(duration_second=5, start_delay=0))
# generator.run_executor([[10,2,'xxxx'],[5,1,'sss']], RunSetup(duration_second=5, start_delay=5))
# generator.run_executor([[16,1,'calc'],[16,2,'calc'],[64,1,'calc'],[64,2,'calc'],[64,4,'calc'],[128,4,'calc']],
# RunSetup(duration_second=5, start_delay=20))
generator.run_bulk_executor([[1, 1], [1, 20]],
[[16, 1, 'calc']],
RunSetup(duration_second=5, start_delay=20))
# generator.run_bulk_executor(bulk_list=[[1, 1]],
# executor_list=[[4, 1,'1x thread'],[8, 1,'1x thread'],[16, 1, '1x thread'],
# [4, 2, '2x threads'], [8, 2, '2x threads'],
# [4, 4, '4x threads']],
# run_setup=RunSetup(duration_second=5, start_delay=0))
if __name__ == '__main__':
graph()