|
@@ -12,12 +12,13 @@ for l in open(sys.argv[1], "r"):
|
|
|
tottimes[func] = tottimes.get(func, 0.0) + tottime
|
|
|
cumtimes[func] = cumtimes.get(func, 0.0) + cumtime
|
|
|
|
|
|
+lists = [(funcname, tottimes[funcname], cumtimes[funcname]) for funcname in tottimes]
|
|
|
+
|
|
|
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]))
|
|
|
+lists.sort(key=lambda i: i[int(sys.argv[2])])
|
|
|
+for func, tottime, cumtime in reversed(lists):
|
|
|
+ if not func.startswith("jit"):
|
|
|
+ print("%s = %s (%s)" % (func, tottime, cumtime))
|
|
|
c += 1
|
|
|
- if c > 30:
|
|
|
+ if c > int(sys.argv[3]):
|
|
|
break
|