summaryrefslogtreecommitdiffstats
path: root/libutils/SystemClock.cpp
diff options
context:
space:
mode:
authorBen Cheng <bccheng@google.com>2013-09-24 15:44:12 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2013-09-24 15:44:12 -0700
commitbcea352d2ce59c98414d15cb38f16d4c1abe2b72 (patch)
tree238ee4efc12e0931c1bac133f9b53847fdde194f /libutils/SystemClock.cpp
parentb5ffadedd48a3e9a5e302925a87eeec47ac00dbe (diff)
parentd38cc182dbfce4a1d7e8e9c16bff10b71128cc01 (diff)
downloadsystem_core-bcea352d2ce59c98414d15cb38f16d4c1abe2b72.zip
system_core-bcea352d2ce59c98414d15cb38f16d4c1abe2b72.tar.gz
system_core-bcea352d2ce59c98414d15cb38f16d4c1abe2b72.tar.bz2
am d38cc182: Merge "Disable timestamp logging." into klp-dev
* commit 'd38cc182dbfce4a1d7e8e9c16bff10b71128cc01': Disable timestamp logging.
Diffstat (limited to 'libutils/SystemClock.cpp')
-rw-r--r--libutils/SystemClock.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/libutils/SystemClock.cpp b/libutils/SystemClock.cpp
index 4b74889..ac8da88 100644
--- a/libutils/SystemClock.cpp
+++ b/libutils/SystemClock.cpp
@@ -61,12 +61,20 @@ int64_t elapsedRealtime()
#define METHOD_IOCTL 1
#define METHOD_SYSTEMTIME 2
+/*
+ * To debug/verify the timestamps returned by the kernel, change
+ * DEBUG_TIMESTAMP to 1 and call the timestamp routine from a single thread
+ * in the test program. b/10899829
+ */
+#define DEBUG_TIMESTAMP 0
+
static const char *gettime_method_names[] = {
"clock_gettime",
"ioctl",
"systemTime",
};
+#if DEBUG_TIMESTAMP
static inline void checkTimeStamps(int64_t timestamp,
int64_t volatile *prevTimestampPtr,
int volatile *prevMethodPtr,
@@ -93,6 +101,9 @@ static inline void checkTimeStamps(int64_t timestamp,
*prevMethodPtr = curMethod;
#endif
}
+#else
+#define checkTimeStamps(timestamp, prevTimestampPtr, prevMethodPtr, curMethod)
+#endif
/*
* native public static long elapsedRealtimeNano();
@@ -103,8 +114,10 @@ int64_t elapsedRealtimeNano()
struct timespec ts;
int result;
int64_t timestamp;
+#if DEBUG_TIMESTAMP
static volatile int64_t prevTimestamp;
static volatile int prevMethod;
+#endif
#if 0
/*