| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 * @constructor | 6 * @constructor |
| 7 * @extends {WebInspector.VBox} | 7 * @extends {WebInspector.VBox} |
| 8 * @param {!WebInspector.TimelineModel} model | 8 * @param {!WebInspector.TimelineModel} model |
| 9 */ | 9 */ |
| 10 WebInspector.TimelineTreeView = function(model) | 10 WebInspector.TimelineTreeView = function(model) |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 * @param {number} endTime | 58 * @param {number} endTime |
| 59 */ | 59 */ |
| 60 setRange: function(startTime, endTime) | 60 setRange: function(startTime, endTime) |
| 61 { | 61 { |
| 62 this._startTime = startTime; | 62 this._startTime = startTime; |
| 63 this._endTime = endTime; | 63 this._endTime = endTime; |
| 64 this._refreshTree(); | 64 this._refreshTree(); |
| 65 }, | 65 }, |
| 66 | 66 |
| 67 /** | 67 /** |
| 68 * @return {boolean} |
| 69 */ |
| 70 _exposePercentages: function() |
| 71 { |
| 72 return false; |
| 73 }, |
| 74 |
| 75 /** |
| 68 * @param {!Element} parent | 76 * @param {!Element} parent |
| 69 */ | 77 */ |
| 70 _populateToolbar: function(parent) { }, | 78 _populateToolbar: function(parent) { }, |
| 71 | 79 |
| 72 /** | 80 /** |
| 73 * @param {!ConsoleAgent.CallFrame} frame | 81 * @param {!ConsoleAgent.CallFrame} frame |
| 74 * @return {!Element} | 82 * @return {!Element} |
| 75 */ | 83 */ |
| 76 linkifyLocation: function(frame) | 84 linkifyLocation: function(frame) |
| 77 { | 85 { |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 }, | 334 }, |
| 327 | 335 |
| 328 /** | 336 /** |
| 329 * @param {string} columnIdentifier | 337 * @param {string} columnIdentifier |
| 330 * @return {?Element} | 338 * @return {?Element} |
| 331 */ | 339 */ |
| 332 _createValueCell: function(columnIdentifier) | 340 _createValueCell: function(columnIdentifier) |
| 333 { | 341 { |
| 334 if (columnIdentifier !== "self" && columnIdentifier !== "total" && colum
nIdentifier !== "startTime") | 342 if (columnIdentifier !== "self" && columnIdentifier !== "total" && colum
nIdentifier !== "startTime") |
| 335 return null; | 343 return null; |
| 336 /** | |
| 337 * @param {number} time | |
| 338 * @return {string} | |
| 339 */ | |
| 340 function formatMilliseconds(time) | |
| 341 { | |
| 342 return WebInspector.UIString("%.1f\u2009ms", time); | |
| 343 } | |
| 344 /** | |
| 345 * @param {number} value | |
| 346 * @return {string} | |
| 347 */ | |
| 348 function formatPercent(value) | |
| 349 { | |
| 350 return WebInspector.UIString("%.1f\u2009%%", value); | |
| 351 } | |
| 352 | 344 |
| 345 var showPercents = false; |
| 353 var value; | 346 var value; |
| 354 var percentText; | |
| 355 var maxTime; | 347 var maxTime; |
| 356 switch (columnIdentifier) { | 348 switch (columnIdentifier) { |
| 357 case "startTime": | 349 case "startTime": |
| 358 value = this._profileNode.event.startTime - this._treeView._model.mi
nimumRecordTime(); | 350 value = this._profileNode.event.startTime - this._treeView._model.mi
nimumRecordTime(); |
| 359 break; | 351 break; |
| 360 case "self": | 352 case "self": |
| 361 value = this._profileNode.selfTime; | 353 value = this._profileNode.selfTime; |
| 362 percentText = formatPercent(this._profileNode.selfTime / this._grand
TotalTime * 100); | |
| 363 maxTime = this._maxSelfTime; | 354 maxTime = this._maxSelfTime; |
| 355 showPercents = true; |
| 364 break; | 356 break; |
| 365 case "total": | 357 case "total": |
| 366 value = this._profileNode.totalTime; | 358 value = this._profileNode.totalTime; |
| 367 percentText = formatPercent(this._profileNode.totalTime / this._gran
dTotalTime * 100); | |
| 368 maxTime = this._maxTotalTime; | 359 maxTime = this._maxTotalTime; |
| 360 showPercents = true; |
| 369 break; | 361 break; |
| 370 default: | 362 default: |
| 371 return null; | 363 return null; |
| 372 } | 364 } |
| 373 var cell = this.createTD(columnIdentifier); | 365 var cell = this.createTD(columnIdentifier); |
| 374 cell.className = "numeric-column"; | 366 cell.className = "numeric-column"; |
| 375 var textDiv = cell.createChild("div"); | 367 var textDiv = cell.createChild("div"); |
| 376 textDiv.createChild("span").textContent = formatMilliseconds(value); | 368 textDiv.createChild("span").textContent = WebInspector.UIString("%.1f\u2
009ms", value); |
| 377 if (percentText) { | 369 |
| 378 textDiv.createChild("span", "percent-column").textContent = percentT
ext; | 370 if (showPercents && this._treeView._exposePercentages()) |
| 379 textDiv.classList.add("profile-multiple-values"); | 371 textDiv.createChild("span", "percent-column").textContent = WebInspe
ctor.UIString("%.1f\u2009%%", value / this._grandTotalTime * 100); |
| 372 if (maxTime) { |
| 373 textDiv.classList.add("background-percent-bar"); |
| 374 cell.createChild("div", "background-bar-container").createChild("div
", "background-bar").style.width = (value * 100 / maxTime).toFixed(1) + "%"; |
| 380 } | 375 } |
| 381 if (maxTime) | |
| 382 cell.createChild("div", "background-bar-container").createChild("div
", "background-bar").style.width = (value * 100 / maxTime).toFixed(1) + "%"; | |
| 383 return cell; | 376 return cell; |
| 384 }, | 377 }, |
| 385 | 378 |
| 386 /** | 379 /** |
| 387 * @override | 380 * @override |
| 388 */ | 381 */ |
| 389 populate: function() | 382 populate: function() |
| 390 { | 383 { |
| 391 if (this._populated) | 384 if (this._populated) |
| 392 return; | 385 return; |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 this._groupByCombobox.select(option); | 458 this._groupByCombobox.select(option); |
| 466 } | 459 } |
| 467 addGroupingOption.call(this, WebInspector.UIString("No Grouping"), WebIn
spector.AggregatedTimelineTreeView.GroupBy.None); | 460 addGroupingOption.call(this, WebInspector.UIString("No Grouping"), WebIn
spector.AggregatedTimelineTreeView.GroupBy.None); |
| 468 addGroupingOption.call(this, WebInspector.UIString("Group by Category"),
WebInspector.AggregatedTimelineTreeView.GroupBy.Category); | 461 addGroupingOption.call(this, WebInspector.UIString("Group by Category"),
WebInspector.AggregatedTimelineTreeView.GroupBy.Category); |
| 469 addGroupingOption.call(this, WebInspector.UIString("Group by Domain"), W
ebInspector.AggregatedTimelineTreeView.GroupBy.Domain); | 462 addGroupingOption.call(this, WebInspector.UIString("Group by Domain"), W
ebInspector.AggregatedTimelineTreeView.GroupBy.Domain); |
| 470 addGroupingOption.call(this, WebInspector.UIString("Group by Subdomain")
, WebInspector.AggregatedTimelineTreeView.GroupBy.Subdomain); | 463 addGroupingOption.call(this, WebInspector.UIString("Group by Subdomain")
, WebInspector.AggregatedTimelineTreeView.GroupBy.Subdomain); |
| 471 addGroupingOption.call(this, WebInspector.UIString("Group by URL"), WebI
nspector.AggregatedTimelineTreeView.GroupBy.URL); | 464 addGroupingOption.call(this, WebInspector.UIString("Group by URL"), WebI
nspector.AggregatedTimelineTreeView.GroupBy.URL); |
| 472 panelToolbar.appendToolbarItem(this._groupByCombobox); | 465 panelToolbar.appendToolbarItem(this._groupByCombobox); |
| 473 }, | 466 }, |
| 474 | 467 |
| 468 /** |
| 469 * @override |
| 470 * @return {boolean} |
| 471 */ |
| 472 _exposePercentages: function() |
| 473 { |
| 474 return true; |
| 475 }, |
| 476 |
| 475 _onGroupByChanged: function() | 477 _onGroupByChanged: function() |
| 476 { | 478 { |
| 477 this._groupBySetting.set(this._groupByCombobox.selectedOption().value); | 479 this._groupBySetting.set(this._groupByCombobox.selectedOption().value); |
| 478 this._refreshTree(); | 480 this._refreshTree(); |
| 479 }, | 481 }, |
| 480 | 482 |
| 481 /** | 483 /** |
| 482 * @param {function(!WebInspector.TimelineModel.ProfileTreeNode):string} nod
eToGroupId | 484 * @param {function(!WebInspector.TimelineModel.ProfileTreeNode):string} nod
eToGroupId |
| 483 * @param {!WebInspector.TimelineModel.ProfileTreeNode} node | 485 * @param {!WebInspector.TimelineModel.ProfileTreeNode} node |
| 484 * @return {!WebInspector.TimelineModel.ProfileTreeNode} | 486 * @return {!WebInspector.TimelineModel.ProfileTreeNode} |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 794 * @this {WebInspector.EventsTimelineTreeView} | 796 * @this {WebInspector.EventsTimelineTreeView} |
| 795 */ | 797 */ |
| 796 function showDetails(fragment) | 798 function showDetails(fragment) |
| 797 { | 799 { |
| 798 this._detailsView.element.appendChild(fragment); | 800 this._detailsView.element.appendChild(fragment); |
| 799 } | 801 } |
| 800 }, | 802 }, |
| 801 | 803 |
| 802 __proto__: WebInspector.TimelineTreeView.prototype | 804 __proto__: WebInspector.TimelineTreeView.prototype |
| 803 } | 805 } |
| OLD | NEW |