OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 18 matching lines...) Expand all Loading... |
29 * @extends {WebInspector.ProfileView} | 29 * @extends {WebInspector.ProfileView} |
30 * @param {!WebInspector.CPUProfileHeader} profileHeader | 30 * @param {!WebInspector.CPUProfileHeader} profileHeader |
31 */ | 31 */ |
32 WebInspector.CPUProfileView = function(profileHeader) | 32 WebInspector.CPUProfileView = function(profileHeader) |
33 { | 33 { |
34 this._profileHeader = profileHeader; | 34 this._profileHeader = profileHeader; |
35 this.profile = new WebInspector.CPUProfileDataModel(profileHeader._profile |
| profileHeader.protocolProfile()); | 35 this.profile = new WebInspector.CPUProfileDataModel(profileHeader._profile |
| profileHeader.protocolProfile()); |
36 this.adjustedTotal = this.profile.profileHead.total; | 36 this.adjustedTotal = this.profile.profileHead.total; |
37 this.adjustedTotal -= this.profile.idleNode ? this.profile.idleNode.total :
0; | 37 this.adjustedTotal -= this.profile.idleNode ? this.profile.idleNode.total :
0; |
38 WebInspector.ProfileView.call(this, new WebInspector.CPUProfileView.NodeForm
atter(this)); | 38 WebInspector.ProfileView.call(this, new WebInspector.CPUProfileView.NodeForm
atter(this)); |
39 } | 39 }; |
40 | 40 |
41 WebInspector.CPUProfileView.prototype = { | 41 WebInspector.CPUProfileView.prototype = { |
42 /** | 42 /** |
43 * @override | 43 * @override |
44 */ | 44 */ |
45 wasShown: function() | 45 wasShown: function() |
46 { | 46 { |
47 WebInspector.ProfileView.prototype.wasShown.call(this); | 47 WebInspector.ProfileView.prototype.wasShown.call(this); |
48 var lineLevelProfile = WebInspector.LineLevelProfile.instance(); | 48 var lineLevelProfile = WebInspector.LineLevelProfile.instance(); |
49 lineLevelProfile.reset(); | 49 lineLevelProfile.reset(); |
(...skipping 17 matching lines...) Expand all Loading... |
67 /** | 67 /** |
68 * @override | 68 * @override |
69 * @return {!WebInspector.FlameChartDataProvider} | 69 * @return {!WebInspector.FlameChartDataProvider} |
70 */ | 70 */ |
71 createFlameChartDataProvider: function() | 71 createFlameChartDataProvider: function() |
72 { | 72 { |
73 return new WebInspector.CPUFlameChartDataProvider(this.profile, this._pr
ofileHeader.target()); | 73 return new WebInspector.CPUFlameChartDataProvider(this.profile, this._pr
ofileHeader.target()); |
74 }, | 74 }, |
75 | 75 |
76 __proto__: WebInspector.ProfileView.prototype | 76 __proto__: WebInspector.ProfileView.prototype |
77 } | 77 }; |
78 | 78 |
79 /** | 79 /** |
80 * @constructor | 80 * @constructor |
81 * @extends {WebInspector.ProfileType} | 81 * @extends {WebInspector.ProfileType} |
82 */ | 82 */ |
83 WebInspector.CPUProfileType = function() | 83 WebInspector.CPUProfileType = function() |
84 { | 84 { |
85 WebInspector.ProfileType.call(this, WebInspector.CPUProfileType.TypeId, WebI
nspector.UIString("Record JavaScript CPU Profile")); | 85 WebInspector.ProfileType.call(this, WebInspector.CPUProfileType.TypeId, WebI
nspector.UIString("Record JavaScript CPU Profile")); |
86 this._recording = false; | 86 this._recording = false; |
87 | 87 |
88 this._nextAnonymousConsoleProfileNumber = 1; | 88 this._nextAnonymousConsoleProfileNumber = 1; |
89 this._anonymousConsoleProfileIdToTitle = {}; | 89 this._anonymousConsoleProfileIdToTitle = {}; |
90 | 90 |
91 WebInspector.CPUProfileType.instance = this; | 91 WebInspector.CPUProfileType.instance = this; |
92 WebInspector.targetManager.addModelListener(WebInspector.CPUProfilerModel, W
ebInspector.CPUProfilerModel.Events.ConsoleProfileStarted, this._consoleProfileS
tarted, this); | 92 WebInspector.targetManager.addModelListener(WebInspector.CPUProfilerModel, W
ebInspector.CPUProfilerModel.Events.ConsoleProfileStarted, this._consoleProfileS
tarted, this); |
93 WebInspector.targetManager.addModelListener(WebInspector.CPUProfilerModel, W
ebInspector.CPUProfilerModel.Events.ConsoleProfileFinished, this._consoleProfile
Finished, this); | 93 WebInspector.targetManager.addModelListener(WebInspector.CPUProfilerModel, W
ebInspector.CPUProfilerModel.Events.ConsoleProfileFinished, this._consoleProfile
Finished, this); |
94 } | 94 }; |
95 | 95 |
96 WebInspector.CPUProfileType.TypeId = "CPU"; | 96 WebInspector.CPUProfileType.TypeId = "CPU"; |
97 | 97 |
98 WebInspector.CPUProfileType.prototype = { | 98 WebInspector.CPUProfileType.prototype = { |
99 /** | 99 /** |
100 * @override | 100 * @override |
101 * @return {string} | 101 * @return {string} |
102 */ | 102 */ |
103 typeName: function() | 103 typeName: function() |
104 { | 104 { |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 | 269 |
270 /** | 270 /** |
271 * @override | 271 * @override |
272 */ | 272 */ |
273 profileBeingRecordedRemoved: function() | 273 profileBeingRecordedRemoved: function() |
274 { | 274 { |
275 this.stopRecordingProfile(); | 275 this.stopRecordingProfile(); |
276 }, | 276 }, |
277 | 277 |
278 __proto__: WebInspector.ProfileType.prototype | 278 __proto__: WebInspector.ProfileType.prototype |
279 } | 279 }; |
280 | 280 |
281 /** | 281 /** |
282 * @constructor | 282 * @constructor |
283 * @extends {WebInspector.WritableProfileHeader} | 283 * @extends {WebInspector.WritableProfileHeader} |
284 * @param {?WebInspector.Target} target | 284 * @param {?WebInspector.Target} target |
285 * @param {!WebInspector.CPUProfileType} type | 285 * @param {!WebInspector.CPUProfileType} type |
286 * @param {string=} title | 286 * @param {string=} title |
287 */ | 287 */ |
288 WebInspector.CPUProfileHeader = function(target, type, title) | 288 WebInspector.CPUProfileHeader = function(target, type, title) |
289 { | 289 { |
290 WebInspector.WritableProfileHeader.call(this, target, type, title); | 290 WebInspector.WritableProfileHeader.call(this, target, type, title); |
291 } | 291 }; |
292 | 292 |
293 WebInspector.CPUProfileHeader.prototype = { | 293 WebInspector.CPUProfileHeader.prototype = { |
294 /** | 294 /** |
295 * @override | 295 * @override |
296 * @return {!WebInspector.ProfileView} | 296 * @return {!WebInspector.ProfileView} |
297 */ | 297 */ |
298 createView: function() | 298 createView: function() |
299 { | 299 { |
300 return new WebInspector.CPUProfileView(this); | 300 return new WebInspector.CPUProfileView(this); |
301 }, | 301 }, |
302 | 302 |
303 /** | 303 /** |
304 * @return {!ProfilerAgent.Profile} | 304 * @return {!ProfilerAgent.Profile} |
305 */ | 305 */ |
306 protocolProfile: function() | 306 protocolProfile: function() |
307 { | 307 { |
308 return this._protocolProfile; | 308 return this._protocolProfile; |
309 }, | 309 }, |
310 | 310 |
311 __proto__: WebInspector.WritableProfileHeader.prototype | 311 __proto__: WebInspector.WritableProfileHeader.prototype |
312 } | 312 }; |
313 | 313 |
314 /** | 314 /** |
315 * @implements {WebInspector.ProfileDataGridNode.Formatter} | 315 * @implements {WebInspector.ProfileDataGridNode.Formatter} |
316 * @constructor | 316 * @constructor |
317 */ | 317 */ |
318 WebInspector.CPUProfileView.NodeFormatter = function(profileView) | 318 WebInspector.CPUProfileView.NodeFormatter = function(profileView) |
319 { | 319 { |
320 this._profileView = profileView; | 320 this._profileView = profileView; |
321 } | 321 }; |
322 | 322 |
323 WebInspector.CPUProfileView.NodeFormatter.prototype = { | 323 WebInspector.CPUProfileView.NodeFormatter.prototype = { |
324 /** | 324 /** |
325 * @override | 325 * @override |
326 * @param {number} value | 326 * @param {number} value |
327 * @return {string} | 327 * @return {string} |
328 */ | 328 */ |
329 formatValue: function(value) | 329 formatValue: function(value) |
330 { | 330 { |
331 return WebInspector.UIString("%.1f\u2009ms", value); | 331 return WebInspector.UIString("%.1f\u2009ms", value); |
(...skipping 12 matching lines...) Expand all Loading... |
344 | 344 |
345 /** | 345 /** |
346 * @override | 346 * @override |
347 * @param {!WebInspector.ProfileDataGridNode} node | 347 * @param {!WebInspector.ProfileDataGridNode} node |
348 * @return {?Element} | 348 * @return {?Element} |
349 */ | 349 */ |
350 linkifyNode: function(node) | 350 linkifyNode: function(node) |
351 { | 351 { |
352 return this._profileView.linkifier().maybeLinkifyConsoleCallFrame(this._
profileView.target(), node.profileNode.callFrame, "profile-node-file"); | 352 return this._profileView.linkifier().maybeLinkifyConsoleCallFrame(this._
profileView.target(), node.profileNode.callFrame, "profile-node-file"); |
353 } | 353 } |
354 } | 354 }; |
355 | 355 |
356 /** | 356 /** |
357 * @constructor | 357 * @constructor |
358 * @extends {WebInspector.ProfileFlameChartDataProvider} | 358 * @extends {WebInspector.ProfileFlameChartDataProvider} |
359 * @param {!WebInspector.CPUProfileDataModel} cpuProfile | 359 * @param {!WebInspector.CPUProfileDataModel} cpuProfile |
360 * @param {?WebInspector.Target} target | 360 * @param {?WebInspector.Target} target |
361 */ | 361 */ |
362 WebInspector.CPUFlameChartDataProvider = function(cpuProfile, target) | 362 WebInspector.CPUFlameChartDataProvider = function(cpuProfile, target) |
363 { | 363 { |
364 WebInspector.ProfileFlameChartDataProvider.call(this, target); | 364 WebInspector.ProfileFlameChartDataProvider.call(this, target); |
365 this._cpuProfile = cpuProfile; | 365 this._cpuProfile = cpuProfile; |
366 } | 366 }; |
367 | 367 |
368 WebInspector.CPUFlameChartDataProvider.prototype = { | 368 WebInspector.CPUFlameChartDataProvider.prototype = { |
369 /** | 369 /** |
370 * @override | 370 * @override |
371 * @return {!WebInspector.FlameChart.TimelineData} | 371 * @return {!WebInspector.FlameChart.TimelineData} |
372 */ | 372 */ |
373 _calculateTimelineData: function() | 373 _calculateTimelineData: function() |
374 { | 374 { |
375 /** | 375 /** |
376 * @constructor | 376 * @constructor |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 linkifier.dispose(); | 491 linkifier.dispose(); |
492 pushEntryInfoRow(WebInspector.UIString("Aggregated self time"), Number.s
econdsToString(node.self / 1000, true)); | 492 pushEntryInfoRow(WebInspector.UIString("Aggregated self time"), Number.s
econdsToString(node.self / 1000, true)); |
493 pushEntryInfoRow(WebInspector.UIString("Aggregated total time"), Number.
secondsToString(node.total / 1000, true)); | 493 pushEntryInfoRow(WebInspector.UIString("Aggregated total time"), Number.
secondsToString(node.total / 1000, true)); |
494 if (node.deoptReason) | 494 if (node.deoptReason) |
495 pushEntryInfoRow(WebInspector.UIString("Not optimized"), node.deoptR
eason); | 495 pushEntryInfoRow(WebInspector.UIString("Not optimized"), node.deoptR
eason); |
496 | 496 |
497 return WebInspector.ProfileView.buildPopoverTable(entryInfo); | 497 return WebInspector.ProfileView.buildPopoverTable(entryInfo); |
498 }, | 498 }, |
499 | 499 |
500 __proto__: WebInspector.ProfileFlameChartDataProvider.prototype | 500 __proto__: WebInspector.ProfileFlameChartDataProvider.prototype |
501 } | 501 }; |
OLD | NEW |