summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@google.com>2012-05-31 18:39:02 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-05-31 18:39:02 -0700
commit9e2e781acaead54d0fb095d55a1c44b32563248f (patch)
treee8b2dd30a5c35e371a43be9d527f5f901d9d0f81
parente31564d8eb0ab67e167a888eccce20f5b4e4ef45 (diff)
parent1ea51bf519bdfc0e04daa88b8788f06105c5599b (diff)
downloadnative-9e2e781acaead54d0fb095d55a1c44b32563248f.tar.gz
Merge "Remove unused statistics code." into jb-dev
-rw-r--r--include/utils/Looper.h21
-rw-r--r--libs/utils/Looper.cpp68
2 files changed, 0 insertions, 89 deletions
diff --git a/include/utils/Looper.h b/include/utils/Looper.h
index 3c2905d597..96b971e97d 100644
--- a/include/utils/Looper.h
+++ b/include/utils/Looper.h
@@ -27,9 +27,6 @@
// When defined, uses epoll_wait() for polling, otherwise uses poll().
#define LOOPER_USES_EPOLL
-// When defined, logs performance statistics for tuning and debugging purposes.
-//#define LOOPER_STATISTICS
-
#ifdef LOOPER_USES_EPOLL
#include <sys/epoll.h>
#else
@@ -340,24 +337,6 @@ private:
void wakeAndLock();
#endif
-#ifdef LOOPER_STATISTICS
- static const int SAMPLED_WAKE_CYCLES_TO_AGGREGATE = 100;
- static const int SAMPLED_POLLS_TO_AGGREGATE = 1000;
-
- nsecs_t mPendingWakeTime;
- int mPendingWakeCount;
-
- int mSampledWakeCycles;
- int mSampledWakeCountSum;
- nsecs_t mSampledWakeLatencySum;
-
- int mSampledPolls;
- int mSampledZeroPollCount;
- int mSampledZeroPollLatencySum;
- int mSampledTimeoutPollCount;
- int mSampledTimeoutPollLatencySum;
-#endif
-
// This state is only used privately by pollOnce and does not require a lock since
// it runs on a single thread.
Vector<Response> mResponses;
diff --git a/libs/utils/Looper.cpp b/libs/utils/Looper.cpp
index d1aa664bca..95db28db00 100644
--- a/libs/utils/Looper.cpp
+++ b/libs/utils/Looper.cpp
@@ -98,20 +98,6 @@ Looper::Looper(bool allowNonCallbacks) :
mPolling = false;
mWaiters = 0;
#endif
-
-#ifdef LOOPER_STATISTICS
- mPendingWakeTime = -1;
- mPendingWakeCount = 0;
- mSampledWakeCycles = 0;
- mSampledWakeCountSum = 0;
- mSampledWakeLatencySum = 0;
-
- mSampledPolls = 0;
- mSampledZeroPollCount = 0;
- mSampledZeroPollLatencySum = 0;
- mSampledTimeoutPollCount = 0;
- mSampledTimeoutPollLatencySum = 0;
-#endif
}
Looper::~Looper() {
@@ -234,10 +220,6 @@ int Looper::pollInner(int timeoutMillis) {
mResponses.clear();
mResponseIndex = 0;
-#ifdef LOOPER_STATISTICS
- nsecs_t pollStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
-#endif
-
#ifdef LOOPER_USES_EPOLL
struct epoll_event eventItems[EPOLL_MAX_EVENTS];
int eventCount = epoll_wait(mEpollFd, eventItems, EPOLL_MAX_EVENTS, timeoutMillis);
@@ -341,29 +323,6 @@ Done:
}
#endif
-#ifdef LOOPER_STATISTICS
- nsecs_t pollEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
- mSampledPolls += 1;
- if (timeoutMillis == 0) {
- mSampledZeroPollCount += 1;
- mSampledZeroPollLatencySum += pollEndTime - pollStartTime;
- } else if (timeoutMillis > 0 && result == ALOOPER_POLL_TIMEOUT) {
- mSampledTimeoutPollCount += 1;
- mSampledTimeoutPollLatencySum += pollEndTime - pollStartTime
- - milliseconds_to_nanoseconds(timeoutMillis);
- }
- if (mSampledPolls == SAMPLED_POLLS_TO_AGGREGATE) {
- ALOGD("%p ~ poll latency statistics: %0.3fms zero timeout, %0.3fms non-zero timeout", this,
- 0.000001f * float(mSampledZeroPollLatencySum) / mSampledZeroPollCount,
- 0.000001f * float(mSampledTimeoutPollLatencySum) / mSampledTimeoutPollCount);
- mSampledPolls = 0;
- mSampledZeroPollCount = 0;
- mSampledZeroPollLatencySum = 0;
- mSampledTimeoutPollCount = 0;
- mSampledTimeoutPollLatencySum = 0;
- }
-#endif
-
// Invoke pending message callbacks.
mNextMessageUptime = LLONG_MAX;
while (mMessageEnvelopes.size() != 0) {
@@ -454,13 +413,6 @@ void Looper::wake() {
ALOGD("%p ~ wake", this);
#endif
-#ifdef LOOPER_STATISTICS
- // FIXME: Possible race with awoken() but this code is for testing only and is rarely enabled.
- if (mPendingWakeCount++ == 0) {
- mPendingWakeTime = systemTime(SYSTEM_TIME_MONOTONIC);
- }
-#endif
-
ssize_t nWrite;
do {
nWrite = write(mWakeWritePipeFd, "W", 1);
@@ -478,26 +430,6 @@ void Looper::awoken() {
ALOGD("%p ~ awoken", this);
#endif
-#ifdef LOOPER_STATISTICS
- if (mPendingWakeCount == 0) {
- ALOGD("%p ~ awoken: spurious!", this);
- } else {
- mSampledWakeCycles += 1;
- mSampledWakeCountSum += mPendingWakeCount;
- mSampledWakeLatencySum += systemTime(SYSTEM_TIME_MONOTONIC) - mPendingWakeTime;
- mPendingWakeCount = 0;
- mPendingWakeTime = -1;
- if (mSampledWakeCycles == SAMPLED_WAKE_CYCLES_TO_AGGREGATE) {
- ALOGD("%p ~ wake statistics: %0.3fms wake latency, %0.3f wakes per cycle", this,
- 0.000001f * float(mSampledWakeLatencySum) / mSampledWakeCycles,
- float(mSampledWakeCountSum) / mSampledWakeCycles);
- mSampledWakeCycles = 0;
- mSampledWakeCountSum = 0;
- mSampledWakeLatencySum = 0;
- }
- }
-#endif
-
char buffer[16];
ssize_t nRead;
do {