chromium-trace: support D|W task state
Change-Id: Iab459a855c8b6ecb94f0fb0a70e50861572704d9
diff --git a/script.js b/script.js
index 9603d78..12130a2 100644
--- a/script.js
+++ b/script.js
@@ -52,22 +52,23 @@
{};this.model_.getAllThreads().forEach(function(b){this.threadsByLinuxPid[b.tid]=b}.bind(this))},getOrCreateCpuState:function(b){if(!this.cpuStates_[b]){var a=this.model_.getOrCreateCpu(b);this.cpuStates_[b]=new f(a)}return this.cpuStates_[b]},parsePid:function(b){b=/.+-(\d+)/.exec(b)[1];return b=parseInt(b)},parseThreadName:function(b){return/(.+)-\d+/.exec(b)[1]},getOrCreateKernelThread:function(b,a,d){this.kernelThreadStates_[b]||(void 0==a&&(a=this.parsePid(b)),void 0==d&&(d=a),d=this.model_.getOrCreateProcess(a).getOrCreateThread(d),
d.name=b,this.kernelThreadStates_[b]={pid:a,thread:d,openSlice:void 0,openSliceTS:void 0},this.threadsByLinuxPid[a]=d);return this.kernelThreadStates_[b]},importEvents:function(){this.importCpuData();this.alignClocks()&&this.buildPerThreadCpuSlicesFromCpuState()},finalizeImport:function(){},buildPerThreadCpuSlicesFromCpuState:function(){for(var b in this.cpuStates_)for(var a=this.cpuStates_[b].cpu,d=0;d<a.slices.length;d++){var e=a.slices[d],c=this.threadsByLinuxPid[e.args.tid];c&&(c.tempCpuSlices||
(c.tempCpuSlices=[]),e.index=d,c.tempCpuSlices.push(e))}var q=tracing.getColorIdByName("running"),j=tracing.getColorIdByName("runnable"),i=tracing.getColorIdByName("sleeping"),f=tracing.getColorIdByName("iowait");this.model_.getAllThreads().forEach(function(b){if(b.tempCpuSlices){var a=b.tempCpuSlices;delete b.tempCpuSlices;a.sort(function(b,a){var d=b.start-a.start;return 0==d?b.index-a.index:d});var d=[];if(a.length){var e=a[0];d.push(new tracing.TimelineSlice("Running",q,e.start,{},e.duration))}for(e=
-1;e<a.length;e++){var g=a[e-1],c=a[e],h=c.start-g.end;if("S"==g.args.stateWhenDescheduled)d.push(new tracing.TimelineSlice("Sleeping",i,g.end,{},h));else if("R"==g.args.stateWhenDescheduled||"R+"==g.args.stateWhenDescheduled)d.push(new tracing.TimelineSlice("Runnable",j,g.end,{},h));else if("D"==g.args.stateWhenDescheduled)d.push(new tracing.TimelineSlice("I/O Wait",f,g.end,{},h));else if("T"==g.args.stateWhenDescheduled)d.push(new tracing.TimelineSlice("__TASK_STOPPED",f,g.end,{},h));else if("t"==
-g.args.stateWhenDescheduled)d.push(new tracing.TimelineSlice("debug",f,g.end,{},h));else if("Z"==g.args.stateWhenDescheduled)d.push(new tracing.TimelineSlice("Zombie",f,g.end,{},h));else if("X"==g.args.stateWhenDescheduled)d.push(new tracing.TimelineSlice("Exit Dead",f,g.end,{},h));else if("x"==g.args.stateWhenDescheduled)d.push(new tracing.TimelineSlice("Task Dead",f,g.end,{},h));else if("W"==g.args.stateWhenDescheduled)d.push(new tracing.TimelineSlice("WakeKill",f,g.end,{},h));else throw"Unrecognized state: "+
-g.args.stateWhenDescheduled;d.push(new tracing.TimelineSlice("Running",q,c.start,{},c.duration))}b.cpuSlices=d}})},alignClocks:function(){if(0==this.clockSyncRecords_.length){if(!this.isAdditionalImport_)return;this.abortImport();return!1}var b=this.clockSyncRecords_[0];if(0==b.parentTS||b.parentTS==b.perfTS)return!0;var b=b.parentTS-b.perfTS,a;for(a in this.cpuStates_){for(var d=this.cpuStates_[a].cpu,e=0;e<d.slices.length;e++){var c=d.slices[e];c.start+=b;c.duration=c.duration}for(var q in d.counters){e=
-d.counters[q];for(c=0;c<e.timestamps.length;c++)e.timestamps[c]+=b}}for(var j in this.kernelThreadStates_){a=this.kernelThreadStates_[j].thread;for(e=0;e<a.subRows[0].length;e++)a.subRows[0][e].start+=b}return!0},abortImport:function(){if(this.pushedEventsToThreads)throw"Cannot abort, have alrady pushedCpuDataToThreads.";for(var b in this.cpuStates_)delete this.model_.cpus[b];for(var a in this.kernelThreadStates_){b=this.kernelThreadStates_[a].thread;var d=b.parent;delete d.threads[b.tid];delete this.model_.processes[d.pid]}this.model_.importErrors.push("Cannot import kernel trace without a clock sync.")},
-markPidRunnable:function(){},importError:function(b){this.model_.importErrors.push("Line "+(this.lineNumber+1)+": "+b)},malformedEvent:function(b){this.importError("Malformed "+b+" event")},processBegin:function(b,a,d,e,c,q){var j=tracing.getStringColorId(d),d=new tracing.TimelineThreadSlice(d,j,e,null);d.pid=c;d.tid=q;d.threadName=a;b.openSlices.push(d)},processEnd:function(b,a){if(0!=b.openSlices.length){var d=b.openSlices.pop();d.duration=a-d.start;var e=this.model_.getOrCreateProcess(d.pid).getOrCreateThread(d.tid);
-e.name||(e.name=d.threadName);this.threadsByLinuxPid[d.tid]=e;e.getSubrow(b.openSlices.length).push(d);b.openSlices.length&&b.openSlices[b.openSlices.length-1].subSlices.push(d)}},autoCloseOpenSlices:function(){this.model_.updateBounds();var b=[],a;for(a in this.threadStateByKPID_)for(var d=this.threadStateByKPID_[a],e=0;e<d.openSlices.length;e++){var c=d.openSlices[e];b.push(c.start);for(var q=0;q<c.subSlices.length;q++){var j=c.subSlices[q];b.push(j.start);j.duration&&b.push(j.end)}}b=this.model_.maxTimestamp?
-Math.max(this.model_.maxTimestamp,Math.max.apply(Math,b)):Math.max.apply(Math,b);for(a in this.threadStateByKPID_)for(d=this.threadStateByKPID_[a];0<d.openSlices.length;)c=d.openSlices.pop(),c.duration=b-c.start,c.didNotFinish=!0,this.model_.getOrCreateProcess(c.pid).getOrCreateThread(c.tid).getSubrow(d.openSlices.length).push(c),d.openSlices.length&&d.openSlices[d.openSlices.length-1].subSlices.push(c)},processCounter:function(b,a,d,e){b=this.model_.getOrCreateProcess(e).getOrCreateCounter("",b);
-0==b.numSeries&&(b.seriesNames.push("state"),b.seriesColors.push(tracing.getStringColorId(b.name+".state")));b.timestamps.push(a);b.samples.push(d)},importCpuData:function(){this.lines_=this.events_.split("\n");for(this.lineNumber=0;this.lineNumber<this.lines_.length;++this.lineNumber){var a=this.lines_[this.lineNumber];if(!(/^#/.exec(a)||0==a.length)){var f=e.exec(a);if(f){var m=f[1],a=f[4],h=f[5],l=f[6],q=this.getOrCreateCpuState(parseInt(f[2])),f=1E3*parseFloat(a);switch(h){case "sched_switch":a=
-i.exec(l);if(!a){this.malformedEvent(h);continue}h=a[4];l=a[5];m=parseInt(a[6]);a=parseInt(a[7]);q.switchRunningLinuxPid(this,h,f,m,l,a);break;case "sched_wakeup":a=b.exec(l);if(!a){this.malformedEvent(h);continue}l=a[1];h=parseInt(a[2]);a=parseInt(a[3]);this.markPidRunnable(f,h,l,a);break;case "power_start":a=/type=(\d+) state=(\d) cpu_id=(\d)+/.exec(l);if(!a){this.malformedEvent(h);continue}h=parseInt(a[3]);h=this.getOrCreateCpuState(h);if("1"==a[1])h=h.cpu.getOrCreateCounter("","C-State");else{this.importError("Don't understand power_start events of type "+
-a[1]);continue}0==h.numSeries&&(h.seriesNames.push("state"),h.seriesColors.push(tracing.getStringColorId(h.name+".state")));a=parseInt(a[2]);h.timestamps.push(f);h.samples.push(a);break;case "power_frequency":a=/type=(\d+) state=(\d+) cpu_id=(\d)+/.exec(l);if(!a){this.malformedEvent(h);continue}h=parseInt(a[3]);h=this.getOrCreateCpuState(h);h=h.cpu.getOrCreateCounter("","Power Frequency");0==h.numSeries&&(h.seriesNames.push("state"),h.seriesColors.push(tracing.getStringColorId(h.name+".state")));
-a=parseInt(a[2]);h.timestamps.push(f);h.samples.push(a);break;case "cpu_frequency":a=/state=(\d+) cpu_id=(\d)+/.exec(l);if(!a){this.malformedEvent(h);continue}h=parseInt(a[2]);h=this.getOrCreateCpuState(h);h=h.cpu.getOrCreateCounter("","Clock Frequency");0==h.numSeries&&(h.seriesNames.push("state"),h.seriesColors.push(tracing.getStringColorId(h.name+".state")));a=parseInt(a[1]);h.timestamps.push(f);h.samples.push(a);break;case "cpu_idle":a=/state=(\d+) cpu_id=(\d)+/.exec(l);if(!a){this.malformedEvent(h);
-continue}h=parseInt(a[2]);h=this.getOrCreateCpuState(h);h=h.cpu.getOrCreateCounter("","C-State");0==h.numSeries&&(h.seriesNames.push("state"),h.seriesColors.push(tracing.getStringColorId(h.name)));a=parseInt(a[1]);4294967295!=a?h.samples.push(a):h.samples.push(0);h.timestamps.push(f);break;case "workqueue_execute_start":a=j.exec(l);if(!a){this.malformedEvent(h);continue}h=this.getOrCreateKernelThread(m);h.openSliceTS=f;h.openSlice=a[2];break;case "workqueue_execute_end":a=o.exec(l);if(!a){this.malformedEvent(h);
-continue}h=this.getOrCreateKernelThread(m);h.openSlice&&(f=new tracing.TimelineSlice(h.openSlice,tracing.getStringColorId(h.openSlice),h.openSliceTS,{},f-h.openSliceTS),h.thread.subRows[0].push(f));h.openSlice=void 0;break;case "workqueue_queue_work":break;case "workqueue_activate_work":break;case "i915_gem_object_pwrite":a=/obj=(.+), offset=(\d+), len=(\d+)/.exec(l);if(!a){this.malformedEvent(h);continue}l=a[1];q=parseInt(a[2]);a=parseInt(a[3]);h=this.getOrCreateKernelThread("i915_gem",0,1);h.openSlice=
-"pwrite:"+l;f=new tracing.TimelineSlice(h.openSlice,tracing.getStringColorId(h.openSlice),f,{obj:l,offset:q,len:a},0);h.thread.subRows[0].push(f);break;case "i915_flip_request":a=/plane=(\d+), obj=(.+)/.exec(l);if(!a){this.malformedEvent(h);continue}q=parseInt(a[1]);l=a[2];h=this.getOrCreateKernelThread("i915_flip",0,2);h.openSliceTS=f;h.openSlice="flip:"+l+"/"+q;break;case "i915_flip_complete":a=/plane=(\d+), obj=(.+)/.exec(l);if(!a){this.malformedEvent(h);continue}q=parseInt(a[1]);l=a[2];h=this.getOrCreateKernelThread("i915_flip",
-0,2);h.openSlice&&(f=new tracing.TimelineSlice(h.openSlice,tracing.getStringColorId(h.openSlice),h.openSliceTS,{obj:l,plane:q},f-h.openSliceTS),h.thread.subRows[0].push(f));h.openSlice=void 0;break;case "0":case "tracing_mark_write":if(a=d.exec(l))this.clockSyncRecords_.push({perfTS:f,parentTS:1E3*a[1]});else{q=this.parsePid(m);m=this.parseThreadName(m);a=q;a in this.threadStateByKPID_||(this.threadStateByKPID_[a]=new c);var r=this.threadStateByKPID_[a],a=l.split("|");switch(a[0]){case "B":h=parseInt(a[1]);
-l=a[2];this.processBegin(r,m,l,f,h,q);break;case "E":this.processEnd(r,f);break;case "C":h=parseInt(a[1]);l=a[2];a=parseInt(a[3]);this.processCounter(l,f,a,h);break;default:this.malformedEvent(h)}}break;default:console.log("unknown event "+h)}}else this.importError("Unrecognized line: "+a)}}}};tracing.TimelineModel.registerImporter(a);return{LinuxPerfImporter:a,_LinuxPerfImporterTestExports:TestExports}});cr.define("tracing",function(){function f(){this.openSlices=[]}function c(a,e){this.model_=a;"string"===typeof e||e instanceof String?("["==e[0]&&(n=e.length,"]"!=e[n-1]&&"\n"!=e[n-1]?e+="]":"]"!=e[n-2]&&"\n"==e[n-1]?e+="]":"]"!=e[n-3]&&("\r"==e[n-2]&&"\n"==e[n-1])&&(e+="]")),this.events_=JSON.parse(e)):this.events_=e;this.events_.traceEvents&&(this.events_=this.events_.traceEvents);this.threadStateByPTID_={};this.allAsyncEvents_=[]}c.canImport=function(a){return"string"===typeof a||a instanceof String?
+1;e<a.length;e++){var g=a[e-1],c=a[e],h=c.start-g.end;if("S"==g.args.stateWhenDescheduled)d.push(new tracing.TimelineSlice("Sleeping",i,g.end,{},h));else if("R"==g.args.stateWhenDescheduled||"R+"==g.args.stateWhenDescheduled)d.push(new tracing.TimelineSlice("Runnable",j,g.end,{},h));else if("D"==g.args.stateWhenDescheduled)d.push(new tracing.TimelineSlice("Uninterruptible Sleep",f,g.end,{},h));else if("T"==g.args.stateWhenDescheduled)d.push(new tracing.TimelineSlice("__TASK_STOPPED",f,g.end,{},h));
+else if("t"==g.args.stateWhenDescheduled)d.push(new tracing.TimelineSlice("debug",f,g.end,{},h));else if("Z"==g.args.stateWhenDescheduled)d.push(new tracing.TimelineSlice("Zombie",f,g.end,{},h));else if("X"==g.args.stateWhenDescheduled)d.push(new tracing.TimelineSlice("Exit Dead",f,g.end,{},h));else if("x"==g.args.stateWhenDescheduled)d.push(new tracing.TimelineSlice("Task Dead",f,g.end,{},h));else if("W"==g.args.stateWhenDescheduled)d.push(new tracing.TimelineSlice("WakeKill",f,g.end,{},h));else if("D|W"==
+g.args.stateWhenDescheduled)d.push(new tracing.TimelineSlice("Uninterruptable Sleep | WakeKill",f,g.end,{},h));else throw"Unrecognized state: "+g.args.stateWhenDescheduled;d.push(new tracing.TimelineSlice("Running",q,c.start,{},c.duration))}b.cpuSlices=d}})},alignClocks:function(){if(0==this.clockSyncRecords_.length){if(!this.isAdditionalImport_)return;this.abortImport();return!1}var b=this.clockSyncRecords_[0];if(0==b.parentTS||b.parentTS==b.perfTS)return!0;var b=b.parentTS-b.perfTS,a;for(a in this.cpuStates_){for(var d=
+this.cpuStates_[a].cpu,e=0;e<d.slices.length;e++){var c=d.slices[e];c.start+=b;c.duration=c.duration}for(var q in d.counters){e=d.counters[q];for(c=0;c<e.timestamps.length;c++)e.timestamps[c]+=b}}for(var j in this.kernelThreadStates_){a=this.kernelThreadStates_[j].thread;for(e=0;e<a.subRows[0].length;e++)a.subRows[0][e].start+=b}return!0},abortImport:function(){if(this.pushedEventsToThreads)throw"Cannot abort, have alrady pushedCpuDataToThreads.";for(var b in this.cpuStates_)delete this.model_.cpus[b];
+for(var a in this.kernelThreadStates_){b=this.kernelThreadStates_[a].thread;var d=b.parent;delete d.threads[b.tid];delete this.model_.processes[d.pid]}this.model_.importErrors.push("Cannot import kernel trace without a clock sync.")},markPidRunnable:function(){},importError:function(b){this.model_.importErrors.push("Line "+(this.lineNumber+1)+": "+b)},malformedEvent:function(b){this.importError("Malformed "+b+" event")},processBegin:function(b,a,d,e,c,q){var j=tracing.getStringColorId(d),d=new tracing.TimelineThreadSlice(d,
+j,e,null);d.pid=c;d.tid=q;d.threadName=a;b.openSlices.push(d)},processEnd:function(b,a){if(0!=b.openSlices.length){var d=b.openSlices.pop();d.duration=a-d.start;var e=this.model_.getOrCreateProcess(d.pid).getOrCreateThread(d.tid);e.name||(e.name=d.threadName);this.threadsByLinuxPid[d.tid]=e;e.getSubrow(b.openSlices.length).push(d);b.openSlices.length&&b.openSlices[b.openSlices.length-1].subSlices.push(d)}},autoCloseOpenSlices:function(){this.model_.updateBounds();var b=[],a;for(a in this.threadStateByKPID_)for(var d=
+this.threadStateByKPID_[a],e=0;e<d.openSlices.length;e++){var c=d.openSlices[e];b.push(c.start);for(var q=0;q<c.subSlices.length;q++){var j=c.subSlices[q];b.push(j.start);j.duration&&b.push(j.end)}}b=this.model_.maxTimestamp?Math.max(this.model_.maxTimestamp,Math.max.apply(Math,b)):Math.max.apply(Math,b);for(a in this.threadStateByKPID_)for(d=this.threadStateByKPID_[a];0<d.openSlices.length;)c=d.openSlices.pop(),c.duration=b-c.start,c.didNotFinish=!0,this.model_.getOrCreateProcess(c.pid).getOrCreateThread(c.tid).getSubrow(d.openSlices.length).push(c),
+d.openSlices.length&&d.openSlices[d.openSlices.length-1].subSlices.push(c)},processCounter:function(b,a,d,e){b=this.model_.getOrCreateProcess(e).getOrCreateCounter("",b);0==b.numSeries&&(b.seriesNames.push("state"),b.seriesColors.push(tracing.getStringColorId(b.name+".state")));b.timestamps.push(a);b.samples.push(d)},importCpuData:function(){this.lines_=this.events_.split("\n");for(this.lineNumber=0;this.lineNumber<this.lines_.length;++this.lineNumber){var a=this.lines_[this.lineNumber];if(!(/^#/.exec(a)||
+0==a.length)){var f=e.exec(a);if(f){var m=f[1],a=f[4],h=f[5],l=f[6],q=this.getOrCreateCpuState(parseInt(f[2])),f=1E3*parseFloat(a);switch(h){case "sched_switch":a=i.exec(l);if(!a){this.malformedEvent(h);continue}h=a[4];l=a[5];m=parseInt(a[6]);a=parseInt(a[7]);q.switchRunningLinuxPid(this,h,f,m,l,a);break;case "sched_wakeup":a=b.exec(l);if(!a){this.malformedEvent(h);continue}l=a[1];h=parseInt(a[2]);a=parseInt(a[3]);this.markPidRunnable(f,h,l,a);break;case "power_start":a=/type=(\d+) state=(\d) cpu_id=(\d)+/.exec(l);
+if(!a){this.malformedEvent(h);continue}h=parseInt(a[3]);h=this.getOrCreateCpuState(h);if("1"==a[1])h=h.cpu.getOrCreateCounter("","C-State");else{this.importError("Don't understand power_start events of type "+a[1]);continue}0==h.numSeries&&(h.seriesNames.push("state"),h.seriesColors.push(tracing.getStringColorId(h.name+".state")));a=parseInt(a[2]);h.timestamps.push(f);h.samples.push(a);break;case "power_frequency":a=/type=(\d+) state=(\d+) cpu_id=(\d)+/.exec(l);if(!a){this.malformedEvent(h);continue}h=
+parseInt(a[3]);h=this.getOrCreateCpuState(h);h=h.cpu.getOrCreateCounter("","Power Frequency");0==h.numSeries&&(h.seriesNames.push("state"),h.seriesColors.push(tracing.getStringColorId(h.name+".state")));a=parseInt(a[2]);h.timestamps.push(f);h.samples.push(a);break;case "cpu_frequency":a=/state=(\d+) cpu_id=(\d)+/.exec(l);if(!a){this.malformedEvent(h);continue}h=parseInt(a[2]);h=this.getOrCreateCpuState(h);h=h.cpu.getOrCreateCounter("","Clock Frequency");0==h.numSeries&&(h.seriesNames.push("state"),
+h.seriesColors.push(tracing.getStringColorId(h.name+".state")));a=parseInt(a[1]);h.timestamps.push(f);h.samples.push(a);break;case "cpu_idle":a=/state=(\d+) cpu_id=(\d)+/.exec(l);if(!a){this.malformedEvent(h);continue}h=parseInt(a[2]);h=this.getOrCreateCpuState(h);h=h.cpu.getOrCreateCounter("","C-State");0==h.numSeries&&(h.seriesNames.push("state"),h.seriesColors.push(tracing.getStringColorId(h.name)));a=parseInt(a[1]);4294967295!=a?h.samples.push(a):h.samples.push(0);h.timestamps.push(f);break;case "workqueue_execute_start":a=
+j.exec(l);if(!a){this.malformedEvent(h);continue}h=this.getOrCreateKernelThread(m);h.openSliceTS=f;h.openSlice=a[2];break;case "workqueue_execute_end":a=o.exec(l);if(!a){this.malformedEvent(h);continue}h=this.getOrCreateKernelThread(m);h.openSlice&&(f=new tracing.TimelineSlice(h.openSlice,tracing.getStringColorId(h.openSlice),h.openSliceTS,{},f-h.openSliceTS),h.thread.subRows[0].push(f));h.openSlice=void 0;break;case "workqueue_queue_work":break;case "workqueue_activate_work":break;case "i915_gem_object_pwrite":a=
+/obj=(.+), offset=(\d+), len=(\d+)/.exec(l);if(!a){this.malformedEvent(h);continue}l=a[1];q=parseInt(a[2]);a=parseInt(a[3]);h=this.getOrCreateKernelThread("i915_gem",0,1);h.openSlice="pwrite:"+l;f=new tracing.TimelineSlice(h.openSlice,tracing.getStringColorId(h.openSlice),f,{obj:l,offset:q,len:a},0);h.thread.subRows[0].push(f);break;case "i915_flip_request":a=/plane=(\d+), obj=(.+)/.exec(l);if(!a){this.malformedEvent(h);continue}q=parseInt(a[1]);l=a[2];h=this.getOrCreateKernelThread("i915_flip",0,
+2);h.openSliceTS=f;h.openSlice="flip:"+l+"/"+q;break;case "i915_flip_complete":a=/plane=(\d+), obj=(.+)/.exec(l);if(!a){this.malformedEvent(h);continue}q=parseInt(a[1]);l=a[2];h=this.getOrCreateKernelThread("i915_flip",0,2);h.openSlice&&(f=new tracing.TimelineSlice(h.openSlice,tracing.getStringColorId(h.openSlice),h.openSliceTS,{obj:l,plane:q},f-h.openSliceTS),h.thread.subRows[0].push(f));h.openSlice=void 0;break;case "0":case "tracing_mark_write":if(a=d.exec(l))this.clockSyncRecords_.push({perfTS:f,
+parentTS:1E3*a[1]});else{q=this.parsePid(m);m=this.parseThreadName(m);a=q;a in this.threadStateByKPID_||(this.threadStateByKPID_[a]=new c);var r=this.threadStateByKPID_[a],a=l.split("|");switch(a[0]){case "B":h=parseInt(a[1]);l=a[2];this.processBegin(r,m,l,f,h,q);break;case "E":this.processEnd(r,f);break;case "C":h=parseInt(a[1]);l=a[2];a=parseInt(a[3]);this.processCounter(l,f,a,h);break;default:this.malformedEvent(h)}}break;default:console.log("unknown event "+h)}}else this.importError("Unrecognized line: "+
+a)}}}};tracing.TimelineModel.registerImporter(a);return{LinuxPerfImporter:a,_LinuxPerfImporterTestExports:TestExports}});cr.define("tracing",function(){function f(){this.openSlices=[]}function c(a,e){this.model_=a;"string"===typeof e||e instanceof String?("["==e[0]&&(n=e.length,"]"!=e[n-1]&&"\n"!=e[n-1]?e+="]":"]"!=e[n-2]&&"\n"==e[n-1]?e+="]":"]"!=e[n-3]&&("\r"==e[n-2]&&"\n"==e[n-1])&&(e+="]")),this.events_=JSON.parse(e)):this.events_=e;this.events_.traceEvents&&(this.events_=this.events_.traceEvents);this.threadStateByPTID_={};this.allAsyncEvents_=[]}c.canImport=function(a){return"string"===typeof a||a instanceof String?
"{"==a[0]||"["==a[0]:a instanceof Array&&a.length&&a[0].ph?!0:a.traceEvents?a.traceEvents instanceof Array&&a.traceEvents[0].ph:!1};c.prototype={__proto__:Object.prototype,processBeginEvent:function(a,e,c){var b=tracing.getStringColorId(c.name),a={index:a,slice:new tracing.TimelineThreadSlice(c.name,b,c.ts/1E3,c.args)};c.uts&&(a.slice.startInUserTime=c.uts/1E3);"0"===c.args["ui-nest"]?this.model_.importErrors.push("ui-nest no longer supported."):e.openSlices.push(a)},processEndEvent:function(a,e){if("0"===
e.args["ui-nest"])this.model_.importErrors.push("ui-nest no longer supported.");else if(0!=a.openSlices.length){var c=a.openSlices.pop().slice;c.duration=e.ts/1E3-c.start;e.uts&&(c.durationInUserTime=e.uts/1E3-c.startInUserTime);for(var b in e.args)c.args[b]=e.args[b];this.model_.getOrCreateProcess(e.pid).getOrCreateThread(e.tid).getSubrow(a.openSlices.length).push(c);a.openSlices.length&&a.openSlices[a.openSlices.length-1].slice.subSlices.push(c)}},processAsyncEvent:function(a,e,c){a=this.model_.getOrCreateProcess(c.pid).getOrCreateThread(c.tid);
this.allAsyncEvents_.push({event:c,thread:a})},autoCloseOpenSlices:function(){this.model_.updateBounds();var a=[],e;for(e in this.threadStateByPTID_)for(var c=this.threadStateByPTID_[e],b=0;b<c.openSlices.length;b++){var d=c.openSlices[b];a.push(d.slice.start);for(var j=0;j<d.slice.subSlices.length;j++){var f=d.slice.subSlices[j];a.push(f.start);f.duration&&a.push(f.end)}}a=this.model_.maxTimestamp?Math.max(this.model_.maxTimestamp,Math.max.apply(Math,a)):Math.max.apply(Math,a);for(e in this.threadStateByPTID_)for(c=
diff --git a/src/tracing/linux_perf_importer.js b/src/tracing/linux_perf_importer.js
index d46e941..767453b 100644
--- a/src/tracing/linux_perf_importer.js
+++ b/src/tracing/linux_perf_importer.js
@@ -300,8 +300,9 @@
slices.push(new tracing.TimelineSlice('Runnable', runnableId,
prevSlice.end, {}, midDuration));
} else if (prevSlice.args.stateWhenDescheduled == 'D') {
- slices.push(new tracing.TimelineSlice('I/O Wait', ioWaitId,
- prevSlice.end, {}, midDuration));
+ slices.push(new tracing.TimelineSlice(
+ 'Uninterruptible Sleep', ioWaitId,
+ prevSlice.end, {}, midDuration));
} else if (prevSlice.args.stateWhenDescheduled == 'T') {
slices.push(new tracing.TimelineSlice('__TASK_STOPPED', ioWaitId,
prevSlice.end, {}, midDuration));
@@ -320,6 +321,10 @@
} else if (prevSlice.args.stateWhenDescheduled == 'W') {
slices.push(new tracing.TimelineSlice('WakeKill', ioWaitId,
prevSlice.end, {}, midDuration));
+ } else if (prevSlice.args.stateWhenDescheduled == 'D|W') {
+ slices.push(new tracing.TimelineSlice(
+ 'Uninterruptable Sleep | WakeKill', ioWaitId,
+ prevSlice.end, {}, midDuration));
} else {
throw 'Unrecognized state: ' + prevSlice.args.stateWhenDescheduled;
}