diff options
author | Drew Richardson <drew.richardson@arm.com> | 2014-08-19 08:44:27 -0700 |
---|---|---|
committer | Jon Medhurst <tixy@linaro.org> | 2014-08-20 16:13:32 +0100 |
commit | 054396633cc1b29723e87328385a44ddbcb65796 (patch) | |
tree | 4ae0a5595c71965a0e069049f481a900dceb0ed3 | |
parent | 11fdd761e4a0ca4b56ccc859c5f17a6177c56722 (diff) |
gator: Use get_monotonic_boottime to get uptimetracking-gator-llct-20140829.0
In Linux 3.17-rc1, monotonic_to_bootbased was removed. Since Linux
3.11, uptime_proc_show in fs/proc/uptime.c has used
get_monotonic_boottime to get uptime. Mirror the logic of
uptime_proc_show.
Signed-off-by: Drew Richardson <drew.richardson@arm.com>
Signed-off-by: Jon Medhurst <tixy@linaro.org>
-rw-r--r-- | drivers/gator/gator_main.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/drivers/gator/gator_main.c b/drivers/gator/gator_main.c index 0d867f22364f..284120319ffd 100644 --- a/drivers/gator/gator_main.c +++ b/drivers/gator/gator_main.c @@ -812,19 +812,26 @@ static void gator_summary(void) u64 timestamp, uptime; struct timespec ts; char uname_buf[512]; - void (*m2b)(struct timespec *ts); snprintf(uname_buf, sizeof(uname_buf), "%s %s %s %s %s GNU/Linux", utsname()->sysname, utsname()->nodename, utsname()->release, utsname()->version, utsname()->machine); getnstimeofday(&ts); timestamp = timespec_to_ns(&ts); - do_posix_clock_monotonic_gettime(&ts); - // monotonic_to_bootbased is not defined for some versions of Android - m2b = symbol_get(monotonic_to_bootbased); - if (m2b) { - m2b(&ts); + // Similar to reading /proc/uptime from fs/proc/uptime.c, calculate uptime +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0) + { + void (*m2b)(struct timespec *ts); + do_posix_clock_monotonic_gettime(&ts); + // monotonic_to_bootbased is not defined for some versions of Android + m2b = symbol_get(monotonic_to_bootbased); + if (m2b) { + m2b(&ts); + } } +#else + get_monotonic_boottime(&ts); +#endif uptime = timespec_to_ns(&ts); // Disable preemption as gator_get_time calls smp_processor_id to verify time is monotonic |