diff options
author | Arjan van de Ven <arjan@infradead.org> | 2009-12-13 14:29:01 -0500 |
---|---|---|
committer | Rafael J. Wysocki <rjw@sisk.pl> | 2009-12-15 14:42:06 -0500 |
commit | f2511774863487e61b56a97da07ebf8dd61d7836 (patch) | |
tree | 892a238299f4e69e120b037310623e4bae5b690f /drivers/base | |
parent | 1d531c14d2ed4b24472a4d773f00ed6d1cd34ee7 (diff) |
PM: Add initcall_debug style timing for suspend/resume
In order to diagnose overall suspend/resume times, we need
basic instrumentation to break down the total time into per
device timing, similar to initcall_debug.
This patch adds the basic timing instrumentation, needed
for a scritps/bootgraph.pl equivalent or humans.
The bootgraph.pl program is still a work in progress, but
is far enough along to know that this patch is sufficient.
Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Diffstat (limited to 'drivers/base')
-rw-r--r-- | drivers/base/power/main.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index 8aa2443182d..30f0ceebd36 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/resume-trace.h> | 25 | #include <linux/resume-trace.h> |
26 | #include <linux/rwsem.h> | 26 | #include <linux/rwsem.h> |
27 | #include <linux/interrupt.h> | 27 | #include <linux/interrupt.h> |
28 | #include <linux/sched.h> | ||
28 | 29 | ||
29 | #include "../base.h" | 30 | #include "../base.h" |
30 | #include "power.h" | 31 | #include "power.h" |
@@ -172,6 +173,13 @@ static int pm_op(struct device *dev, | |||
172 | pm_message_t state) | 173 | pm_message_t state) |
173 | { | 174 | { |
174 | int error = 0; | 175 | int error = 0; |
176 | ktime_t calltime, delta, rettime; | ||
177 | |||
178 | if (initcall_debug) { | ||
179 | pr_info("calling %s+ @ %i\n", | ||
180 | dev_name(dev), task_pid_nr(current)); | ||
181 | calltime = ktime_get(); | ||
182 | } | ||
175 | 183 | ||
176 | switch (state.event) { | 184 | switch (state.event) { |
177 | #ifdef CONFIG_SUSPEND | 185 | #ifdef CONFIG_SUSPEND |
@@ -219,6 +227,14 @@ static int pm_op(struct device *dev, | |||
219 | default: | 227 | default: |
220 | error = -EINVAL; | 228 | error = -EINVAL; |
221 | } | 229 | } |
230 | |||
231 | if (initcall_debug) { | ||
232 | rettime = ktime_get(); | ||
233 | delta = ktime_sub(rettime, calltime); | ||
234 | pr_info("call %s+ returned %d after %Ld usecs\n", dev_name(dev), | ||
235 | error, (unsigned long long)ktime_to_ns(delta) >> 10); | ||
236 | } | ||
237 | |||
222 | return error; | 238 | return error; |
223 | } | 239 | } |
224 | 240 | ||
@@ -236,6 +252,13 @@ static int pm_noirq_op(struct device *dev, | |||
236 | pm_message_t state) | 252 | pm_message_t state) |
237 | { | 253 | { |
238 | int error = 0; | 254 | int error = 0; |
255 | ktime_t calltime, delta, rettime; | ||
256 | |||
257 | if (initcall_debug) { | ||
258 | pr_info("calling %s_i+ @ %i\n", | ||
259 | dev_name(dev), task_pid_nr(current)); | ||
260 | calltime = ktime_get(); | ||
261 | } | ||
239 | 262 | ||
240 | switch (state.event) { | 263 | switch (state.event) { |
241 | #ifdef CONFIG_SUSPEND | 264 | #ifdef CONFIG_SUSPEND |
@@ -283,6 +306,14 @@ static int pm_noirq_op(struct device *dev, | |||
283 | default: | 306 | default: |
284 | error = -EINVAL; | 307 | error = -EINVAL; |
285 | } | 308 | } |
309 | |||
310 | if (initcall_debug) { | ||
311 | rettime = ktime_get(); | ||
312 | delta = ktime_sub(rettime, calltime); | ||
313 | printk("initcall %s_i+ returned %d after %Ld usecs\n", dev_name(dev), | ||
314 | error, (unsigned long long)ktime_to_ns(delta) >> 10); | ||
315 | } | ||
316 | |||
286 | return error; | 317 | return error; |
287 | } | 318 | } |
288 | 319 | ||