(*, omim, config_ini, versions)
| 70 | |
| 71 | |
| 72 | def 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 | |
| 120 | def get_by_func_and_key_in_diff(*, diff, key, func): |
no test coverage detected