summaryrefslogtreecommitdiffstats
path: root/logd/LogBufferElement.h
diff options
context:
space:
mode:
authorMark Salyzyn <salyzyn@google.com>2015-03-03 13:39:37 -0800
committerMark Salyzyn <salyzyn@google.com>2015-03-18 12:43:23 -0700
commitf7c0f75275d0fde2d8b7614f1501f0ad0cd3a01c (patch)
treec0470bc2f9663bb790dbce92c10d027954959a8f /logd/LogBufferElement.h
parent5aa097c8a7b9326e1add7a23bf4d31febd25127b (diff)
downloadsystem_core-f7c0f75275d0fde2d8b7614f1501f0ad0cd3a01c.zip
system_core-f7c0f75275d0fde2d8b7614f1501f0ad0cd3a01c.tar.gz
system_core-f7c0f75275d0fde2d8b7614f1501f0ad0cd3a01c.tar.bz2
logd: replace internal CLOCK_MONOTONIC use with sequence numbers
- switch to simpler and faster internal sequence number, drops a syscall overhead on 32-bit platforms. - add ability to break-out of flushTo loop with filter return -1 allowing in reduction in reader overhead. Change-Id: Ic5cb2b9afa4d9470153971fc9197b07279e2b79d
Diffstat (limited to 'logd/LogBufferElement.h')
-rw-r--r--logd/LogBufferElement.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/logd/LogBufferElement.h b/logd/LogBufferElement.h
index fdca973..25f1450 100644
--- a/logd/LogBufferElement.h
+++ b/logd/LogBufferElement.h
@@ -18,6 +18,7 @@
#define _LOGD_LOG_BUFFER_ELEMENT_H__
#include <sys/types.h>
+#include <stdatomic.h>
#include <sysutils/SocketClient.h>
#include <log/log.h>
#include <log/log_read.h>
@@ -29,8 +30,9 @@ class LogBufferElement {
const pid_t mTid;
char *mMsg;
const unsigned short mMsgLen;
- const log_time mMonotonicTime;
+ const uint64_t mSequence;
const log_time mRealTime;
+ static atomic_int_fast64_t sequence;
public:
LogBufferElement(log_id_t log_id, log_time realtime,
@@ -43,11 +45,12 @@ public:
pid_t getPid(void) const { return mPid; }
pid_t getTid(void) const { return mTid; }
unsigned short getMsgLen() const { return mMsgLen; }
- log_time getMonotonicTime(void) const { return mMonotonicTime; }
+ uint64_t getSequence(void) const { return mSequence; }
+ static uint64_t getCurrentSequence(void) { return sequence.load(memory_order_relaxed); }
log_time getRealTime(void) const { return mRealTime; }
- static const log_time FLUSH_ERROR;
- log_time flushTo(SocketClient *writer);
+ static const uint64_t FLUSH_ERROR;
+ uint64_t flushTo(SocketClient *writer);
};
#endif