diff options
author | arjan <arjan@arjan-desktop.localdomain> | 2010-09-03 21:58:25 -0700 |
---|---|---|
committer | arjan <arjan@arjan-desktop.localdomain> | 2010-09-03 21:58:25 -0700 |
commit | e9ab070988db9692f2b29073f2224f21157e48f1 (patch) | |
tree | 30d8cd4e549cfebe52a2d865ac7dd5986e261d26 /cpu | |
parent | c0e7228177af056a216f73b1be5a47d7b643bf39 (diff) | |
download | powertop-e9ab070988db9692f2b29073f2224f21157e48f1.tar.gz |
use cpu consumption and wakeups as measure instead; that way we can directly account power to processes
and it also converges much more nicely (far fewer parameters to fit)
Diffstat (limited to 'cpu')
-rw-r--r-- | cpu/cpudevice.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/cpu/cpudevice.cpp b/cpu/cpudevice.cpp index 0efc84e..03e35d2 100644 --- a/cpu/cpudevice.cpp +++ b/cpu/cpudevice.cpp @@ -15,9 +15,24 @@ cpudevice::cpudevice(const char *classname, const char *device_name, class abstr double cpudevice::power_usage(struct result_bundle *result, struct parameter_bundle *bundle) { - double power = 0; unsigned int i, j; + double power; + double factor; + double utilization; + + power = 0; + factor = get_parameter_value("cpu-wakeups", bundle); + utilization = get_result_value("cpu-wakeups", result); + + power += utilization * factor / 1000.0; + + factor = get_parameter_value("cpu-consumption", bundle); + utilization = get_result_value("cpu-consumption", result); + + power += utilization * factor / 100.0; + + return power; } |