diff options
author | Arjan van de Ven <arjan@linux.intel.com> | 2011-05-29 10:29:57 -0700 |
---|---|---|
committer | Arjan van de Ven <arjan@linux.intel.com> | 2011-05-29 10:29:57 -0700 |
commit | cd63deb9c1c4a22471fb9b02e72c9cc1fd8b433f (patch) | |
tree | e12bac4763f417745e560ebdfc480b5534c3df7b | |
parent | 9ed8a7c52c7e0267142beccc48abf8e63688d86d (diff) | |
download | powertop-cd63deb9c1c4a22471fb9b02e72c9cc1fd8b433f.tar.gz |
consistently report %ages in the top summary
-rw-r--r-- | process/interrupt.cpp | 12 | ||||
-rw-r--r-- | process/interrupt.h | 2 | ||||
-rw-r--r-- | process/timer.cpp | 12 | ||||
-rw-r--r-- | process/timer.h | 2 |
4 files changed, 28 insertions, 0 deletions
diff --git a/process/interrupt.cpp b/process/interrupt.cpp index 85e1bea..6594ebf 100644 --- a/process/interrupt.cpp +++ b/process/interrupt.cpp @@ -79,6 +79,18 @@ const char * interrupt::description(void) return desc; } +double interrupt::usage_summary(void) +{ + double t; + t = (accumulated_runtime - child_runtime) / 1000000.0 / measurement_time / 10; + return t; +} + +const char * interrupt::usage_units_summary(void) +{ + return "%"; +} + class interrupt * find_create_interrupt(const char *_handler, int nr, int cpu) { diff --git a/process/interrupt.h b/process/interrupt.h index cf71d72..655e5bb 100644 --- a/process/interrupt.h +++ b/process/interrupt.h @@ -47,6 +47,8 @@ public: virtual const char * name(void) { return "interrupt"; }; virtual const char * type(void) { return "Interrupt"; }; + virtual double usage_summary(void); + virtual const char * usage_units_summary(void); }; extern vector <class interrupt *> all_interrupts; diff --git a/process/timer.cpp b/process/timer.cpp index c888be4..2ab4ec9 100644 --- a/process/timer.cpp +++ b/process/timer.cpp @@ -67,6 +67,18 @@ uint64_t timer::done(uint64_t time, uint64_t timer_struct) return delta; } +double timer::usage_summary(void) +{ + double t; + t = (accumulated_runtime - child_runtime) / 1000000.0 / measurement_time / 10; + return t; +} + +const char * timer::usage_units_summary(void) +{ + return "%"; +} + static void add_timer(const pair<unsigned long, class timer*>& elem) diff --git a/process/timer.h b/process/timer.h index 5ff3efd..8d71a2e 100644 --- a/process/timer.h +++ b/process/timer.h @@ -43,6 +43,8 @@ public: virtual const char * description(void); virtual const char * name(void) { return "timer"; }; virtual const char * type(void) { return "Timer"; }; + virtual double usage_summary(void); + virtual const char * usage_units_summary(void); }; |