Commit 86078dfd authored by yangguo@chromium.org's avatar yangguo@chromium.org

Add a percentage to each metric in the V8 timeline plot

With the percentage, we can easily figure out how much execution time is spent in what metric.

c.f. https://docs.google.com/a/google.com/file/d/0B7GPzKNdEGeQU04ySy1qOWNuLWs/edit

BUG=

Review URL: https://chromiumcodereview.appspot.com/11975045
Patch from Kentaro Hara <haraken@chromium.org>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13415 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 1074e1f5
......@@ -502,11 +502,25 @@ 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 =
ranges.map(function(range) { return range.duration(); })
.reduce(function(a, b) { return a + b; }, 0);
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"' + ' ' +
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment