diff options
author | Mark Salyzyn <salyzyn@google.com> | 2014-02-19 17:18:31 -0800 |
---|---|---|
committer | Mark Salyzyn <salyzyn@google.com> | 2014-04-01 14:38:52 -0700 |
commit | e457b74ce6ee6d799812dc2ec5e4b8b18bcd3e91 (patch) | |
tree | f2f1021bbaa11127e41ed3b3189634428612f81c /logd/LogBuffer.cpp | |
parent | 5da2dbbc935356f526cdfb0b522b332fc8b95fc7 (diff) | |
download | system_core-e457b74ce6ee6d799812dc2ec5e4b8b18bcd3e91.zip system_core-e457b74ce6ee6d799812dc2ec5e4b8b18bcd3e91.tar.gz system_core-e457b74ce6ee6d799812dc2ec5e4b8b18bcd3e91.tar.bz2 |
logd: Add minimum time bucket statistics
* Only enabled for dev builds because halves performance.
- Used to establish if /proc/sys/net/unix/max_dgram_qlen
is appropriate for the platform
(see logd/LogStatistics.cpp comments)
- enabled if logd.dgram_qlen.statistics is not zero/empty
Change-Id: Ib8ecfeb75b6f0f954c099a6b1032b8afb5efcbd4
Diffstat (limited to 'logd/LogBuffer.cpp')
-rw-r--r-- | logd/LogBuffer.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/logd/LogBuffer.cpp b/logd/LogBuffer.cpp index 1c5cef0..aa44264 100644 --- a/logd/LogBuffer.cpp +++ b/logd/LogBuffer.cpp @@ -37,11 +37,11 @@ LogBuffer::LogBuffer(LastLogTimes *times) : mTimes(*times) { pthread_mutex_init(&mLogElementsLock, NULL); -#ifdef USERDEBUG_BUILD + dgram_qlen_statistics = false; + log_id_for_each(i) { mMaxSize[i] = LOG_BUFFER_SIZE; } -#endif } void LogBuffer::log(log_id_t log_id, log_time realtime, @@ -61,6 +61,23 @@ void LogBuffer::log(log_id_t log_id, log_time realtime, LogBufferElementCollection::iterator last = it; while (--it != mLogElements.begin()) { if ((*it)->getRealTime() <= realtime) { + // halves the peak performance, use with caution + if (dgram_qlen_statistics) { + LogBufferElementCollection::iterator ib = it; + unsigned short buckets, num = 1; + for (unsigned short i = 0; (buckets = stats.dgram_qlen(i)); ++i) { + buckets -= num; + num += buckets; + while (buckets && (--ib != mLogElements.begin())) { + --buckets; + } + if (buckets) { + break; + } + stats.recordDiff( + elem->getRealTime() - (*ib)->getRealTime(), i); + } + } break; } last = it; |