diff options
author | Colin Cross <ccross@android.com> | 2014-05-23 15:26:10 -0700 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2014-08-18 17:46:29 -0700 |
commit | e75d8a0d7c62e6e1e3a8c87c5979162ffc0bb423 (patch) | |
tree | 64b0a03c4d8d6aab0396632ab355aed74ac0fc9d | |
parent | c7271240bb39a5a3209208ff2842b89258e33869 (diff) | |
download | chromium-trace-e75d8a0d7c62e6e1e3a8c87c5979162ffc0bb423.tar.gz |
systrace: add one to idle states
Idle state 0 cannot be distinguished from not in idle, add one to
the idle state. Unfortunately that means the c-states don't line
up with the kernel's numbering (state0, state1, state2), but
that can't be avoided as long as trace-viewer uses a counter to
display the idle state.
Change-Id: I234e8bb5450aead5c3063cc7c2f1e01ec7ffdf31
-rw-r--r-- | script.js | 4 | ||||
-rw-r--r-- | trace-viewer/src/tracing/importer/linux_perf/power_parser.js | 2 |
2 files changed, 3 insertions, 3 deletions
@@ -109,8 +109,8 @@ function(a,b,f,d,k){return this.hwcSample("mali:axi","AXI: "+c,"count",d,k)}.bin a,c,b,g)},addL2Counter:function(a,c){this.importer.registerEventHandler(a,function(a,b,f,d,k){return this.l2Sample(c,"count",d,k)}.bind(this))},addL2Cycles:function(a,c){this.importer.registerEventHandler(a,function(a,b,f,d,k){return this.l2Sample(c,"cycles",d,k)}.bind(this))}};b.registerSubtype(d);return{MaliParser:d}});"use strict";base.require("tracing.importer.linux_perf.parser");base.require("tracing.trace_model.counter_series"); base.exportTo("tracing.importer.linux_perf",function(){function d(a){b.call(this,a);a.registerEventHandler("power_start",d.prototype.powerStartEvent.bind(this));a.registerEventHandler("power_frequency",d.prototype.powerFrequencyEvent.bind(this));a.registerEventHandler("cpu_frequency",d.prototype.cpuFrequencyEvent.bind(this));a.registerEventHandler("cpu_idle",d.prototype.cpuIdleEvent.bind(this))}var b=tracing.importer.linux_perf.Parser;d.prototype={__proto__:b.prototype,cpuStateSlice:function(a,c, b,g){c=this.importer.getOrCreateCpuState(c);"1"!=b?this.importer.importError("Don't understand power_start events of type "+b):(b=c.cpu.getOrCreateCounter("","C-State"),0===b.numSeries&&b.addSeries(new tracing.trace_model.CounterSeries("state",tracing.getStringColorId(b.name+".state"))),b.series.forEach(function(c){c.addSample(a,g)}))},cpuIdleSlice:function(a,c,b){c=this.importer.getOrCreateCpuState(c).cpu.getOrCreateCounter("","C-State");0===c.numSeries&&c.addSeries(new tracing.trace_model.CounterSeries("state", -tracing.getStringColorId(c.name)));var g=4294967295!=b?b:0;c.series.forEach(function(c){c.addSample(a,g)})},cpuFrequencySlice:function(a,c,b){c=this.importer.getOrCreateCpuState(c).cpu.getOrCreateCounter("","Clock Frequency");0===c.numSeries&&c.addSeries(new tracing.trace_model.CounterSeries("state",tracing.getStringColorId(c.name+".state")));c.series.forEach(function(c){c.addSample(a,b)})},powerStartEvent:function(a,c,b,g,f){a=/type=(\d+) state=(\d) cpu_id=(\d)+/.exec(f.details);if(!a)return!1;c= -parseInt(a[3]);b=parseInt(a[2]);this.cpuStateSlice(g,c,a[1],b);return!0},powerFrequencyEvent:function(a,c,b,g,f){c=/type=(\d+) state=(\d+) cpu_id=(\d)+/.exec(f.details);if(!c)return!1;a=parseInt(c[3]);c=parseInt(c[2]);this.cpuFrequencySlice(g,a,c);return!0},cpuFrequencyEvent:function(a,c,b,g,f){c=/state=(\d+) cpu_id=(\d)+/.exec(f.details);if(!c)return!1;a=parseInt(c[2]);c=parseInt(c[1]);this.cpuFrequencySlice(g,a,c);return!0},cpuIdleEvent:function(a,c,b,g,f){c=/state=(\d+) cpu_id=(\d)+/.exec(f.details); +tracing.getStringColorId(c.name)));var g=4294967295!=b?b+1:0;c.series.forEach(function(c){c.addSample(a,g)})},cpuFrequencySlice:function(a,c,b){c=this.importer.getOrCreateCpuState(c).cpu.getOrCreateCounter("","Clock Frequency");0===c.numSeries&&c.addSeries(new tracing.trace_model.CounterSeries("state",tracing.getStringColorId(c.name+".state")));c.series.forEach(function(c){c.addSample(a,b)})},powerStartEvent:function(a,c,b,g,f){a=/type=(\d+) state=(\d) cpu_id=(\d)+/.exec(f.details);if(!a)return!1; +c=parseInt(a[3]);b=parseInt(a[2]);this.cpuStateSlice(g,c,a[1],b);return!0},powerFrequencyEvent:function(a,c,b,g,f){c=/type=(\d+) state=(\d+) cpu_id=(\d)+/.exec(f.details);if(!c)return!1;a=parseInt(c[3]);c=parseInt(c[2]);this.cpuFrequencySlice(g,a,c);return!0},cpuFrequencyEvent:function(a,c,b,g,f){c=/state=(\d+) cpu_id=(\d)+/.exec(f.details);if(!c)return!1;a=parseInt(c[2]);c=parseInt(c[1]);this.cpuFrequencySlice(g,a,c);return!0},cpuIdleEvent:function(a,c,b,g,f){c=/state=(\d+) cpu_id=(\d)+/.exec(f.details); if(!c)return!1;a=parseInt(c[2]);c=parseInt(c[1]);this.cpuIdleSlice(g,a,c);return!0}};b.registerSubtype(d);return{PowerParser:d}});"use strict";base.require("tracing.importer.linux_perf.parser"); base.exportTo("tracing.importer.linux_perf",function(){function d(a){b.call(this,a);a.registerEventHandler("sched_switch",d.prototype.schedSwitchEvent.bind(this));a.registerEventHandler("sched_wakeup",d.prototype.schedWakeupEvent.bind(this))}var b=tracing.importer.linux_perf.Parser,a={},c=RegExp("prev_comm=(.+) prev_pid=(\\d+) prev_prio=(\\d+) prev_state=(\\S\\+?|\\S\\|\\S) ==> next_comm=(.+) next_pid=(\\d+) next_prio=(\\d+)");a.schedSwitchRE=c;var e=/comm=(.+) pid=(\d+) prio=(\d+) success=(\d+) target_cpu=(\d+)/; a.schedWakeupRE=e;d.prototype={__proto__:b.prototype,schedSwitchEvent:function(a,b,e,d,l){var m=c.exec(l.details);if(!m)return!1;a=m[4];e=m[5];l=parseInt(m[6]);m=parseInt(m[7]);this.importer.getOrCreateCpuState(b).switchRunningLinuxPid(this.importer,a,d,l,e,m);return!0},schedWakeupEvent:function(a,c,b,d,l){l=e.exec(l.details);if(!l)return!1;a=b;c=l[1];b=parseInt(l[2]);l=parseInt(l[3]);this.importer.markPidRunnable(d,b,c,l,a);return!0}};b.registerSubtype(d);return{SchedParser:d,_SchedParserTestExports:a}}); diff --git a/trace-viewer/src/tracing/importer/linux_perf/power_parser.js b/trace-viewer/src/tracing/importer/linux_perf/power_parser.js index e2238d91..32538075 100644 --- a/trace-viewer/src/tracing/importer/linux_perf/power_parser.js +++ b/trace-viewer/src/tracing/importer/linux_perf/power_parser.js @@ -62,7 +62,7 @@ base.exportTo('tracing.importer.linux_perf', function() { tracing.getStringColorId(powerCounter.name))); } // NB: 4294967295/-1 means an exit from the current state - var val = (cpuState != 4294967295 ? cpuState : 0); + var val = (cpuState != 4294967295 ? cpuState + 1 : 0); powerCounter.series.forEach(function(series) { series.addSample(ts, val); }); |