import sys tottimes = {} cumtimes = {} for l in open(sys.argv[1], "r"): r = l.rsplit(" : ", 2) if len(r) == 3: func, cumtime, tottime = r cumtime = float(cumtime) tottime = float(tottime) tottimes[func] = tottimes.get(func, 0.0) + tottime cumtimes[func] = cumtimes.get(func, 0.0) + cumtime c = 0 for time, func in reversed(sorted([(tottimes[k], k) for k in tottimes])): if func.startswith("jit"): continue else: print("%s = %s (%s)" % (func, time, cumtimes[func])) c += 1 if c > 30: break