summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Salyzyn2015-09-08 10:56:32 -0500
committerMark Salyzyn2015-11-03 17:15:51 -0600
commitb6bee33182cedea49199eb2252b3f3b442899c6d (patch)
tree332e29183f3b901929e48ff4da8f81452abbdc40 /logd/LogKlog.h
parentff2e26b239e931236c9acecdc2a22d540b3e0c3d (diff)
downloadplatform-system-core-b6bee33182cedea49199eb2252b3f3b442899c6d.tar.gz
platform-system-core-b6bee33182cedea49199eb2252b3f3b442899c6d.tar.xz
platform-system-core-b6bee33182cedea49199eb2252b3f3b442899c6d.zip
liblog: logd: support logd.timestamp = monotonic
if ro.logd.timestamp or persist.logd.timestamp are set to the value monotonic then liblog writer, liblog printing and logd all switch to recording/printing monotonic time rather than realtime. If reinit detects a change for presist.logd.timestamp, correct the older entry timestamps in place. ToDo: A corner case condition where new log entries in monotonic time occur before logd reinit detects persist.logd.timestamp, there will be a few out-of-order entries, but with accurate timestamps. This problem does not happen for ro.logd.timestamp as it is set before logd starts. NB: This offers a nano second time accuracy on all log entries that may be more suitable for merging with other system activities, such as systrace, that also use monotonic time. This feature is for debugging. Bug: 23668800 Change-Id: Iee6dab7140061b1a6627254921411f61b01aa5c2
Diffstat (limited to 'logd/LogKlog.h')
-rw-r--r--logd/LogKlog.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/logd/LogKlog.h b/logd/LogKlog.h
index 469affdd0..3c8cc8789 100644
--- a/logd/LogKlog.h
+++ b/logd/LogKlog.h
@@ -43,7 +43,9 @@ public:
43 int log(const char *buf, size_t len); 43 int log(const char *buf, size_t len);
44 void synchronize(const char *buf, size_t len); 44 void synchronize(const char *buf, size_t len);
45 45
46 bool isMonotonic() { return logbuf->isMonotonic(); }
46 static void convertMonotonicToReal(log_time &real) { real += correction; } 47 static void convertMonotonicToReal(log_time &real) { real += correction; }
48 static void convertRealToMonotonic(log_time &real) { real -= correction; }
47 49
48protected: 50protected:
49 void sniffTime(log_time &now, const char **buf, size_t len, bool reverse); 51 void sniffTime(log_time &now, const char **buf, size_t len, bool reverse);