Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(533)

Unified Diff: systrace/atrace_helper/jni/logging.h

Issue 2946033002: Android systrace: Optimize memory dumps. (Closed)
Patch Set: for review Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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_

Powered by Google App Engine
This is Rietveld 408576698