timekeeping: Prints the amounts of time spent during suspend
authorRuchi Kandoi <kandoiruchi@google.com>
Thu, 11 Aug 2016 21:35:01 +0000 (14:35 -0700)
committerJohn Stultz <john.stultz@linaro.org>
Wed, 31 Aug 2016 21:43:34 +0000 (14:43 -0700)
In addition to keeping a histogram of suspend times, also
print out the time spent in suspend to dmesg.

This helps to keep track of suspend time while debugging using
kernel logs.

Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Richard Cochran <richardcochran@gmail.com>
Cc: Prarit Bhargava <prarit@redhat.com>
Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>
[jstultz: Tweaked commit message]
Signed-off-by: John Stultz <john.stultz@linaro.org>
kernel/time/timekeeping_debug.c

index 107310a6f36f43a47300c46a4bd3b51a6b5b70fa..ca9fb800336b2904e4c19069ad8c9e29ea926830 100644 (file)
@@ -75,5 +75,7 @@ void tk_debug_account_sleep_time(struct timespec64 *t)
        int bin = min(fls(t->tv_sec), NUM_BINS-1);
 
        sleep_time_bin[bin]++;
+       pr_info("Suspended for %lld.%03lu seconds\n", (s64)t->tv_sec,
+                       t->tv_nsec / NSEC_PER_MSEC);
 }