Bug 1061772 - Profiler cost percentage should be calculated based on number of samples and not samples delta time, r=pbrosset

This commit is contained in:
Victor Porof 2014-09-19 08:55:54 -04:00
parent 987ced9232
commit c8a9059d7d
4 changed files with 7 additions and 5 deletions

View File

@ -39,7 +39,7 @@ function test() {
is(container.childNodes[0].childNodes[2].getAttribute("type"), "samples",
"The root node in the tree has an samples cell.");
is(container.childNodes[0].childNodes[2].getAttribute("value"), "",
is(container.childNodes[0].childNodes[2].getAttribute("value"), "3",
"The root node in the tree has the correct samples cell value.");
is(container.childNodes[0].childNodes[3].getAttribute("type"), "function",

View File

@ -31,7 +31,7 @@ function test() {
"The root's duration cell displays the correct value.");
is($$perc(0).getAttribute("value"), "100%",
"The root's percentage cell displays the correct value.");
is($$sampl(0).getAttribute("value"), "",
is($$sampl(0).getAttribute("value"), "3",
"The root's samples cell displays the correct value.");
is($$fun(".call-tree-name")[0].getAttribute("value"), "(root)",
"The root's function cell displays the correct name.");
@ -84,7 +84,7 @@ function test() {
is($$dur(2).getAttribute("value"), "11",
"The .A.B node's duration cell displays the correct value.");
is($$perc(2).getAttribute("value"), "61.11%",
is($$perc(2).getAttribute("value"), "66.66%",
"The .A.B node's percentage cell displays the correct value.");
is($$sampl(2).getAttribute("value"), "2",
"The .A.B node's samples cell displays the correct value.");
@ -103,7 +103,7 @@ function test() {
is($$dur(3).getAttribute("value"), "7",
"The .A.E node's duration cell displays the correct value.");
is($$perc(3).getAttribute("value"), "38.88%",
is($$perc(3).getAttribute("value"), "33.33%",
"The .A.E node's percentage cell displays the correct value.");
is($$sampl(3).getAttribute("value"), "1",
"The .A.E node's samples cell displays the correct value.");

View File

@ -52,6 +52,7 @@ exports._isContent = isContent; // used in tests
* @see ThreadNode.prototype.insert
*/
function ThreadNode(threadSamples, contentOnly, beginAt, endAt) {
this.samples = 0;
this.duration = 0;
this.calls = {};
this._previousSampleTime = 0;
@ -97,6 +98,7 @@ ThreadNode.prototype = {
let sampleDuration = sampleTime - this._previousSampleTime;
this._previousSampleTime = sampleTime;
this.samples++;
this.duration += sampleDuration;
FrameNode.prototype.insert(

View File

@ -63,7 +63,7 @@ CallView.prototype = Heritage.extend(AbstractTreeItem.prototype, {
this.document = document;
let frameInfo = this.frame.getInfo();
let framePercentage = this.frame.duration / this.root.frame.duration * 100;
let framePercentage = this.frame.samples / this.root.frame.samples * 100;
let durationCell = this._createTimeCell(this.frame.duration);
let percentageCell = this._createExecutionCell(framePercentage);