diff options
author | arjan <arjan@arjan-desktop.localdomain> | 2010-09-10 05:27:09 -0700 |
---|---|---|
committer | arjan <arjan@arjan-desktop.localdomain> | 2010-09-10 05:27:09 -0700 |
commit | 92afb9be34cdbcc1a41be3d3c67bc0eb7d508225 (patch) | |
tree | ced8e1ab6a5477cf710670f7ec141bb1699c9b86 /process | |
parent | 4b4b3128b7eb4612599cd88cf28172bd51d07164 (diff) | |
download | powertop-92afb9be34cdbcc1a41be3d3c67bc0eb7d508225.tar.gz |
add i915 gpu operations parameter for catching games and such
Diffstat (limited to 'process')
-rw-r--r-- | process/do_process.cpp | 25 | ||||
-rw-r--r-- | process/powerconsumer.cpp | 3 | ||||
-rw-r--r-- | process/powerconsumer.h | 3 | ||||
-rw-r--r-- | process/process.cpp | 4 |
4 files changed, 31 insertions, 4 deletions
diff --git a/process/do_process.cpp b/process/do_process.cpp index 7414c44..cc178ec 100644 --- a/process/do_process.cpp +++ b/process/do_process.cpp @@ -397,6 +397,13 @@ void perf_process_bundle::handle_trace_point(int type, void *trace, int cpu, uin if (strcmp(event_name, "power:power_end") == 0) { consume_blame(cpu); } + if (strcmp(event_name, "i915:i915_gem_request_submit") == 0) { + class power_consumer *consumer; + consumer = current_consumer(cpu); + if (consumer) { + consumer->gpu_ops++; + } + } } void start_process_measurement(void) @@ -417,6 +424,7 @@ void start_process_measurement(void) perf_events->add_event("power:power_end"); perf_events->add_event("workqueue:workqueue_execute_start"); perf_events->add_event("workqueue:workqueue_execute_end"); + perf_events->add_event("i915:i915_gem_request_submit"); } first_stamp = ~0ULL; @@ -484,7 +492,7 @@ void process_process_data(void) } -int total_wakeups(void) +double total_wakeups(void) { double total = 0; unsigned int i; @@ -497,6 +505,20 @@ int total_wakeups(void) return total; } +double total_gpu_ops(void) +{ + double total = 0; + unsigned int i; + for (i = 0; i < all_power.size() ; i++) + total += all_power[i]->gpu_ops; + + + total = total / measurement_time; + + + return total; +} + double total_cpu_time(void) { unsigned int i; @@ -521,6 +543,7 @@ void end_process_data(void) report_utilization("cpu-consumption", total_cpu_time()); report_utilization("cpu-wakeups", total_wakeups()); + report_utilization("gpu-operations", total_gpu_ops()); /* clean out old data */ for (i = 0; i < all_processes.size() ; i++) diff --git a/process/powerconsumer.cpp b/process/powerconsumer.cpp index 24bdf02..a93efef 100644 --- a/process/powerconsumer.cpp +++ b/process/powerconsumer.cpp @@ -8,15 +8,18 @@ double power_consumer::Witts(void) double cost; double timecost; double wakeupcost; + double gpucost; if (child_runtime > accumulated_runtime) child_runtime = 0; timecost = get_parameter_value("cpu-consumption"); wakeupcost = get_parameter_value("cpu-wakeups"); + gpucost = get_parameter_value("gpu-operations"); cost = wakeupcost * wake_ups / 10000.0; cost += ( (accumulated_runtime - child_runtime) / 1000000000.0 * timecost); + cost += gpucost * gpu_ops / 100.0; cost = cost / measurement_time; diff --git a/process/powerconsumer.h b/process/powerconsumer.h index 1fa2008..6e6176f 100644 --- a/process/powerconsumer.h +++ b/process/powerconsumer.h @@ -30,8 +30,9 @@ public: extern vector <class power_consumer *> all_power; -extern int total_wakeups(void); +extern double total_wakeups(void); extern double total_cpu_time(void); +extern double total_gpu_ops(void); diff --git a/process/process.cpp b/process/process.cpp index 6d4f5ac..c172b40 100644 --- a/process/process.cpp +++ b/process/process.cpp @@ -56,9 +56,9 @@ const char * process::description(void) if (child_runtime > accumulated_runtime) child_runtime = 0; - sprintf(desc, "Process %22s time %5.2fms wakeups %4.1f (child %5.1fms)", + sprintf(desc, "Process %22s time %5.2fms wakeups %4.1f gpu ops %4.1f (child %5.1fms)", comm, (accumulated_runtime - child_runtime) / 1000000.0 / measurement_time, wake_ups / measurement_time, - child_runtime / 1000000.0); + gpu_ops / measurement_time, child_runtime / 1000000.0); return desc; } |