Index: tools/gc-nvp-trace-processor.py |
=================================================================== |
--- tools/gc-nvp-trace-processor.py (revision 9327) |
+++ tools/gc-nvp-trace-processor.py (working copy) |
@@ -226,6 +226,10 @@ |
return r['pause'] - r['external'] |
return 0 |
+ |
+def real_mutator(r): |
+ return r['mutator'] - r['stepstook'] |
+ |
plots = [ |
[ |
Set('style fill solid 0.5 noborder'), |
@@ -236,11 +240,28 @@ |
Item('Sweep', 'sweep', lc = 'blue'), |
Item('Compaction', 'compact', lc = 'red'), |
Item('External', 'external', lc = '#489D43'), |
- Item('Other', other_scope, lc = 'grey')) |
+ Item('Other', other_scope, lc = 'grey'), |
+ Item('IGC Steps', 'stepstook', lc = '#FF6347')) |
], |
[ |
+ Set('style fill solid 0.5 noborder'), |
Set('style histogram rowstacked'), |
Set('style data histograms'), |
+ Plot(Item('Scavenge', scavenge_scope, lc = 'green'), |
+ Item('Marking', 'mark', lc = 'purple'), |
+ Item('Sweep', 'sweep', lc = 'blue'), |
+ Item('Compaction', 'compact', lc = 'red'), |
+ Item('External', 'external', lc = '#489D43'), |
+ Item('Other', other_scope, lc = '#ADD8E6'), |
+ Item('External', 'external', lc = '#D3D3D3')) |
+ ], |
+ |
+ [ |
+ Plot(Item('Mutator', real_mutator, lc = 'black', style = 'lines')) |
+ ], |
+ [ |
+ Set('style histogram rowstacked'), |
+ Set('style data histograms'), |
Plot(Item('Heap Size (before GC)', 'total_size_before', x1y2, |
fs = 'solid 0.4 noborder', |
lc = 'green'), |
@@ -275,7 +296,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) |
@@ -290,7 +311,9 @@ |
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) |
def stats(out, prefix, trace, field): |
@@ -302,7 +325,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 |
@@ -311,7 +334,32 @@ |
'<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>') |
out.write('<table>') |
@@ -329,6 +377,11 @@ |
filter(lambda r: r['external'] != 0, trace), |
'external') |
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>') |