Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Side by Side Diff: Source/devtools/front_end/timeline/TimelineJSProfile.js

Issue 622843002: DevTools: Support timeline JS sampling for all threads. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: tweak Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/devtools/front_end/timeline/TracingModel.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 5
6 WebInspector.TimelineJSProfileProcessor = { }; 6 WebInspector.TimelineJSProfileProcessor = { };
7 7
8 /** 8 /**
9 * @param {!WebInspector.TracingTimelineModel} timelineModel
10 * @param {!ProfilerAgent.CPUProfile} jsProfile 9 * @param {!ProfilerAgent.CPUProfile} jsProfile
10 * @param {!WebInspector.TracingModel.Thread} thread
11 * @return {!Array.<!WebInspector.TracingModel.Event>} 11 * @return {!Array.<!WebInspector.TracingModel.Event>}
12 */ 12 */
13 WebInspector.TimelineJSProfileProcessor.generateTracingEventsFromCpuProfile = fu nction(timelineModel, jsProfile) 13 WebInspector.TimelineJSProfileProcessor.generateTracingEventsFromCpuProfile = fu nction(jsProfile, thread)
14 { 14 {
15 if (!jsProfile.samples) 15 if (!jsProfile.samples)
16 return []; 16 return [];
17 var jsProfileModel = new WebInspector.CPUProfileDataModel(jsProfile); 17 var jsProfileModel = new WebInspector.CPUProfileDataModel(jsProfile);
18 var idleNode = jsProfileModel.idleNode; 18 var idleNode = jsProfileModel.idleNode;
19 var programNode = jsProfileModel.programNode; 19 var programNode = jsProfileModel.programNode;
20 var gcNode = jsProfileModel.gcNode; 20 var gcNode = jsProfileModel.gcNode;
21 var samples = jsProfileModel.samples; 21 var samples = jsProfileModel.samples;
22 var timestamps = jsProfileModel.timestamps; 22 var timestamps = jsProfileModel.timestamps;
23 var jsEvents = []; 23 var jsEvents = [];
24 var mainThread = timelineModel.mainThreadEvents()[0].thread;
25 for (var i = 0; i < samples.length; ++i) { 24 for (var i = 0; i < samples.length; ++i) {
26 var node = jsProfileModel.nodeByIndex(i); 25 var node = jsProfileModel.nodeByIndex(i);
27 if (node === programNode || node === gcNode || node === idleNode) 26 if (node === programNode || node === gcNode || node === idleNode)
28 continue; 27 continue;
29 var stackTrace = node._stackTraceArray; 28 var stackTrace = node._stackTraceArray;
30 if (!stackTrace) { 29 if (!stackTrace) {
31 stackTrace = /** @type {!ConsoleAgent.StackTrace} */ (new Array(node .depth + 1)); 30 stackTrace = /** @type {!ConsoleAgent.StackTrace} */ (new Array(node .depth + 1));
32 node._stackTraceArray = stackTrace; 31 node._stackTraceArray = stackTrace;
33 for (var j = 0; node.parent; node = node.parent) 32 for (var j = 0; node.parent; node = node.parent)
34 stackTrace[j++] = /** @type {!ConsoleAgent.CallFrame} */ (node); 33 stackTrace[j++] = /** @type {!ConsoleAgent.CallFrame} */ (node);
35 } 34 }
36 var jsEvent = new WebInspector.TracingModel.Event(WebInspector.TracingMo del.DevToolsMetadataEventCategory, WebInspector.TracingTimelineModel.RecordType. JSSample, 35 var jsEvent = new WebInspector.TracingModel.Event(WebInspector.TracingMo del.DevToolsMetadataEventCategory, WebInspector.TracingTimelineModel.RecordType. JSSample,
37 WebInspector.TracingModel.Phase.Instant, timestamps[i], mainThread); 36 WebInspector.TracingModel.Phase.Instant, timestamps[i], thread);
38 jsEvent.stackTrace = stackTrace; 37 jsEvent.stackTrace = stackTrace;
39 jsEvents.push(jsEvent); 38 jsEvents.push(jsEvent);
40 } 39 }
41 return jsEvents; 40 return jsEvents;
42 } 41 }
43 42
44 /** 43 /**
45 * @param {!Array.<!WebInspector.TracingModel.Event>} events 44 * @param {!Array.<!WebInspector.TracingModel.Event>} events
46 * @return {!Array.<!WebInspector.TracingModel.Event>} 45 * @return {!Array.<!WebInspector.TracingModel.Event>}
47 */ 46 */
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 stack.push(e); 128 stack.push(e);
130 } else { 129 } else {
131 onInstantEvent(e, stack.peekLast()); 130 onInstantEvent(e, stack.peekLast());
132 } 131 }
133 } 132 }
134 while (stack.length) 133 while (stack.length)
135 onEndEvent(stack.pop()); 134 onEndEvent(stack.pop());
136 135
137 return jsFrameEvents; 136 return jsFrameEvents;
138 } 137 }
OLDNEW
« no previous file with comments | « no previous file | Source/devtools/front_end/timeline/TracingModel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698