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

Unified Diff: tools/process-heap-prof.py

Issue 159504: Introduce first approximation of constructor heap profile for JS objects. (Closed)
Patch Set: Soeren's comments applied Created 11 years, 5 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 | « test/cctest/test-regexp.cc ('k') | tools/visual_studio/v8_base.vcproj » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/process-heap-prof.py
diff --git a/tools/process-heap-prof.py b/tools/process-heap-prof.py
index b8ab2d39863e345d7572f6a6d541a25d32401eb9..ff83952e0e33dec2205fdd5f41756ad38306ef23 100755
--- a/tools/process-heap-prof.py
+++ b/tools/process-heap-prof.py
@@ -35,10 +35,14 @@
# $ ./shell --log-gc script.js
# $ tools/process-heap-prof.py v8.log | hp2ps -c > script-heap-graph.ps
# ('-c' enables color, see hp2ps manual page for more options)
+# or
+# $ tools/process-heap-prof.py --js-cons-profile v8.log | hp2ps -c > script-heap-graph.ps
+# to get JS constructor profile
+
import csv, sys, time
-def process_logfile(filename):
+def process_logfile(filename, itemname):
first_call_time = None
sample_time = 0.0
sampling = False
@@ -63,11 +67,14 @@ def process_logfile(filename):
elif row[0] == 'heap-sample-end' and row[1] == 'Heap':
print('END_SAMPLE %.2f' % sample_time)
sampling = False
- elif row[0] == 'heap-sample-item' and sampling:
+ elif row[0] == itemname and sampling:
print('%s %d' % (row[1], int(row[3])))
finally:
logfile.close()
except:
sys.exit('can\'t open %s' % filename)
-process_logfile(sys.argv[1])
+if sys.argv[1] == '--js-cons-profile':
+ process_logfile(sys.argv[2], 'heap-js-cons-item')
+else:
+ process_logfile(sys.argv[1], 'heap-sample-item')
« no previous file with comments | « test/cctest/test-regexp.cc ('k') | tools/visual_studio/v8_base.vcproj » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698