diff options
author | Sameer Nanda <snanda@chromium.org> | 2012-06-19 16:23:33 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rjw@sisk.pl> | 2012-07-01 07:31:22 -0400 |
commit | 4b7760ba0dd3319f66886ab2335a0fbecdbc808a (patch) | |
tree | f619ead7186c286a5f8c786091af8c46de0decf3 /kernel/power | |
parent | 443772d408a25af62498793f6f805ce3c559309a (diff) |
PM / Sleep: add knob for printing device resume times
Added a new knob called /sys/power/pm_print_times. Setting it to 1
enables printing of time taken by devices to suspend and resume.
Setting it to 0 disables this printing (unless overridden by
initcall_debug kernel command line option).
Signed-off-by: Sameer Nanda <snanda@chromium.org>
Acked-by: Greg KH <gregkh@linuxfoundation.org>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Diffstat (limited to 'kernel/power')
-rw-r--r-- | kernel/power/main.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/kernel/power/main.c b/kernel/power/main.c index 428f8a034e96..7beb3fb3670b 100644 --- a/kernel/power/main.c +++ b/kernel/power/main.c | |||
@@ -132,6 +132,38 @@ static ssize_t pm_test_store(struct kobject *kobj, struct kobj_attribute *attr, | |||
132 | } | 132 | } |
133 | 133 | ||
134 | power_attr(pm_test); | 134 | power_attr(pm_test); |
135 | |||
136 | /* | ||
137 | * pm_print_times: print time taken by devices to suspend and resume. | ||
138 | * | ||
139 | * show() returns whether printing of suspend and resume times is enabled. | ||
140 | * store() accepts 0 or 1. 0 disables printing and 1 enables it. | ||
141 | */ | ||
142 | int pm_print_times_enabled; | ||
143 | |||
144 | static ssize_t pm_print_times_show(struct kobject *kobj, | ||
145 | struct kobj_attribute *attr, char *buf) | ||
146 | { | ||
147 | return sprintf(buf, "%d\n", pm_print_times_enabled); | ||
148 | } | ||
149 | |||
150 | static ssize_t pm_print_times_store(struct kobject *kobj, | ||
151 | struct kobj_attribute *attr, | ||
152 | const char *buf, size_t n) | ||
153 | { | ||
154 | unsigned long val; | ||
155 | |||
156 | if (kstrtoul(buf, 10, &val)) | ||
157 | return -EINVAL; | ||
158 | |||
159 | if (val > 1) | ||
160 | return -EINVAL; | ||
161 | |||
162 | pm_print_times_enabled = val; | ||
163 | return n; | ||
164 | } | ||
165 | |||
166 | power_attr(pm_print_times); | ||
135 | #endif /* CONFIG_PM_DEBUG */ | 167 | #endif /* CONFIG_PM_DEBUG */ |
136 | 168 | ||
137 | #ifdef CONFIG_DEBUG_FS | 169 | #ifdef CONFIG_DEBUG_FS |
@@ -530,6 +562,7 @@ static struct attribute * g[] = { | |||
530 | #endif | 562 | #endif |
531 | #ifdef CONFIG_PM_DEBUG | 563 | #ifdef CONFIG_PM_DEBUG |
532 | &pm_test_attr.attr, | 564 | &pm_test_attr.attr, |
565 | &pm_print_times_attr.attr, | ||
533 | #endif | 566 | #endif |
534 | #endif | 567 | #endif |
535 | NULL, | 568 | NULL, |