>From kernel version 2.6.41 the power_start, power_end
and power_frequency power traces will be replaced with
cpu_idle and cpu_frequency power traces. Refer kernel
documentation events-power.txt for details.

Signed-off-by: John Mathew <[email protected]>
---
 cpu/cpu.cpp            |   16 +++++++++++++++-
 process/do_process.cpp |    8 ++++++++
 process/process.h      |    4 ++++
 3 files changed, 27 insertions(+), 1 deletions(-)

diff --git a/cpu/cpu.cpp b/cpu/cpu.cpp
index 563aa30..e1daf2b 100644
--- a/cpu/cpu.cpp
+++ b/cpu/cpu.cpp
@@ -32,6 +32,7 @@
 #include "cpu.h"
 #include "cpudevice.h"
 #include "../parameters/parameters.h"
+#include "../process/process.h"
 
 #include "../perf/perf_bundle.h"
 #include "../lib.h"
@@ -277,10 +278,11 @@ void enumerate_cpus(void)
 
        perf_events = new perf_power_bundle();
 
+       perf_events->add_event("power:cpu_idle");
+       perf_events->add_event("power:cpu_frequency");
        perf_events->add_event("power:power_frequency");
        perf_events->add_event("power:power_start");
        perf_events->add_event("power:power_end");
-
 }
 
 void start_cpu_measurement(void)
@@ -955,6 +957,18 @@ void perf_power_bundle::handle_trace_point(int type, void 
*trace, int cpunr, uin
                        system_level.children[i]->validate();
 #endif
 
+
+       if (strcmp(event_name, "power:cpu_frequency")==0) {
+               struct cpuidle_entry *pe = (struct cpuidle_entry *)trace;
+               cpu->change_freq(time, pe->state);
+       }
+       if (strcmp(event_name, "power:cpu_idle")==0) {
+               struct cpuidle_entry *ce = (struct cpuidle_entry *)trace;
+               if (ce->state == 4294967295)
+                       cpu->go_unidle(time);
+               else
+                       cpu->go_idle(time);
+       }
        if (strcmp(event_name, "power:power_frequency")==0) {
                struct power_entry *pe = (struct power_entry *)trace;
                cpu->change_freq(time, pe->value);
diff --git a/process/do_process.cpp b/process/do_process.cpp
index f97b7e7..be27596 100644
--- a/process/do_process.cpp
+++ b/process/do_process.cpp
@@ -447,6 +447,13 @@ void perf_process_bundle::handle_trace_point(int type, 
void *trace, int cpu, uin
                t = work->done(time, (uint64_t)wq->work);
                consumer_child_time(cpu, t);
        }
+       if (strcmp(event_name, "power:cpu_idle")==0) {
+               struct cpuidle_entry *ce = (struct cpuidle_entry *)trace;
+               if (ce->state == 4294967295)
+                       consume_blame(cpu);
+               else
+                       set_wakeup_pending(cpu);
+       }
        if (strcmp(event_name, "power:power_start") == 0) {
                set_wakeup_pending(cpu);
        }
@@ -515,6 +522,7 @@ void start_process_measurement(void)
                perf_events->add_event("timer:timer_expire_exit");
                perf_events->add_event("timer:hrtimer_expire_entry");
                perf_events->add_event("timer:hrtimer_expire_exit");
+               perf_events->add_event("power:cpu_idle");
                perf_events->add_event("power:power_start");
                perf_events->add_event("power:power_end");
                perf_events->add_event("workqueue:workqueue_execute_start");
diff --git a/process/process.h b/process/process.h
index a8fa91e..7d3f7cf 100644
--- a/process/process.h
+++ b/process/process.h
@@ -177,6 +177,10 @@ struct workqueue_end {
 #endif
        void            *work;
 } __attribute__((packed));
+struct cpuidle_entry {
+       uint32_t  state;
+       uint32_t  cpu_id;
+} __attribute__((packed));
 
 struct  dirty_inode {
        uint32_t dev;
-- 
1.7.4.1

---------------------------------------------------------------------
Intel Finland Oy
Registered Address: PL 281, 00181 Helsinki 
Business Identity Code: 0357606 - 4 
Domiciled in Helsinki 

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

_______________________________________________
Power mailing list
[email protected]
https://bughost.org/mailman/listinfo/power

Reply via email to