diff options
author | Arjan van de Ven <arjan@linux.intel.com> | 2011-06-04 13:54:29 -0700 |
---|---|---|
committer | Arjan van de Ven <arjan@linux.intel.com> | 2011-06-04 13:54:29 -0700 |
commit | f1dd1a7f6ddc18e70dcc52aecbc4d099c4013d34 (patch) | |
tree | 7fd0c8600e0763a4194d60f2b5f9d66914e5df0e | |
parent | cd63deb9c1c4a22471fb9b02e72c9cc1fd8b433f (diff) | |
download | powertop-f1dd1a7f6ddc18e70dcc52aecbc4d099c4013d34.tar.gz |
add special accounting for processes that wake up Xorg...
... they are special in that they cause GPUs to wake up out of power saving states.
-rw-r--r-- | main.cpp | 1 | ||||
-rw-r--r-- | process/do_process.cpp | 35 | ||||
-rw-r--r-- | process/powerconsumer.cpp | 4 | ||||
-rw-r--r-- | process/powerconsumer.h | 1 | ||||
-rw-r--r-- | process/process.cpp | 1 |
5 files changed, 36 insertions, 6 deletions
@@ -281,6 +281,7 @@ int main(int argc, char **argv) register_parameter("gpu-operations", 0.5576); register_parameter("disk-operations-hard", 0.2); register_parameter("disk-operations", 0.0); + register_parameter("xwakes", 0.1); load_board_params(); diff --git a/process/do_process.cpp b/process/do_process.cpp index 9ce0527..b105b28 100644 --- a/process/do_process.cpp +++ b/process/do_process.cpp @@ -290,6 +290,10 @@ void perf_process_bundle::handle_trace_point(int type, void *trace, int cpu, uin if (from) dest_proc->last_waker = from; + /* Account processes that wake up X specially */ + if (from && dest_proc && strcmp(dest_proc->comm, "Xorg") == 0) + from->xwakes ++ ; + } if (strcmp(event_name, "irq:irq_handler_entry") == 0) { struct irq_entry *irqe; @@ -601,6 +605,20 @@ double total_hard_disk_hits(void) return total; } +double total_xwakes(void) +{ + double total = 0; + unsigned int i; + for (i = 0; i < all_power.size() ; i++) + total += all_power[i]->xwakes; + + + total = total / measurement_time; + + + return total; +} + void process_update_display(void) { unsigned int i; @@ -725,9 +743,9 @@ void html_process_update_display(void) fprintf(htmlout, "<table width=100%%>\n"); if (show_power) - fprintf(htmlout, "<tr><th width=10%%>Power est.</th><th width=10%%>Usage</th><th width=10%%>Wakeups/s</th><th width=10%%>GPU ops/s</th><th width=10%%>Disk IO/s</th><th width=10%% class=\"process\">Category</th><th class=\"process\">Description</th></tr>\n"); + fprintf(htmlout, "<tr><th width=10%%>Power est.</th><th width=10%%>Usage</th><th width=10%%>Wakeups/s</th><th width=10%%>GPU ops/s</th><th width=10%%>Disk IO/s</th><th width=10%%>GFX Wakeups/s</th><th width=10%% class=\"process\">Category</th><th class=\"process\">Description</th></tr>\n"); else - fprintf(htmlout, "<tr><th width=10%%>Usage</th><th width=10%%>Wakeups/s</th><th width=10%%>GPU ops/s</th><th width=10%%>Disk IO/s</th><th width=10%% class=\"process\">Category</th><th class=\"process\">Description</th></tr>\n"); + fprintf(htmlout, "<tr><th width=10%%>Usage</th><th width=10%%>Wakeups/s</th><th width=10%%>GPU ops/s</th><th width=10%%>Disk IO/s</th><th width=10%%>GFX Wakeups/s</th><th width=10%% class=\"process\">Category</th><th class=\"process\">Description</th></tr>\n"); total = all_power.size(); @@ -741,6 +759,7 @@ void html_process_update_display(void) char wakes[20]; char gpus[20]; char disks[20]; + char xwakes[20]; char descr[128]; format_watts(all_power[i]->Witts(), power, 10); @@ -769,6 +788,7 @@ void html_process_update_display(void) sprintf(wakes, "%5.2f", all_power[i]->wake_ups / measurement_time); sprintf(gpus, "%5.1f", all_power[i]->gpu_ops / measurement_time); sprintf(disks, "%5.1f (%5.1f)", all_power[i]->hard_disk_hits / measurement_time, all_power[i]->disk_hits / measurement_time); + sprintf(xwakes, "%5.1f", all_power[i]->xwakes / measurement_time); if (!all_power[i]->show_events()) { wakes[0] = 0; gpus[0] = 0; @@ -781,11 +801,13 @@ void html_process_update_display(void) wakes[0] = 0; if (all_power[i]->disk_hits == 0) disks[0] = 0; + if (all_power[i]->xwakes == 0) + xwakes[0] = 0; if (show_power) - fprintf(htmlout, "<tr class=\"%s\"><td class=\"process_power\">%s</td><td class=\"process_power\">%s</td><td class=\"process_power\">%s</td><td class=\"process_power\">%s</td><td class=\"process_power\">%s</td><td>%s</td><td>%s</td></tr>\n", process_class(lines), power, usage, wakes, gpus, disks, name, pretty_print(all_power[i]->description(), descr, 128)); + fprintf(htmlout, "<tr class=\"%s\"><td class=\"process_power\">%s</td><td class=\"process_power\">%s</td><td class=\"process_power\">%s</td><td class=\"process_power\">%s</td><td class=\"process_power\">%s</td></td><td class=\"process_power\">%s</td><td>%s</td><td>%s</td></tr>\n", process_class(lines), power, usage, wakes, gpus, disks, xwakes, name, pretty_print(all_power[i]->description(), descr, 128)); else - fprintf(htmlout, "<tr class=\"%s\"><td class=\"process_power\">%s</td><td class=\"process_power\">%s</td><td class=\"process_power\">%s</td><td class=\"process_power\">%s</td><td>%s</td><td>%s</td></tr>\n", process_class(lines), usage, wakes, gpus, disks, name, pretty_print(all_power[i]->description(), descr, 128)); + fprintf(htmlout, "<tr class=\"%s\"><td class=\"process_power\">%s</td><td class=\"process_power\">%s</td><td class=\"process_power\">%s</td><td class=\"process_power\">%s</td><td class=\"process_power\">%s</td><td>%s</td><td>%s</td></tr>\n", process_class(lines), usage, wakes, gpus, disks, xwakes, name, pretty_print(all_power[i]->description(), descr, 128)); } fprintf(htmlout, "</table>\n"); } @@ -806,8 +828,8 @@ void html_summary(void) fprintf(htmlout, "<h2>Power consumption summary</h2>\n"); - fprintf(htmlout, "<p>%3.1f wakeups/second, %3.1f GPU ops/second, %3.1f VFS ops/sec and %3.1f%% CPU use</p>", - total_wakeups(), total_gpu_ops(), total_disk_hits(), total_cpu_time()*100); + fprintf(htmlout, "<p>%3.1f wakeups/second, %3.1f GPU ops/second, %3.1f VFS ops/sec, %3.1f GFX wakes/sec and %3.1f%% CPU use</p>", + total_wakeups(), total_gpu_ops(), total_disk_hits(), total_xwakes(), total_cpu_time()*100); fprintf(htmlout, "<table width=100%%>\n"); @@ -931,6 +953,7 @@ void end_process_data(void) report_utilization("gpu-operations", total_gpu_ops()); report_utilization("disk-operations", total_disk_hits()); report_utilization("disk-operations-hard", total_hard_disk_hits()); + report_utilization("xwakes", total_xwakes()); all_power.erase(all_power.begin(), all_power.end()); clear_processes(); diff --git a/process/powerconsumer.cpp b/process/powerconsumer.cpp index 99796d9..5767432 100644 --- a/process/powerconsumer.cpp +++ b/process/powerconsumer.cpp @@ -35,6 +35,7 @@ double power_consumer::Witts(void) double gpucost; double disk_cost; double hard_disk_cost; + double xwake_cost; if (child_runtime > accumulated_runtime) child_runtime = 0; @@ -44,6 +45,7 @@ double power_consumer::Witts(void) gpucost = get_parameter_value("gpu-operations"); disk_cost = get_parameter_value("disk-operations"); hard_disk_cost = get_parameter_value("disk-operations-hard"); + xwake_cost = get_parameter_value("xwakes"); cost = 0; @@ -52,6 +54,7 @@ double power_consumer::Witts(void) cost += gpucost * gpu_ops / 100.0; cost += hard_disk_cost * hard_disk_hits / 100.0; cost += disk_cost * disk_hits / 100.0; + cost += xwake_cost * xwakes / 100.0; cost = cost / measurement_time; @@ -68,6 +71,7 @@ power_consumer::power_consumer(void) wake_ups = 0; gpu_ops = 0; hard_disk_hits = 0; + xwakes = 0; waker = NULL; last_waker = NULL; power_charge = 0.0; diff --git a/process/powerconsumer.h b/process/powerconsumer.h index 2167e12..b0dcee4 100644 --- a/process/powerconsumer.h +++ b/process/powerconsumer.h @@ -44,6 +44,7 @@ public: int wake_ups; int gpu_ops; int hard_disk_hits; /* those which are likely a wakeup of the disk */ + int xwakes; double power_charge; /* power consumed by devices opened by this process */ class power_consumer *waker; diff --git a/process/process.cpp b/process/process.cpp index 4172543..a56551e 100644 --- a/process/process.cpp +++ b/process/process.cpp @@ -183,6 +183,7 @@ static void merge_process(class process *one, class process *two) one->wake_ups += two->wake_ups; one->disk_hits += two->disk_hits; one->hard_disk_hits += two->hard_disk_hits; + one->xwakes += two->xwakes; one->gpu_ops += two->gpu_ops; one->power_charge += two->power_charge; } |