Commit 0215c87e authored by Paul Irish's avatar Paul Irish Committed by Commit Bot

DevTools: JS Profile nodes should be unique by column number

Change-Id: I411b6c8686c4d1d3e790a63a65225bb0ba5aac44
Reviewed-on: https://chromium-review.googlesource.com/1110230Reviewed-by: default avatarAlexei Filippov <alph@chromium.org>
Commit-Queue: Paul Irish <paulirish@chromium.org>
Cr-Commit-Position: refs/heads/master@{#570304}
parent cee84faa
Tests that search works for large bottom-up view of CPU profile. Tests that search works for large bottom-up view of CPU profile.
foo12@0:12: foo12 10 9890 foo12@0:12:0: foo12 10 9890
foo120@0:120: foo120 10 8810 foo120@0:120:0: foo120 10 8810
foo121@0:121: foo121 10 8800 foo121@0:121:0: foo121 10 8800
foo122@0:122: foo122 10 8790 foo122@0:122:0: foo122 10 8790
foo123@0:123: foo123 10 8780 foo123@0:123:0: foo123 10 8780
foo124@0:124: foo124 10 8770 foo124@0:124:0: foo124 10 8770
foo125@0:125: foo125 10 8760 foo125@0:125:0: foo125 10 8760
foo126@0:126: foo126 10 8750 foo126@0:126:0: foo126 10 8750
foo127@0:127: foo127 10 8740 foo127@0:127:0: foo127 10 8740
foo128@0:128: foo128 10 8730 foo128@0:128:0: foo128 10 8730
foo129@0:129: foo129 10 8720 foo129@0:129:0: foo129 10 8720
Profiler was disabled. Profiler was disabled.
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
for (var i = 1; i <= count; ++i) { for (var i = 1; i <= count; ++i) {
nodes.push({ nodes.push({
'id': startId + i - 1, 'id': startId + i - 1,
'callFrame': {'functionName': 'foo' + i, 'scriptId': '0', 'url': 'a.js', 'lineNumber': i}, 'callFrame': {'functionName': 'foo' + i, 'scriptId': '0', 'url': 'a.js', 'lineNumber': i, 'columnNumber': 0},
'hitCount': 10, 'hitCount': 10,
'children': i < count ? [startId + i] : [] 'children': i < count ? [startId + i] : []
}); });
...@@ -35,13 +35,14 @@ ...@@ -35,13 +35,14 @@
'scriptId': '0', 'scriptId': '0',
'url': 'a.js', 'url': 'a.js',
'lineNumber': 0, 'lineNumber': 0,
'columnNumber': 0,
}, },
'hitCount': 1, 'hitCount': 1,
'children': [1, 2] 'children': [1, 2]
}, },
{ {
'id': 1, 'id': 1,
'callFrame': {'functionName': '(idle)', 'scriptId': '0', 'url': 'a.js', 'lineNumber': 1}, 'callFrame': {'functionName': '(idle)', 'scriptId': '0', 'url': 'a.js', 'lineNumber': 1, 'columnNumber': 1},
'hitCount': 2, 'hitCount': 2,
'children': [] 'children': []
} }
......
Tests bottom-up view self and total time calculation in CPU profiler. Tests bottom-up view self and total time calculation in CPU profiler.
(idle)@0:1: (idle) 500 500 500.0 ms500.0 ms(idle) (idle)@0:1:0: (idle) 500 500 500.0 ms500.0 ms(idle)
A@0:4642: A 125 185 125.0 ms25.00 %185.0 ms37.00 %A A@0:4642:0: A 125 185 125.0 ms25.00 %185.0 ms37.00 %A
C@0:525: C 100 125 100.0 ms20.00 %125.0 ms25.00 %C C@0:525:0: C 100 125 100.0 ms20.00 %125.0 ms25.00 %C
B@0:4662: B 75 140 75.0 ms15.00 %140.0 ms28.00 %B B@0:4662:0: B 75 140 75.0 ms15.00 %140.0 ms28.00 %B
D@0:425: D 25 25 25.0 ms5.00 %25.0 ms5.00 %D D@0:425:0: D 20 20 20.0 ms4.00 %20.0 ms4.00 %D
D@0:425:222: D 5 5 5.0 ms1.00 %5.0 ms1.00 %D
Profiler was disabled. Profiler was disabled.
...@@ -15,49 +15,55 @@ ...@@ -15,49 +15,55 @@
'nodes': [ 'nodes': [
{ {
'id': 0, 'id': 0,
'callFrame': {'functionName': '(root)', 'scriptId': '0', 'url': 'a.js', 'lineNumber': 0}, 'callFrame': {'functionName': '(root)', 'scriptId': '0', 'url': 'a.js', 'lineNumber': 0, 'columnNumber': 0},
'hitCount': 350 'hitCount': 350
}, },
{ {
'id': 1, 'id': 1,
'callFrame': {'functionName': '(idle)', 'scriptId': '0', 'url': 'a.js', 'lineNumber': 1}, 'callFrame': {'functionName': '(idle)', 'scriptId': '0', 'url': 'a.js', 'lineNumber': 1, 'columnNumber': 0},
'hitCount': 1000, 'hitCount': 1000,
'parent': 0 'parent': 0
}, },
{ {
'id': 2, 'id': 2,
'callFrame': {'functionName': 'A', 'scriptId': '0', 'url': 'a.js', 'lineNumber': 4642}, 'callFrame': {'functionName': 'A', 'scriptId': '0', 'url': 'a.js', 'lineNumber': 4642, 'columnNumber': 0},
'hitCount': 250, 'hitCount': 250,
'parent': 0 'parent': 0
}, },
{ {
'id': 3, 'id': 3,
'callFrame': {'functionName': 'C', 'scriptId': '0', 'url': 'a.js', 'lineNumber': 525}, 'callFrame': {'functionName': 'C', 'scriptId': '0', 'url': 'a.js', 'lineNumber': 525, 'columnNumber': 0},
'hitCount': 100, 'hitCount': 100,
'parent': 2 'parent': 2
}, },
{ {
'id': 4, 'id': 4,
'callFrame': {'functionName': 'D', 'scriptId': '0', 'url': 'a.js', 'lineNumber': 425}, 'callFrame': {'functionName': 'D', 'scriptId': '0', 'url': 'a.js', 'lineNumber': 425, 'columnNumber': 0},
'hitCount': 20, 'hitCount': 20,
'parent': 3 'parent': 3
}, },
{ {
'id': 5, 'id': 5,
'callFrame': {'functionName': 'B', 'scriptId': '0', 'url': 'a.js', 'lineNumber': 4662}, 'callFrame': {'functionName': 'B', 'scriptId': '0', 'url': 'a.js', 'lineNumber': 4662, 'columnNumber': 0},
'hitCount': 150, 'hitCount': 150,
'parent': 0 'parent': 0
}, },
{ {
'id': 6, 'id': 6,
'callFrame': {'functionName': 'C', 'scriptId': '0', 'url': 'a.js', 'lineNumber': 525}, 'callFrame': {'functionName': 'C', 'scriptId': '0', 'url': 'a.js', 'lineNumber': 525, 'columnNumber': 0},
'hitCount': 100, 'hitCount': 100,
'parent': 5 'parent': 5
}, },
{ {
'id': 7, 'id': 7,
'callFrame': {'functionName': 'D', 'scriptId': '0', 'url': 'a.js', 'lineNumber': 425}, 'callFrame': {'functionName': 'D', 'scriptId': '0', 'url': 'a.js', 'lineNumber': 425, 'columnNumber': 0},
'hitCount': 30, 'hitCount': 20,
'parent': 6
},
{
'id': 8,
'callFrame': {'functionName': 'D', 'scriptId': '0', 'url': 'a.js', 'lineNumber': 425, 'columnNumber': 222},
'hitCount': 10,
'parent': 6 'parent': 6
} }
], ],
......
...@@ -12,7 +12,7 @@ SDK.ProfileNode = class { ...@@ -12,7 +12,7 @@ SDK.ProfileNode = class {
/** @type {!Protocol.Runtime.CallFrame} */ /** @type {!Protocol.Runtime.CallFrame} */
this.callFrame = callFrame; this.callFrame = callFrame;
/** @type {string} */ /** @type {string} */
this.callUID = `${this.callFrame.functionName}@${this.callFrame.scriptId}:${this.callFrame.lineNumber}`; this.callUID = `${callFrame.functionName}@${callFrame.scriptId}:${callFrame.lineNumber}:${callFrame.columnNumber}`;
/** @type {number} */ /** @type {number} */
this.self = 0; this.self = 0;
/** @type {number} */ /** @type {number} */
......
...@@ -850,7 +850,7 @@ TimelineModel.TimelineModel = class { ...@@ -850,7 +850,7 @@ TimelineModel.TimelineModel = class {
} }
case recordTypes.FrameStartedLoading: case recordTypes.FrameStartedLoading:
if (this._mainFrame.frameId !== event.args['frame']) if (timelineData.frameId !== event.args['frame'])
return false; return false;
break; break;
......
...@@ -579,6 +579,6 @@ TimelineModel.TimelineProfileTree._eventId = function(event) { ...@@ -579,6 +579,6 @@ TimelineModel.TimelineProfileTree._eventId = function(event) {
const functionName = frame['functionName']; const functionName = frame['functionName'];
const name = TimelineModel.TimelineJSProfileProcessor.isNativeRuntimeFrame(frame) ? const name = TimelineModel.TimelineJSProfileProcessor.isNativeRuntimeFrame(frame) ?
TimelineModel.TimelineJSProfileProcessor.nativeGroup(functionName) || functionName : TimelineModel.TimelineJSProfileProcessor.nativeGroup(functionName) || functionName :
`${functionName}:${frame['lineNumber']}`; `${functionName}:${frame['lineNumber']}:${frame['columnNumber']}`;
return `f:${name}@${location}`; return `f:${name}@${location}`;
}; };
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