Index: systrace/atrace_helper/jni/logging.h |
diff --git a/systrace/atrace_helper/jni/logging.h b/systrace/atrace_helper/jni/logging.h |
index 4acaf2c44966fd4f6f6be260dba572af115b260a..11a760cfcc80c6f11c5a08b42cbfa6e8a8a070ca 100644 |
--- a/systrace/atrace_helper/jni/logging.h |
+++ b/systrace/atrace_helper/jni/logging.h |
@@ -6,8 +6,10 @@ |
#define LOGGING_H_ |
#include <android/log.h> |
+#include <errno.h> |
#include <stdio.h> |
#include <stdlib.h> |
+#include <time.h> |
#define CHECK_ARGS(COND, ERR) \ |
"FAILED CHECK(%s) @ %s:%d (errno: %s)\n", #COND, __FILE__, __LINE__, \ |
@@ -31,4 +33,10 @@ inline void LogError(const char* message) { |
fflush(stderr); |
} |
+inline uint64_t GetTimestamp() { |
+ struct timespec ts = {}; |
+ CHECK(clock_gettime(CLOCK_MONOTONIC_COARSE, &ts) == 0); |
+ return ts.tv_sec * 1000 + ts.tv_nsec / 1000000ul; |
+} |
+ |
#endif // LOGGING_H_ |