summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDrew Richardson <drew.richardson@arm.com>2014-08-19 08:44:27 -0700
committerJon Medhurst <tixy@linaro.org>2014-09-08 12:51:44 +0100
commit1492b89e21f6d0471f60c50e544c201bcebcfaef (patch)
tree8c0d993a96cf533ec2d40a4dcbf7f8bf0e6925c9
parentcc5ade47ae1decfdd7ca6d599b9a3eb7c6f8c7af (diff)
gator: Use get_monotonic_boottime to get uptimetracking-gator-llct-20140910.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.c19
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