summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Salyzyn2015-03-03 15:39:37 -0600
committerMark Salyzyn2015-03-18 14:43:23 -0500
commitf7c0f75275d0fde2d8b7614f1501f0ad0cd3a01c (patch)
treec0470bc2f9663bb790dbce92c10d027954959a8f /logd/LogBufferElement.h
parent5aa097c8a7b9326e1add7a23bf4d31febd25127b (diff)
downloadplatform-system-core-f7c0f75275d0fde2d8b7614f1501f0ad0cd3a01c.tar.gz
platform-system-core-f7c0f75275d0fde2d8b7614f1501f0ad0cd3a01c.tar.xz
platform-system-core-f7c0f75275d0fde2d8b7614f1501f0ad0cd3a01c.zip
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 fdca973fe..25f145082 100644
--- a/logd/LogBufferElement.h
+++ b/logd/LogBufferElement.h
@@ -18,6 +18,7 @@
18#define _LOGD_LOG_BUFFER_ELEMENT_H__ 18#define _LOGD_LOG_BUFFER_ELEMENT_H__
19 19
20#include <sys/types.h> 20#include <sys/types.h>
21#include <stdatomic.h>
21#include <sysutils/SocketClient.h> 22#include <sysutils/SocketClient.h>
22#include <log/log.h> 23#include <log/log.h>
23#include <log/log_read.h> 24#include <log/log_read.h>
@@ -29,8 +30,9 @@ class LogBufferElement {
29 const pid_t mTid; 30 const pid_t mTid;
30 char *mMsg; 31 char *mMsg;
31 const unsigned short mMsgLen; 32 const unsigned short mMsgLen;
32 const log_time mMonotonicTime; 33 const uint64_t mSequence;
33 const log_time mRealTime; 34 const log_time mRealTime;
35 static atomic_int_fast64_t sequence;
34 36
35public: 37public:
36 LogBufferElement(log_id_t log_id, log_time realtime, 38 LogBufferElement(log_id_t log_id, log_time realtime,
@@ -43,11 +45,12 @@ public:
43 pid_t getPid(void) const { return mPid; } 45 pid_t getPid(void) const { return mPid; }
44 pid_t getTid(void) const { return mTid; } 46 pid_t getTid(void) const { return mTid; }
45 unsigned short getMsgLen() const { return mMsgLen; } 47 unsigned short getMsgLen() const { return mMsgLen; }
46 log_time getMonotonicTime(void) const { return mMonotonicTime; } 48 uint64_t getSequence(void) const { return mSequence; }
49 static uint64_t getCurrentSequence(void) { return sequence.load(memory_order_relaxed); }
47 log_time getRealTime(void) const { return mRealTime; } 50 log_time getRealTime(void) const { return mRealTime; }
48 51
49 static const log_time FLUSH_ERROR; 52 static const uint64_t FLUSH_ERROR;
50 log_time flushTo(SocketClient *writer); 53 uint64_t flushTo(SocketClient *writer);
51}; 54};
52 55
53#endif 56#endif