Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(204)

Unified Diff: tools/ignition/bytecode_dispatches_report.py

Issue 1875263004: [Interpreter] Report hottest bytecodes in bytecode_dispatches_report.py (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@viz-count-h2h
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/ignition/bytecode_dispatches_report_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/ignition/bytecode_dispatches_report.py
diff --git a/tools/ignition/bytecode_dispatches_report.py b/tools/ignition/bytecode_dispatches_report.py
index 2c04bef600e0336e9cb84f21d928b20eb3eb61eb..bf987b10a2d1f422702b78e0bed6f1fcede88ba3 100755
--- a/tools/ignition/bytecode_dispatches_report.py
+++ b/tools/ignition/bytecode_dispatches_report.py
@@ -68,6 +68,22 @@ def print_top_counters(dispatches_table, top_count):
print "{:>12d}\t{} -> {}".format(counter, source, destination)
+def find_top_dispatch_sources(dispatches_table, top_count):
+ def dispatch_sources_counters_generator():
+ for source, counters_from_source in dispatches_table.items():
+ yield source, sum(counters_from_source.values())
+
+ return heapq.nlargest(top_count, dispatch_sources_counters_generator(),
rmcilroy 2016/04/13 08:45:54 I would probably default to printing all the bytec
Stefano Sanfilippo 2016/04/13 10:19:38 Done.
+ key=lambda x: x[1])
+
+
+def print_top_dispatch_sources(dispatches_table, top_count):
+ top_dispatch_sources = find_top_dispatch_sources(dispatches_table, top_count)
+ print "Top {} dispatch sources:".format(top_count)
rmcilroy 2016/04/13 08:45:54 Sources is not a good name since it isn't clear wh
Stefano Sanfilippo 2016/04/13 10:19:37 Done.
+ for source, counter in top_dispatch_sources:
+ print "{:>12d}\t{}".format(counter, source)
+
+
def build_counters_matrix(dispatches_table):
labels = sorted(dispatches_table.keys())
@@ -186,6 +202,8 @@ def main():
program_options.plot_size)
pyplot.savefig(program_options.output_filename)
else:
+ print_top_dispatch_sources(dispatches_table, program_options.top_count)
rmcilroy 2016/04/13 08:45:54 Please make this a separate option (and be the def
Stefano Sanfilippo 2016/04/13 10:19:37 Done.
+ print # just a blank line
print_top_counters(dispatches_table, program_options.top_count)
« no previous file with comments | « no previous file | tools/ignition/bytecode_dispatches_report_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698