| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 | 441 |
| 442 if (entryIndex === -1 || this._timelineData.entries[entryIndex].node.scr
iptId === "0") | 442 if (entryIndex === -1 || this._timelineData.entries[entryIndex].node.scr
iptId === "0") |
| 443 this._canvas.style.cursor = "default"; | 443 this._canvas.style.cursor = "default"; |
| 444 else | 444 else |
| 445 this._canvas.style.cursor = "pointer"; | 445 this._canvas.style.cursor = "pointer"; |
| 446 | 446 |
| 447 this._highlightedEntryIndex = entryIndex; | 447 this._highlightedEntryIndex = entryIndex; |
| 448 this._scheduleUpdate(); | 448 this._scheduleUpdate(); |
| 449 }, | 449 }, |
| 450 | 450 |
| 451 _millisecondsToString: function(ms) |
| 452 { |
| 453 if (ms === 0) |
| 454 return "0"; |
| 455 if (ms < 1000) |
| 456 return WebInspector.UIString("%.1f\u2009ms", ms); |
| 457 return Number.secondsToString(ms / 1000, true); |
| 458 }, |
| 459 |
| 451 _prepareHighlightedEntryInfo: function() | 460 _prepareHighlightedEntryInfo: function() |
| 452 { | 461 { |
| 453 if (this._isDragging) | 462 if (this._isDragging) |
| 454 return null; | 463 return null; |
| 455 var entry = this._timelineData.entries[this._highlightedEntryIndex]; | 464 var entry = this._timelineData.entries[this._highlightedEntryIndex]; |
| 456 if (!entry) | 465 if (!entry) |
| 457 return null; | 466 return null; |
| 458 var node = entry.node; | 467 var node = entry.node; |
| 459 if (!node) | 468 if (!node) |
| 460 return null; | 469 return null; |
| 461 | 470 |
| 462 var entryInfo = []; | 471 var entryInfo = []; |
| 463 function pushEntryInfoRow(title, text) | 472 function pushEntryInfoRow(title, text) |
| 464 { | 473 { |
| 465 var row = {}; | 474 var row = {}; |
| 466 row.title = title; | 475 row.title = title; |
| 467 row.text = text; | 476 row.text = text; |
| 468 entryInfo.push(row); | 477 entryInfo.push(row); |
| 469 } | 478 } |
| 470 | 479 |
| 471 pushEntryInfoRow(WebInspector.UIString("Name"), node.functionName); | 480 pushEntryInfoRow(WebInspector.UIString("Name"), node.functionName); |
| 472 if (this._cpuProfileView.samples) { | 481 if (this._cpuProfileView.samples) { |
| 473 pushEntryInfoRow(WebInspector.UIString("Self time"), Number.secondsT
oString(entry.selfTime / 1000, true)); | 482 var rate = this._cpuProfileView.samplesPerMs; |
| 474 pushEntryInfoRow(WebInspector.UIString("Total time"), Number.seconds
ToString(entry.duration / 1000, true)); | 483 var selfTime = this._millisecondsToString(entry.selfTime / rate); |
| 484 var totalTime = this._millisecondsToString(entry.duration / rate); |
| 485 pushEntryInfoRow(WebInspector.UIString("Self time"), selfTime); |
| 486 pushEntryInfoRow(WebInspector.UIString("Total time"), totalTime); |
| 475 } | 487 } |
| 476 if (node.url) | 488 if (node.url) |
| 477 pushEntryInfoRow(WebInspector.UIString("URL"), node.url + ":" + node
.lineNumber); | 489 pushEntryInfoRow(WebInspector.UIString("URL"), node.url + ":" + node
.lineNumber); |
| 478 pushEntryInfoRow(WebInspector.UIString("Aggregated self time"), Number.s
econdsToString(node.selfTime / 1000, true)); | 490 pushEntryInfoRow(WebInspector.UIString("Aggregated self time"), Number.s
econdsToString(node.selfTime / 1000, true)); |
| 479 pushEntryInfoRow(WebInspector.UIString("Aggregated total time"), Number.
secondsToString(node.totalTime / 1000, true)); | 491 pushEntryInfoRow(WebInspector.UIString("Aggregated total time"), Number.
secondsToString(node.totalTime / 1000, true)); |
| 480 return entryInfo; | 492 return entryInfo; |
| 481 }, | 493 }, |
| 482 | 494 |
| 483 _onClick: function(e) | 495 _onClick: function(e) |
| 484 { | 496 { |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 794 this._timelineGrid.updateDividers(this._calculator); | 806 this._timelineGrid.updateDividers(this._calculator); |
| 795 this._overviewGrid.updateDividers(this._overviewCalculator); | 807 this._overviewGrid.updateDividers(this._overviewCalculator); |
| 796 if (this._updateOverviewCanvas) { | 808 if (this._updateOverviewCanvas) { |
| 797 this._drawOverviewCanvas(this._overviewContainer.clientWidth, this._
overviewContainer.clientHeight - 20); | 809 this._drawOverviewCanvas(this._overviewContainer.clientWidth, this._
overviewContainer.clientHeight - 20); |
| 798 this._updateOverviewCanvas = false; | 810 this._updateOverviewCanvas = false; |
| 799 } | 811 } |
| 800 }, | 812 }, |
| 801 | 813 |
| 802 __proto__: WebInspector.View.prototype | 814 __proto__: WebInspector.View.prototype |
| 803 }; | 815 }; |
| OLD | NEW |