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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/timeline/TimelineModel.js

Issue 1748993002: DevTools: Initial implementation of line-level CPU profile. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: added a test. Created 4 years, 9 months 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 var events = thread.events(); 722 var events = thread.events();
723 var asyncEvents = thread.asyncEvents(); 723 var asyncEvents = thread.asyncEvents();
724 724
725 var jsSamples; 725 var jsSamples;
726 if (Runtime.experiments.isEnabled("timelineTracingJSProfile")) { 726 if (Runtime.experiments.isEnabled("timelineTracingJSProfile")) {
727 jsSamples = WebInspector.TimelineJSProfileProcessor.processRawV8Samp les(events); 727 jsSamples = WebInspector.TimelineJSProfileProcessor.processRawV8Samp les(events);
728 } else { 728 } else {
729 var cpuProfileEvent = events.peekLast(); 729 var cpuProfileEvent = events.peekLast();
730 if (cpuProfileEvent && cpuProfileEvent.name === WebInspector.Timelin eModel.RecordType.CpuProfile) { 730 if (cpuProfileEvent && cpuProfileEvent.name === WebInspector.Timelin eModel.RecordType.CpuProfile) {
731 var cpuProfile = cpuProfileEvent.args["data"]["cpuProfile"]; 731 var cpuProfile = cpuProfileEvent.args["data"]["cpuProfile"];
732 if (cpuProfile) 732 if (cpuProfile) {
733 jsSamples = WebInspector.TimelineJSProfileProcessor.generate TracingEventsFromCpuProfile(cpuProfile, thread); 733 var jsProfileModel = new WebInspector.CPUProfileDataModel(cp uProfile);
caseq 2016/03/11 22:52:05 Can we take it out of model?
alph 2016/03/12 00:47:54 Done.
734 WebInspector.TimelineJSProfileProcessor.buildLineLevelProfil es(jsProfileModel);
735 jsSamples = WebInspector.TimelineJSProfileProcessor.generate TracingEventsFromCpuProfile(jsProfileModel, thread);
736 }
734 } 737 }
735 } 738 }
736 739
737 if (jsSamples && jsSamples.length) 740 if (jsSamples && jsSamples.length)
738 events = events.mergeOrdered(jsSamples, WebInspector.TracingModel.Ev ent.orderedCompareStartTime); 741 events = events.mergeOrdered(jsSamples, WebInspector.TracingModel.Ev ent.orderedCompareStartTime);
739 if (jsSamples || events.some(function(e) { return e.name === WebInspecto r.TimelineModel.RecordType.JSSample; })) { 742 if (jsSamples || events.some(function(e) { return e.name === WebInspecto r.TimelineModel.RecordType.JSSample; })) {
740 var jsFrameEvents = WebInspector.TimelineJSProfileProcessor.generate JSFrameEvents(events); 743 var jsFrameEvents = WebInspector.TimelineJSProfileProcessor.generate JSFrameEvents(events);
741 if (jsFrameEvents && jsFrameEvents.length) 744 if (jsFrameEvents && jsFrameEvents.length)
742 events = jsFrameEvents.mergeOrdered(events, WebInspector.Tracing Model.Event.orderedCompareStartTime); 745 events = jsFrameEvents.mergeOrdered(events, WebInspector.Tracing Model.Event.orderedCompareStartTime);
743 } 746 }
(...skipping 972 matching lines...) Expand 10 before | Expand all | Expand 10 after
1716 if (!id) 1719 if (!id)
1717 return; 1720 return;
1718 /** @type {!Map<string, !WebInspector.TracingModel.Event>|undefined} */ 1721 /** @type {!Map<string, !WebInspector.TracingModel.Event>|undefined} */
1719 var initiatorMap = this._initiatorByType.get(initiatorType); 1722 var initiatorMap = this._initiatorByType.get(initiatorType);
1720 if (isInitiator) 1723 if (isInitiator)
1721 initiatorMap.set(id, event); 1724 initiatorMap.set(id, event);
1722 else 1725 else
1723 event.initiator = initiatorMap.get(id) || null; 1726 event.initiator = initiatorMap.get(id) || null;
1724 } 1727 }
1725 } 1728 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698