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

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

Issue 363263002: DevTools: Timeline: show correct information in cpu bar popover (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 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%)"), 175 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%)"),
176 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%)"), 176 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%)"),
177 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%)"), 177 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%)"),
178 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%)") 178 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%)")
179 }; 179 };
180 return WebInspector.TimelineUIUtils._categories; 180 return WebInspector.TimelineUIUtils._categories;
181 }; 181 };
182 182
183 /** 183 /**
184 * @param {!WebInspector.TimelineModel} model 184 * @param {!WebInspector.TimelineModel} model
185 * @param {!{name: string, tasks: !Array.<!{startTime: number, endTime: number}> , firstTaskIndex: number, lastTaskIndex: number}} info 185 * @param {!{name: string, tasks: !Array.<!WebInspector.TimelineModel.Record>, f irstTaskIndex: number, lastTaskIndex: number}} info
186 * @return {!Element} 186 * @return {!Element}
187 */ 187 */
188 WebInspector.TimelineUIUtils.generateMainThreadBarPopupContent = function(model, info) 188 WebInspector.TimelineUIUtils.generateMainThreadBarPopupContent = function(model, info)
189 { 189 {
190 var firstTaskIndex = info.firstTaskIndex; 190 var firstTaskIndex = info.firstTaskIndex;
191 var lastTaskIndex = info.lastTaskIndex; 191 var lastTaskIndex = info.lastTaskIndex;
192 var tasks = info.tasks; 192 var tasks = info.tasks;
193 var messageCount = lastTaskIndex - firstTaskIndex + 1; 193 var messageCount = lastTaskIndex - firstTaskIndex + 1;
194 var cpuTime = 0; 194 var cpuTime = 0;
195 195
196 for (var i = firstTaskIndex; i <= lastTaskIndex; ++i) { 196 for (var i = firstTaskIndex; i <= lastTaskIndex; ++i) {
197 var task = tasks[i]; 197 var task = tasks[i];
198 cpuTime += task.endTime - task.startTime; 198 cpuTime += task.endTime() - task.startTime();
199 } 199 }
200 var startTime = tasks[firstTaskIndex].startTime; 200 var startTime = tasks[firstTaskIndex].startTime();
201 var endTime = tasks[lastTaskIndex].endTime; 201 var endTime = tasks[lastTaskIndex].endTime();
202 var duration = endTime - startTime; 202 var duration = endTime - startTime;
203 203
204 var contentHelper = new WebInspector.TimelinePopupContentHelper(info.name); 204 var contentHelper = new WebInspector.TimelinePopupContentHelper(info.name);
205 var durationText = WebInspector.UIString("%s (at %s)", Number.millisToString (duration, true), 205 var durationText = WebInspector.UIString("%s (at %s)", Number.millisToString (duration, true),
206 Number.millisToString(startTime - model.minimumRecordTime(), true)); 206 Number.millisToString(startTime - model.minimumRecordTime(), true));
207 contentHelper.appendTextRow(WebInspector.UIString("Duration"), durationText) ; 207 contentHelper.appendTextRow(WebInspector.UIString("Duration"), durationText) ;
208 contentHelper.appendTextRow(WebInspector.UIString("CPU time"), Number.millis ToString(cpuTime, true)); 208 contentHelper.appendTextRow(WebInspector.UIString("CPU time"), Number.millis ToString(cpuTime, true));
209 contentHelper.appendTextRow(WebInspector.UIString("Message Count"), messageC ount); 209 contentHelper.appendTextRow(WebInspector.UIString("Message Count"), messageC ount);
210 return contentHelper.contentTable(); 210 return contentHelper.contentTable();
211 } 211 }
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 for (var i = 0; i < stackTrace.length; ++i) { 562 for (var i = 0; i < stackTrace.length; ++i) {
563 var stackFrame = stackTrace[i]; 563 var stackFrame = stackTrace[i];
564 var row = stackTraceElement.createChild("div"); 564 var row = stackTraceElement.createChild("div");
565 row.createTextChild(stackFrame.functionName || WebInspector.UIString ("(anonymous function)")); 565 row.createTextChild(stackFrame.functionName || WebInspector.UIString ("(anonymous function)"));
566 row.createTextChild(" @ "); 566 row.createTextChild(" @ ");
567 var urlElement = this._linkifier.linkifyLocation(this._target, stack Frame.url, stackFrame.lineNumber - 1); 567 var urlElement = this._linkifier.linkifyLocation(this._target, stack Frame.url, stackFrame.lineNumber - 1);
568 row.appendChild(urlElement); 568 row.appendChild(urlElement);
569 } 569 }
570 } 570 }
571 } 571 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698