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

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: Add to Pie Chart 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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 text.textContent = Number.millisToString(aggregatedStats[index], true); 288 text.textContent = Number.millisToString(aggregatedStats[index], true);
289 cell.appendChild(text); 289 cell.appendChild(text);
290 } 290 }
291 return cell; 291 return cell;
292 } 292 }
293 293
294 /** 294 /**
295 * @param {!Object} aggregatedStats 295 * @param {!Object} aggregatedStats
296 * @param {!WebInspector.TimelineCategory=} selfCategory 296 * @param {!WebInspector.TimelineCategory=} selfCategory
297 * @param {number=} selfTime 297 * @param {number=} selfTime
298 * @param {number=} energy
298 * @return {!Element} 299 * @return {!Element}
299 */ 300 */
300 WebInspector.TimelineUIUtils.generatePieChart = function(aggregatedStats, selfCa tegory, selfTime) 301 WebInspector.TimelineUIUtils.generatePieChart = function(aggregatedStats, selfCa tegory, selfTime, energy)
301 { 302 {
302 var element = document.createElement("div"); 303 var element = document.createElement("div");
303 element.className = "timeline-aggregated-info"; 304 element.className = "timeline-aggregated-info";
304 305
305 var total = 0; 306 var total = 0;
306 for (var categoryName in aggregatedStats) 307 for (var categoryName in aggregatedStats)
307 total += aggregatedStats[categoryName]; 308 total += aggregatedStats[categoryName];
308 309
309 function formatter(value) 310 function formatter(value)
310 { 311 {
(...skipping 28 matching lines...) Expand all
339 if (category === selfCategory) 340 if (category === selfCategory)
340 continue; 341 continue;
341 var value = aggregatedStats[category.name]; 342 var value = aggregatedStats[category.name];
342 if (!value) 343 if (!value)
343 continue; 344 continue;
344 pieChart.addSlice(value, category.fillColorStop0); 345 pieChart.addSlice(value, category.fillColorStop0);
345 var rowElement = footerElement.createChild("div"); 346 var rowElement = footerElement.createChild("div");
346 rowElement.createChild("div", "timeline-aggregated-category timeline-" + category.name); 347 rowElement.createChild("div", "timeline-aggregated-category timeline-" + category.name);
347 rowElement.createTextChild(WebInspector.UIString("%s %s", formatter(val ue), category.title)); 348 rowElement.createTextChild(WebInspector.UIString("%s %s", formatter(val ue), category.title));
348 } 349 }
350
351 if (energy) {
352 var rowElement = footerElement.createChild("div");
353 rowElement.createChild("div", "timeline-aggregated-category timeline-" + "power");
alph 2014/04/09 16:02:27 what does this div do? Is it empty?
354 rowElement.createTextChild(WebInspector.UIString("%0.2f joules %s", ener gy, "Energy"));
alph 2014/04/09 16:02:27 %.2f Why not just put "Energy" inside the UIStrin
355 }
349 return element; 356 return element;
350 } 357 }
351 358
352 WebInspector.TimelineUIUtils.generatePopupContentForFrame = function(frame) 359 WebInspector.TimelineUIUtils.generatePopupContentForFrame = function(frame)
353 { 360 {
354 var contentHelper = new WebInspector.TimelinePopupContentHelper(WebInspector .UIString("Frame")); 361 var contentHelper = new WebInspector.TimelinePopupContentHelper(WebInspector .UIString("Frame"));
355 var durationInMillis = frame.endTime - frame.startTime; 362 var durationInMillis = frame.endTime - frame.startTime;
356 var durationText = WebInspector.UIString("%s (at %s)", Number.millisToString (frame.endTime - frame.startTime, true), 363 var durationText = WebInspector.UIString("%s (at %s)", Number.millisToString (frame.endTime - frame.startTime, true),
357 Number.millisToString(frame.startTimeOffset, true)); 364 Number.millisToString(frame.startTimeOffset, true));
358 contentHelper.appendTextRow(WebInspector.UIString("Duration"), durationText) ; 365 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) { 985 for (var i = 0; i < stackTrace.length; ++i) {
979 var stackFrame = stackTrace[i]; 986 var stackFrame = stackTrace[i];
980 var row = stackTraceElement.createChild("div"); 987 var row = stackTraceElement.createChild("div");
981 row.createTextChild(stackFrame.functionName || WebInspector.UIString ("(anonymous function)")); 988 row.createTextChild(stackFrame.functionName || WebInspector.UIString ("(anonymous function)"));
982 row.createTextChild(" @ "); 989 row.createTextChild(" @ ");
983 var urlElement = this._linkifier.linkifyLocation(this._target, stack Frame.url, stackFrame.lineNumber - 1); 990 var urlElement = this._linkifier.linkifyLocation(this._target, stack Frame.url, stackFrame.lineNumber - 1);
984 row.appendChild(urlElement); 991 row.appendChild(urlElement);
985 } 992 }
986 } 993 }
987 } 994 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698