| 136 | |
| 137 | |
| 138 | def process_trace(trace_file): |
| 139 | text_string = pathlib.Path(trace_file).read_text() |
| 140 | result = json.loads(text_string) |
| 141 | |
| 142 | output = {} |
| 143 | result = result["traceEvents"] |
| 144 | for o in result: |
| 145 | o = o["args"] |
| 146 | if "runtime-call-stats" in o: |
| 147 | r = o["runtime-call-stats"] |
| 148 | for name in r: |
| 149 | count = r[name][0] |
| 150 | duration = r[name][1] |
| 151 | if name in output: |
| 152 | output[name]["count"] += count |
| 153 | output[name]["duration"] += duration |
| 154 | else: |
| 155 | output[name] = {"count": count, "duration": duration} |
| 156 | |
| 157 | return output |
| 158 | |
| 159 | |
| 160 | def run_benchmark(story, |