diff options
author | Arjan van de Ven <arjan@linux.intel.com> | 2010-07-18 20:01:06 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rjw@sisk.pl> | 2010-07-18 20:01:06 -0400 |
commit | 8d4b9d1bfef117862a2889dec4dac227068544c9 (patch) | |
tree | a17f69a64b97759452988047058666ae51f70304 /include/linux/pm.h | |
parent | 0fcb4eef8294492c8f1de8236b1ed81f09e42922 (diff) |
PM / Runtime: Add runtime PM statistics (v3)
In order for PowerTOP to be able to report how well the new runtime PM is
working for the various drivers, the kernel needs to export some basic
statistics in sysfs.
This patch adds two sysfs files in the runtime PM domain that expose the
total time a device has been active, and the time a device has been
suspended.
With this PowerTOP can compute the activity percentage
Active %age = 100 * (delta active) / (delta active + delta suspended)
and present the information to the user.
I've written the PowerTOP code (slated for version 1.12) already, and the
output looks like this:
Runtime Device Power Management statistics
Active Device name
10.0% 06:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8101E/RTL8102E PCI Express Fast Ethernet controller
[version 2: fix stat update bugs noticed by Alan Stern]
[version 3: rebase to -next and move the sysfs declaration]
Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Diffstat (limited to 'include/linux/pm.h')
-rw-r--r-- | include/linux/pm.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/linux/pm.h b/include/linux/pm.h index b417fc46f3fc..52e8c55ff314 100644 --- a/include/linux/pm.h +++ b/include/linux/pm.h | |||
@@ -477,9 +477,15 @@ struct dev_pm_info { | |||
477 | enum rpm_request request; | 477 | enum rpm_request request; |
478 | enum rpm_status runtime_status; | 478 | enum rpm_status runtime_status; |
479 | int runtime_error; | 479 | int runtime_error; |
480 | unsigned long active_jiffies; | ||
481 | unsigned long suspended_jiffies; | ||
482 | unsigned long accounting_timestamp; | ||
480 | #endif | 483 | #endif |
481 | }; | 484 | }; |
482 | 485 | ||
486 | extern void update_pm_runtime_accounting(struct device *dev); | ||
487 | |||
488 | |||
483 | /* | 489 | /* |
484 | * The PM_EVENT_ messages are also used by drivers implementing the legacy | 490 | * The PM_EVENT_ messages are also used by drivers implementing the legacy |
485 | * suspend framework, based on the ->suspend() and ->resume() callbacks common | 491 | * suspend framework, based on the ->suspend() and ->resume() callbacks common |