MCPcopy Create free account
hub / github.com/comaps/comaps / run_heap_comparison

Function run_heap_comparison

tools/python/routing/run_heap_comparison_benchmark.py:72–117  ·  view source on GitHub ↗
(*, omim, config_ini, versions)

Source from the content-addressed store, hash-verified

70
71
72def run_heap_comparison(*, omim, config_ini, versions):
73 routes_file = config_ini.read_value_by_path(path=['PATHS', 'RoutesFile'])
74 data_from_heap_comparison = dict()
75
76 for version in versions:
77 name = version['name']
78 branch = version['branch']
79 hash = version['hash']
80
81 branch_hash = utils.get_branch_hash_name(branch=branch, hash=hash)
82
83 version_dump_path = get_version_dump_path(config_ini=config_ini, version=version)
84 heapprof_dump_path = get_version_heapprof_dump_path(config_ini=config_ini, version=version)
85 if not os.path.exists(version_dump_path):
86 os.mkdir(version_dump_path)
87
88 if not os.path.exists(heapprof_dump_path):
89 os.mkdir(heapprof_dump_path)
90
91 LOG.info(f'Get: {name} {branch_hash}')
92
93 omim.checkout(branch=branch, hash=hash)
94 omim.build(aim='routes_builder_tool', binary_cache_suffix='heap', cmake_options="-DUSE_HEAPPROF=ON")
95
96 LOG.info(f'Start build routes from file: {routes_file}')
97 pool_args = []
98 with open(routes_file) as routes_file_fh:
99 for route_id, line in enumerate(routes_file_fh):
100 args_tuple = (omim, version, config_ini, route_id, line)
101 pool_args.append(args_tuple)
102
103 with Pool(omim.cpu_count) as p:
104 version_result = p.starmap(run_routes_builder_tool_one_route, pool_args)
105
106 results = dict()
107 for result in version_result:
108 results[result['id']] = result['max_mb_usage']
109
110 data_from_heap_comparison[branch_hash] = {
111 'version': version,
112 'results': results
113 }
114
115 LOG.info(os.linesep, os.linesep)
116
117 return data_from_heap_comparison
118
119
120def get_by_func_and_key_in_diff(*, diff, key, func):

Callers 1

mainFunction · 0.85

Calls 6

get_version_dump_pathFunction · 0.85
read_value_by_pathMethod · 0.80
checkoutMethod · 0.80
buildMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected