OLD | NEW |
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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 LatencyInfoFlow: "LatencyInfo.Flow", | 154 LatencyInfoFlow: "LatencyInfo.Flow", |
155 InputLatencyMouseMove: "InputLatency::MouseMove", | 155 InputLatencyMouseMove: "InputLatency::MouseMove", |
156 InputLatencyMouseWheel: "InputLatency::MouseWheel", | 156 InputLatencyMouseWheel: "InputLatency::MouseWheel", |
157 ImplSideFling: "InputHandlerProxy::HandleGestureFling::started", | 157 ImplSideFling: "InputHandlerProxy::HandleGestureFling::started", |
158 GCIdleLazySweep: "ThreadState::performIdleLazySweep", | 158 GCIdleLazySweep: "ThreadState::performIdleLazySweep", |
159 GCCompleteSweep: "ThreadState::completeSweep", | 159 GCCompleteSweep: "ThreadState::completeSweep", |
160 GCCollectGarbage: "BlinkGCMarking", | 160 GCCollectGarbage: "BlinkGCMarking", |
161 | 161 |
162 // CpuProfile is a virtual event created on frontend to support | 162 // CpuProfile is a virtual event created on frontend to support |
163 // serialization of CPU Profiles within tracing timeline data. | 163 // serialization of CPU Profiles within tracing timeline data. |
164 CpuProfile: "CpuProfile" | 164 CpuProfile: "CpuProfile", |
| 165 Profile: "Profile" |
165 } | 166 } |
166 | 167 |
167 WebInspector.TimelineModel.Category = { | 168 WebInspector.TimelineModel.Category = { |
168 Console: "blink.console", | 169 Console: "blink.console", |
169 UserTiming: "blink.user_timing", | 170 UserTiming: "blink.user_timing", |
170 LatencyInfo: "latencyInfo" | 171 LatencyInfo: "latencyInfo" |
171 }; | 172 }; |
172 | 173 |
173 /** | 174 /** |
174 * @enum {string} | 175 * @enum {string} |
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
745 var cpuProfile; | 746 var cpuProfile; |
746 | 747 |
747 // Check for legacy CpuProfile event format first. | 748 // Check for legacy CpuProfile event format first. |
748 var cpuProfileEvent = events.peekLast(); | 749 var cpuProfileEvent = events.peekLast(); |
749 if (cpuProfileEvent && cpuProfileEvent.name === WebInspector.TimelineMod
el.RecordType.CpuProfile) { | 750 if (cpuProfileEvent && cpuProfileEvent.name === WebInspector.TimelineMod
el.RecordType.CpuProfile) { |
750 var eventData = cpuProfileEvent.args["data"]; | 751 var eventData = cpuProfileEvent.args["data"]; |
751 cpuProfile = /** @type {?ProfilerAgent.Profile} */ (eventData && eve
ntData["cpuProfile"]); | 752 cpuProfile = /** @type {?ProfilerAgent.Profile} */ (eventData && eve
ntData["cpuProfile"]); |
752 } | 753 } |
753 | 754 |
754 if (!cpuProfile) { | 755 if (!cpuProfile) { |
755 cpuProfileEvent = events.find(e => e.name === WebInspector.TimelineM
odel.RecordType.CpuProfile); | 756 cpuProfileEvent = events.find(e => e.name === WebInspector.TimelineM
odel.RecordType.Profile); |
756 if (!cpuProfileEvent) | 757 if (!cpuProfileEvent) |
757 return null; | 758 return null; |
758 var profileGroup = tracingModel.profileGroup(cpuProfileEvent.id); | 759 var profileGroup = tracingModel.profileGroup(cpuProfileEvent.id); |
759 if (!profileGroup) { | 760 if (!profileGroup) { |
760 WebInspector.console.error("Invalid CPU profile format."); | 761 WebInspector.console.error("Invalid CPU profile format."); |
761 return null; | 762 return null; |
762 } | 763 } |
763 cpuProfile = /** @type {!ProfilerAgent.Profile} */ ({ | 764 cpuProfile = /** @type {!ProfilerAgent.Profile} */ ({ |
764 startTime: cpuProfileEvent.args["data"]["startTime"], | 765 startTime: cpuProfileEvent.args["data"]["startTime"], |
765 endTime: 0, | 766 endTime: 0, |
766 nodes: [], | 767 nodes: [], |
767 samples: [], | 768 samples: [], |
768 timeDeltas: [] | 769 timeDeltas: [] |
769 }); | 770 }); |
770 for (var profileEvent of profileGroup.children) { | 771 for (var profileEvent of profileGroup.children) { |
771 var eventData = profileEvent.args["data"]; | 772 var eventData = profileEvent.args["data"]; |
772 if ("startTime" in eventData) | 773 if ("startTime" in eventData) |
773 cpuProfile.startTime = eventData["startTime"]; | 774 cpuProfile.startTime = eventData["startTime"]; |
774 if ("endTime" in eventData) | 775 if ("endTime" in eventData) |
775 cpuProfile.endTime = eventData["endTime"]; | 776 cpuProfile.endTime = eventData["endTime"]; |
776 cpuProfile.nodes.pushAll(eventData["nodes"] || []); | 777 var nodesAndSamples = eventData["cpuProfile"] || {}; |
777 cpuProfile.samples.pushAll(eventData["samples"] || []); | 778 cpuProfile.nodes.pushAll(nodesAndSamples["nodes"] || []); |
| 779 cpuProfile.samples.pushAll(nodesAndSamples["samples"] || []); |
778 cpuProfile.timeDeltas.pushAll(eventData["timeDeltas"] || []); | 780 cpuProfile.timeDeltas.pushAll(eventData["timeDeltas"] || []); |
| 781 if (cpuProfile.samples.length !== cpuProfile.timeDeltas.length)
{ |
| 782 WebInspector.console.error("Failed to parse CPU profile."); |
| 783 return null; |
| 784 } |
779 } | 785 } |
780 if (!cpuProfile.endTime) | 786 if (!cpuProfile.endTime) |
781 cpuProfile.endTime = cpuProfile.timeDeltas.reduce((x, y) => x +
y, cpuProfile.startTime); | 787 cpuProfile.endTime = cpuProfile.timeDeltas.reduce((x, y) => x +
y, cpuProfile.startTime); |
782 } | 788 } |
783 | 789 |
784 try { | 790 try { |
785 var jsProfileModel = new WebInspector.CPUProfileDataModel(cpuProfile
); | 791 var jsProfileModel = new WebInspector.CPUProfileDataModel(cpuProfile
); |
786 this._cpuProfiles.push(jsProfileModel); | 792 this._cpuProfiles.push(jsProfileModel); |
787 return jsProfileModel; | 793 return jsProfileModel; |
788 } catch (e) { | 794 } catch (e) { |
(...skipping 1058 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1847 if (!id) | 1853 if (!id) |
1848 return; | 1854 return; |
1849 /** @type {!Map<string, !WebInspector.TracingModel.Event>|undefined} */ | 1855 /** @type {!Map<string, !WebInspector.TracingModel.Event>|undefined} */ |
1850 var initiatorMap = this._initiatorByType.get(initiatorType); | 1856 var initiatorMap = this._initiatorByType.get(initiatorType); |
1851 if (isInitiator) | 1857 if (isInitiator) |
1852 initiatorMap.set(id, event); | 1858 initiatorMap.set(id, event); |
1853 else | 1859 else |
1854 event.initiator = initiatorMap.get(id) || null; | 1860 event.initiator = initiatorMap.get(id) || null; |
1855 } | 1861 } |
1856 } | 1862 } |
OLD | NEW |