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

Unified Diff: tools/ll_prof.py

Issue 7039040: ll_prof: Output tick percentage by symbol/library. (Closed)
Patch Set: Created 9 years, 7 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/ll_prof.py
diff --git a/tools/ll_prof.py b/tools/ll_prof.py
index 650f923a2d5f397990c83d677f272147137151f1..798b574931dde22f939411f09e7eeebac5365d0b 100755
--- a/tools/ll_prof.py
+++ b/tools/ll_prof.py
@@ -780,12 +780,14 @@ class LibraryRepo(object):
return True
-def PrintReport(code_map, library_repo, arch, options):
+def PrintReport(code_map, library_repo, arch, ticks, options):
print "Ticks per symbol:"
used_code = [code for code in code_map.UsedCode()]
used_code.sort(key=lambda x: x.self_ticks, reverse=True)
for i, code in enumerate(used_code):
- print "%10d %s [%s]" % (code.self_ticks, code.FullName(), code.origin)
+ code_ticks = code.self_ticks
+ print "%10d %5.1f%% %s [%s]" % (code_ticks, 100. * code_ticks / ticks,
+ code.FullName(), code.origin)
if options.disasm_all or i < options.disasm_top:
code.PrintAnnotated(arch, options)
print
@@ -793,7 +795,9 @@ def PrintReport(code_map, library_repo, arch, options):
mmap_infos = [m for m in library_repo.infos]
mmap_infos.sort(key=lambda m: m.ticks, reverse=True)
for mmap_info in mmap_infos:
- print "%10d %s" % (mmap_info.ticks, mmap_info.unique_name)
+ mmap_ticks = mmap_info.ticks
+ print "%10d %5.1f%% %s" % (mmap_ticks, 100. * mmap_ticks / ticks,
+ mmap_info.unique_name)
def PrintDot(code_map, options):
@@ -878,6 +882,7 @@ if __name__ == "__main__":
if not options.quiet:
print "Generated code architecture: %s" % log_reader.arch
print
+ sys.stdout.flush()
# Process the code and trace logs.
library_repo = LibraryRepo()
@@ -919,7 +924,7 @@ if __name__ == "__main__":
if options.dot:
PrintDot(code_map, options)
else:
- PrintReport(code_map, library_repo, log_reader.arch, options)
+ PrintReport(code_map, library_repo, log_reader.arch, ticks, options)
if not options.quiet:
print
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698