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

Unified Diff: chrome/browser/resources/gpu_internals/timeline_model.js

Issue 7495036: about:gpu support for thread name metadata. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Prune empty threads. Increase heading width. Created 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/gpu_internals/timeline_model.js
diff --git a/chrome/browser/resources/gpu_internals/timeline_model.js b/chrome/browser/resources/gpu_internals/timeline_model.js
index 1739e3c195685dc44f5c6434c218a9145a2c5774..24fa67b7fe2ce06b4c747700d91cca7d92f9c6ef 100644
--- a/chrome/browser/resources/gpu_internals/timeline_model.js
+++ b/chrome/browser/resources/gpu_internals/timeline_model.js
@@ -65,6 +65,8 @@ cr.define('gpu', function() {
}
TimelineThread.prototype = {
+ name: undefined,
+
getSubrow: function(i) {
while (i >= this.subRows.length)
this.subRows.push([]);
@@ -229,12 +231,19 @@ cr.define('gpu', function() {
} else if (event.ph == 'I') {
// TODO(nduca): Implement parsing of immediate events.
console.log('Parsing of I-type events not implemented.');
+ } else if (event.ph == 'M') {
+ if (event.name == 'thread_name') {
+ var thread = this.getProcess(event.pid).getThread(event.tid);
+ thread.name = event.args.name;
+ } else {
+ console.log('Unrecognized metadata name: ' + event.name);
+ }
} else {
- throw new Error('Unrecognized event phase: ' + event.ph +
+ console.log('Unrecognized event phase: ' + event.ph +
'(' + event.name + ')');
}
}
-
+ this.pruneEmptyThreads();
this.updateBounds();
// Add end events for any events that are still on the stack. These
@@ -268,6 +277,19 @@ cr.define('gpu', function() {
this.maxTimestamp = this.maxTimestamp + boost;
},
+ pruneEmptyThreads: function() {
+ for (var pid in this.processes) {
+ var process = this.processes[pid];
+ var prunedThreads = [];
+ for (var tid in process.threads) {
+ var thread = process.threads[tid];
+ if (thread.subRows[0].length)
+ prunedThreads.push(thread);
+ }
+ process.threads = prunedThreads;
+ }
+ },
+
updateBounds: function() {
var wmin = Infinity;
var wmax = -wmin;
@@ -275,7 +297,8 @@ cr.define('gpu', function() {
for (var tI = 0; tI < threads.length; tI++) {
var thread = threads[tI];
thread.updateBounds();
- if (thread.minTimestamp && thread.maxTimestamp) {
+ if (thread.minTimestamp != undefined &&
+ thread.maxTimestamp != undefined) {
wmin = Math.min(wmin, thread.minTimestamp);
wmax = Math.max(wmax, thread.maxTimestamp);
}

Powered by Google App Engine
This is Rietveld 408576698