aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArjan van de Ven <arjan@linux.intel.com>2010-09-26 23:55:32 -0700
committerArjan van de Ven <arjan@linux.intel.com>2010-09-26 23:55:32 -0700
commit5cdc930ef2716ec5030ac0fa8a4b4f284d11f41a (patch)
tree14b86d2c46fe1abc38b23dbfa558d1b5c2c9b557
parent6cda457ccf1440c9ce4168cd5025a8c7635a7d07 (diff)
downloadpowertop-5cdc930ef2716ec5030ac0fa8a4b4f284d11f41a.tar.gz
add an exception mechanism for things like Xorg/dbus
an app that wakes up Xorg gets charged for that wakeup, and with this patch, it'll also get charged for the wakeup that X will do back to this application.
-rw-r--r--TODO5
-rw-r--r--parameters/parameters.h1
-rw-r--r--process/device.h2
-rw-r--r--process/do_process.cpp29
4 files changed, 32 insertions, 5 deletions
diff --git a/TODO b/TODO
index 8f910b0..12b42f6 100644
--- a/TODO
+++ b/TODO
@@ -1,10 +1,10 @@
* debug why wakeups sometimes go to all 0's
* audio calibration? Need appropriate sample
* fix memory leaks
-* find out why CPU power and sum of components doesn't add up
+* find out why CPU %age and C state C0 %age don't mesh sometimes
* add device runtime PM stats for pci, spi and i2c
* deal with debugfs not being in /sys/kernel/debug
-
+* exclude xorg/etc from wakeup blame backcounting
* GPU ops in interrupt context -> do not account special ?
@@ -21,3 +21,4 @@ done
all of them as they go
* in learning, try slightly lower base power
* display device power in power top 20
+* find out why CPU power and sum of components doesn't add up
diff --git a/parameters/parameters.h b/parameters/parameters.h
index 43ca095..536d8f1 100644
--- a/parameters/parameters.h
+++ b/parameters/parameters.h
@@ -80,5 +80,6 @@ extern double average_power(void);
extern int utilization_power_valid(const char *u);
extern int utilization_power_valid(int index);
+extern double calculate_params(struct parameter_bundle *params = &all_parameters);
#endif
diff --git a/process/device.h b/process/device.h
index 2442cbf..76ee8ab 100644
--- a/process/device.h
+++ b/process/device.h
@@ -17,6 +17,8 @@ public:
virtual const char * name(void) { return "device"; };
virtual const char * type(void) { return "Device"; };
virtual double Witts(void);
+ virtual double usage(void) { return device->utilization();};
+ virtual const char * usage_units(void) {return device->util_units();};
};
diff --git a/process/do_process.cpp b/process/do_process.cpp
index b47b9c5..dd56059 100644
--- a/process/do_process.cpp
+++ b/process/do_process.cpp
@@ -17,6 +17,7 @@
#include "../perf/perf_event.h"
#include "../parameters/parameters.h"
#include "../display.h"
+#include "../measurement/measurement.h"
static class perf_bundle * perf_events;
@@ -144,6 +145,16 @@ class perf_process_bundle: public perf_bundle
};
+/* some processes shouldn't be blamed for the wakeup if they wake a process up... for now this is a hardcoded list */
+int dont_blame_me(char *comm)
+{
+ if (strcmp(comm, "Xorg"))
+ return 1;
+ if (strcmp(comm, "dbus-daemon"))
+ return 1;
+
+ return 0;
+}
@@ -238,7 +249,7 @@ void perf_process_bundle::handle_trace_point(int type, void *trace, int cpu, uin
dest_proc = find_create_process(we->comm, we->pid);
- if (!dest_proc->running && dest_proc->waker == NULL && we->pid != 0)
+ if (!dest_proc->running && dest_proc->waker == NULL && we->pid != 0 && !dont_blame_me(we->comm))
dest_proc->waker = from;
}
@@ -402,6 +413,11 @@ void perf_process_bundle::handle_trace_point(int type, void *trace, int cpu, uin
if (strcmp(event_name, "i915:i915_gem_request_submit") == 0) {
class power_consumer *consumer;
consumer = current_consumer(cpu);
+ /* currently we don't count graphic requests submitted from irq contect */
+ if ( (flags & TRACE_FLAG_HARDIRQ) || (flags & TRACE_FLAG_SOFTIRQ)) {
+ consumer = NULL;
+ }
+
if (consumer) {
consumer->gpu_ops++;
}
@@ -463,8 +479,9 @@ void process_update_display(void)
wmove(win, 2,0);
+ calculate_params();
wprintw(win, "Estimated power: %5.1f Measured power: %5.1f\n\n",
- all_parameters.guessed_power, all_parameters.actual_power);
+ all_parameters.guessed_power, global_joules_consumed());
wprintw(win, "Power est. Usage/s Events/s Category Description\n");
@@ -478,7 +495,13 @@ void process_update_display(void)
sprintf(name, all_power[i]->type());
while (strlen(name) < 14) strcat(name, " ");
- sprintf(usage, "%5.1f%s", all_power[i]->usage(), all_power[i]->usage_units());
+ usage[0] = 0;
+ if (all_power[i]->usage_units()) {
+ if (all_power[i]->usage() < 1000)
+ sprintf(usage, "%5.1f%s", all_power[i]->usage(), all_power[i]->usage_units());
+ else
+ sprintf(usage, "%5i%s", (int)all_power[i]->usage(), all_power[i]->usage_units());
+ }
while (strlen(usage) < 10) strcat(usage, " ");
sprintf(events, "%5.1f", all_power[i]->events());
while (strlen(events) < 12) strcat(events, " ");