Revision: 6246
Author: [email protected]
Date: Mon Jan 10 04:23:53 2011
Log: Add GC throughput metrics to gc-nvp-trace-processor.

Review URL: http://codereview.chromium.org/6220001
http://code.google.com/p/v8/source/detail?r=6246

Modified:
 /branches/experimental/gc/tools/gc-nvp-trace-processor.py

=======================================
--- /branches/experimental/gc/tools/gc-nvp-trace-processor.py Tue Dec 7 03:01:02 2010 +++ /branches/experimental/gc/tools/gc-nvp-trace-processor.py Mon Jan 10 04:23:53 2011
@@ -265,7 +265,7 @@
   return reduce(lambda t,r: f(t, r[field]), trace, init)

 def calc_total(trace, field):
-  return freduce(lambda t,v: t + v, field, trace, 0)
+  return freduce(lambda t,v: t + long(v), field, trace, long(0))

 def calc_max(trace, field):
   return freduce(lambda t,r: max(t, r), field, trace, 0)
@@ -280,6 +280,8 @@
   marksweeps = filter(lambda r: r['gc'] == 'ms', trace)
   markcompacts = filter(lambda r: r['gc'] == 'mc', trace)
   scavenges = filter(lambda r: r['gc'] == 's', trace)
+  globalgcs = filter(lambda r: r['gc'] != 's', trace)
+

   charts = plot_all(plots, trace, filename)

@@ -292,7 +294,7 @@
     else:
       avg = 0
     if n > 1:
- dev = math.sqrt(freduce(lambda t,r: (r - avg) ** 2, field, trace, 0) / + dev = math.sqrt(freduce(lambda t,r: t + (r - avg) ** 2, field, trace, 0) /
                       (n - 1))
     else:
       dev = 0
@@ -301,6 +303,31 @@
               '<td>%d</td><td>%d [dev %f]</td></tr>' %
               (prefix, n, total, max, avg, dev))

+  def HumanReadable(size):
+    suffixes = ['bytes', 'kB', 'MB', 'GB']
+    power = 1
+    for i in range(len(suffixes)):
+      if size < power*1024:
+        return "%.1f" % (float(size) / power) + " " + suffixes[i]
+      power *= 1024
+
+  def throughput(name, trace):
+    total_live_after = calc_total(trace, 'total_size_after')
+    total_live_before = calc_total(trace, 'total_size_before')
+    total_gc = calc_total(trace, 'pause')
+    if total_gc == 0:
+      return
+    out.write('GC %s Throughput (after): %s / %s ms = %s/ms<br/>' %
+              (name,
+               HumanReadable(total_live_after),
+               total_gc,
+               HumanReadable(total_live_after / total_gc)))
+    out.write('GC %s Throughput (before): %s / %s ms = %s/ms<br/>' %
+              (name,
+               HumanReadable(total_live_before),
+               total_gc,
+               HumanReadable(total_live_before / total_gc)))
+

   with open(filename + '.html', 'w') as out:
     out.write('<html><body>')
@@ -315,6 +342,11 @@
     stats(out, 'Sweep', filter(lambda r: r['sweep'] != 0, trace), 'sweep')
stats(out, 'Compact', filter(lambda r: r['compact'] != 0, trace), 'compact')
     out.write('</table>')
+    throughput('TOTAL', trace)
+    throughput('MS', marksweeps)
+    throughput('MC', markcompacts)
+    throughput('OLDSPACE', globalgcs)
+    out.write('<br/>')
     for chart in charts:
       out.write('<img src="%s">' % chart)
       out.write('</body></html>')

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to