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

Side by Side Diff: Source/devtools/front_end/TimelineUIUtils.js

Issue 220963002: DevTools: Add energy value under Timeline pie chart (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 8 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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * Copyright (C) 2012 Intel Inc. All rights reserved. 3 * Copyright (C) 2012 Intel Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 25 matching lines...) Expand all
36 WebInspector.TimelineUIUtils.categories = function() 36 WebInspector.TimelineUIUtils.categories = function()
37 { 37 {
38 if (WebInspector.TimelineUIUtils._categories) 38 if (WebInspector.TimelineUIUtils._categories)
39 return WebInspector.TimelineUIUtils._categories; 39 return WebInspector.TimelineUIUtils._categories;
40 WebInspector.TimelineUIUtils._categories = { 40 WebInspector.TimelineUIUtils._categories = {
41 loading: new WebInspector.TimelineCategory("loading", WebInspector.UIStr ing("Loading"), 0, "hsl(214, 53%, 58%)", "hsl(214, 67%, 90%)", "hsl(214, 67%, 74 %)", "hsl(214, 67%, 66%)"), 41 loading: new WebInspector.TimelineCategory("loading", WebInspector.UIStr ing("Loading"), 0, "hsl(214, 53%, 58%)", "hsl(214, 67%, 90%)", "hsl(214, 67%, 74 %)", "hsl(214, 67%, 66%)"),
42 scripting: new WebInspector.TimelineCategory("scripting", WebInspector.U IString("Scripting"), 1, "hsl(43, 68%, 53%)", "hsl(43, 83%, 90%)", "hsl(43, 83%, 72%)", "hsl(43, 83%, 64%) "), 42 scripting: new WebInspector.TimelineCategory("scripting", WebInspector.U IString("Scripting"), 1, "hsl(43, 68%, 53%)", "hsl(43, 83%, 90%)", "hsl(43, 83%, 72%)", "hsl(43, 83%, 64%) "),
43 rendering: new WebInspector.TimelineCategory("rendering", WebInspector.U IString("Rendering"), 2, "hsl(256, 50%, 60%)", "hsl(256, 67%, 90%)", "hsl(256, 6 7%, 76%)", "hsl(256, 67%, 70%)"), 43 rendering: new WebInspector.TimelineCategory("rendering", WebInspector.U IString("Rendering"), 2, "hsl(256, 50%, 60%)", "hsl(256, 67%, 90%)", "hsl(256, 6 7%, 76%)", "hsl(256, 67%, 70%)"),
44 painting: new WebInspector.TimelineCategory("painting", WebInspector.UIS tring("Painting"), 2, "hsl(109, 33%, 47%)", "hsl(109, 33%, 90%)", "hsl(109, 33%, 64%)", "hsl(109, 33%, 55%)"), 44 painting: new WebInspector.TimelineCategory("painting", WebInspector.UIS tring("Painting"), 2, "hsl(109, 33%, 47%)", "hsl(109, 33%, 90%)", "hsl(109, 33%, 64%)", "hsl(109, 33%, 55%)"),
45 other: new WebInspector.TimelineCategory("other", WebInspector.UIString( "Other"), -1, "hsl(0, 0%, 73%)", "hsl(0, 0%, 90%)", "hsl(0, 0%, 87%)", "hsl(0, 0 %, 79%)"), 45 other: new WebInspector.TimelineCategory("other", WebInspector.UIString( "Other"), -1, "hsl(0, 0%, 73%)", "hsl(0, 0%, 90%)", "hsl(0, 0%, 87%)", "hsl(0, 0 %, 79%)"),
46 idle: new WebInspector.TimelineCategory("idle", WebInspector.UIString("I dle"), -1, "hsl(0, 0%, 87%)", "hsl(0, 100%, 100%)", "hsl(0, 100%, 100%)", "hsl(0 , 100%, 100%)") 46 idle: new WebInspector.TimelineCategory("idle", WebInspector.UIString("I dle"), -1, "hsl(0, 0%, 87%)", "hsl(0, 100%, 100%)", "hsl(0, 100%, 100%)", "hsl(0 , 100%, 100%)"),
47 power: new WebInspector.TimelineCategory("power", WebInspector.UIString( "Power"), -1, "hsl(16, 100%, 50%)", "hsl(16, 100%, 70%)", "hsl(16, 100%, 60%)", "hsl(16, 100%, 60%)")
47 }; 48 };
48 return WebInspector.TimelineUIUtils._categories; 49 return WebInspector.TimelineUIUtils._categories;
49 }; 50 };
50 51
51 /** 52 /**
52 * @return {!Object.<string, !{title: string, category: !WebInspector.TimelineCa tegory}>} 53 * @return {!Object.<string, !{title: string, category: !WebInspector.TimelineCa tegory}>}
53 */ 54 */
54 WebInspector.TimelineUIUtils._initRecordStyles = function() 55 WebInspector.TimelineUIUtils._initRecordStyles = function()
55 { 56 {
56 if (WebInspector.TimelineUIUtils._recordStylesMap) 57 if (WebInspector.TimelineUIUtils._recordStylesMap)
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 text.textContent = Number.millisToString(aggregatedStats[index], true); 289 text.textContent = Number.millisToString(aggregatedStats[index], true);
289 cell.appendChild(text); 290 cell.appendChild(text);
290 } 291 }
291 return cell; 292 return cell;
292 } 293 }
293 294
294 /** 295 /**
295 * @param {!Object} aggregatedStats 296 * @param {!Object} aggregatedStats
296 * @param {!WebInspector.TimelineCategory=} selfCategory 297 * @param {!WebInspector.TimelineCategory=} selfCategory
297 * @param {number=} selfTime 298 * @param {number=} selfTime
299 * @param {number=} energy
298 * @return {!Element} 300 * @return {!Element}
299 */ 301 */
300 WebInspector.TimelineUIUtils.generatePieChart = function(aggregatedStats, selfCa tegory, selfTime) 302 WebInspector.TimelineUIUtils.generatePieChart = function(aggregatedStats, selfCa tegory, selfTime, energy)
pfeldman 2014/04/11 12:17:49 I don't think energy fits here well - it used to b
301 { 303 {
302 var element = document.createElement("div"); 304 var element = document.createElement("div");
303 element.className = "timeline-aggregated-info"; 305 element.className = "timeline-aggregated-info";
304 306
305 var total = 0; 307 var total = 0;
306 for (var categoryName in aggregatedStats) 308 for (var categoryName in aggregatedStats)
307 total += aggregatedStats[categoryName]; 309 total += aggregatedStats[categoryName];
308 310
309 function formatter(value) 311 function formatter(value)
310 { 312 {
(...skipping 28 matching lines...) Expand all
339 if (category === selfCategory) 341 if (category === selfCategory)
340 continue; 342 continue;
341 var value = aggregatedStats[category.name]; 343 var value = aggregatedStats[category.name];
342 if (!value) 344 if (!value)
343 continue; 345 continue;
344 pieChart.addSlice(value, category.fillColorStop0); 346 pieChart.addSlice(value, category.fillColorStop0);
345 var rowElement = footerElement.createChild("div"); 347 var rowElement = footerElement.createChild("div");
346 rowElement.createChild("div", "timeline-aggregated-category timeline-" + category.name); 348 rowElement.createChild("div", "timeline-aggregated-category timeline-" + category.name);
347 rowElement.createTextChild(WebInspector.UIString("%s %s", formatter(val ue), category.title)); 349 rowElement.createTextChild(WebInspector.UIString("%s %s", formatter(val ue), category.title));
348 } 350 }
351
352 if (energy) {
353 var rowElement = footerElement.createChild("div");
354 rowElement.createChild("div", "timeline-aggregated-category timeline-pow er");
355 rowElement.createTextChild(WebInspector.UIString("Energy: %.2f Joules", energy));
356 }
349 return element; 357 return element;
350 } 358 }
351 359
352 WebInspector.TimelineUIUtils.generatePopupContentForFrame = function(frame) 360 WebInspector.TimelineUIUtils.generatePopupContentForFrame = function(frame)
353 { 361 {
354 var contentHelper = new WebInspector.TimelinePopupContentHelper(WebInspector .UIString("Frame")); 362 var contentHelper = new WebInspector.TimelinePopupContentHelper(WebInspector .UIString("Frame"));
355 var durationInMillis = frame.endTime - frame.startTime; 363 var durationInMillis = frame.endTime - frame.startTime;
356 var durationText = WebInspector.UIString("%s (at %s)", Number.millisToString (frame.endTime - frame.startTime, true), 364 var durationText = WebInspector.UIString("%s (at %s)", Number.millisToString (frame.endTime - frame.startTime, true),
357 Number.millisToString(frame.startTimeOffset, true)); 365 Number.millisToString(frame.startTimeOffset, true));
358 contentHelper.appendTextRow(WebInspector.UIString("Duration"), durationText) ; 366 contentHelper.appendTextRow(WebInspector.UIString("Duration"), durationText) ;
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after
978 for (var i = 0; i < stackTrace.length; ++i) { 986 for (var i = 0; i < stackTrace.length; ++i) {
979 var stackFrame = stackTrace[i]; 987 var stackFrame = stackTrace[i];
980 var row = stackTraceElement.createChild("div"); 988 var row = stackTraceElement.createChild("div");
981 row.createTextChild(stackFrame.functionName || WebInspector.UIString ("(anonymous function)")); 989 row.createTextChild(stackFrame.functionName || WebInspector.UIString ("(anonymous function)"));
982 row.createTextChild(" @ "); 990 row.createTextChild(" @ ");
983 var urlElement = this._linkifier.linkifyLocation(this._target, stack Frame.url, stackFrame.lineNumber - 1); 991 var urlElement = this._linkifier.linkifyLocation(this._target, stack Frame.url, stackFrame.lineNumber - 1);
984 row.appendChild(urlElement); 992 row.appendChild(urlElement);
985 } 993 }
986 } 994 }
987 } 995 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698