Index: tools/plot-timer-events.js |
diff --git a/tools/plot-timer-events.js b/tools/plot-timer-events.js |
index 0a5e5221ae210523f8de835265aad981b1bd1786..00e40f8cfe42ce5222702701c0a210632fe5a6ef 100644 |
--- a/tools/plot-timer-events.js |
+++ b/tools/plot-timer-events.js |
@@ -500,11 +500,26 @@ function GnuplotOutput() { |
print("set xtics out nomirror"); |
print("unset key"); |
+ var percentages = {}; |
+ var total = 0; |
+ for (var name in TimerEvents) { |
+ var event = TimerEvents[name]; |
+ var ranges = MergeRanges(event.ranges); |
+ var exclude_ranges = [new Range(-Infinity, xrange_start), |
+ new Range(xrange_end, Infinity)]; |
+ ranges = ExcludeRanges(ranges, exclude_ranges); |
+ var sum = 0; |
+ for (var i = 0; i < ranges.length; i++) { |
+ sum += ranges[i].end - ranges[i].start; |
+ } |
+ percentages[name] = (sum / (xrange_end - xrange_start) * 100).toFixed(1); |
+ } |
+ |
// Name Y-axis. |
var ytics = []; |
for (name in TimerEvents) { |
var index = TimerEvents[name].index; |
- ytics.push('"' + name + '"' + ' ' + index); |
+ ytics.push('"' + name + ' (' + percentages[name] + '%%)" ' + index); |
} |
ytics.push('"code kind being executed"' + ' ' + (kY1Offset - 1)); |
ytics.push('"top ' + kStackFrames + ' js stack frames"' + ' ' + |