Last active
April 7, 2019 03:05
-
-
Save brson/bc52ab2bce7a600b32b4d25846a6c6c0 to your computer and use it in GitHub Desktop.
Script for accumulating and sorting output of rustc --Ztime-passes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import re | |
import operator | |
file = sys.argv[1] | |
r = re.compile("time: (\S.*); rss: (\S*)\s*(.*)") | |
map = { } | |
with open(file) as f: | |
for line in f: | |
line = line.strip() | |
if not line.startswith("time"): | |
pass | |
m = r.match(line) | |
assert m | |
time = m.group(1) | |
desc = m.group(3) | |
time = float(time) | |
if map.get(desc): | |
map[desc] = map[desc] + time | |
else: | |
map[desc] = time | |
sorted = sorted(map.items(), key=operator.itemgetter(1)) | |
for (time, pass_name) in sorted: | |
print("{} - {}".format(time, pass_name)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment