Skip to content

Commit 214f459

Browse files
author
Jeff Brown
committed
Remove no longer needed EventHub usleep() optimization.
This optimization is no longer needed now that the kernel evdev driver's poll() implementation only wakes up the poll after the final sync. Change-Id: If237776861df9cfac3086e744d3bbf3484d4c53b
1 parent 4130554 commit 214f459

File tree

2 files changed

+0
-18
lines changed

2 files changed

+0
-18
lines changed

services/input/EventHub.cpp

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,6 @@ EventHub::EventHub(void) :
156156
mPendingEventCount(0), mPendingEventIndex(0), mPendingINotify(false) {
157157
acquire_wake_lock(PARTIAL_WAKE_LOCK, WAKE_LOCK_ID);
158158

159-
mNumCpus = sysconf(_SC_NPROCESSORS_ONLN);
160-
161159
mEpollFd = epoll_create(EPOLL_SIZE_HINT);
162160
LOG_ALWAYS_FATAL_IF(mEpollFd < 0, "Could not create epoll instance. errno=%d", errno);
163161

@@ -775,19 +773,6 @@ size_t EventHub::getEvents(int timeoutMillis, RawEvent* buffer, size_t bufferSiz
775773
} else {
776774
// Some events occurred.
777775
mPendingEventCount = size_t(pollResult);
778-
779-
// On an SMP system, it is possible for the framework to read input events
780-
// faster than the kernel input device driver can produce a complete packet.
781-
// Because poll() wakes up as soon as the first input event becomes available,
782-
// the framework will often end up reading one event at a time until the
783-
// packet is complete. Instead of one call to read() returning 71 events,
784-
// it could take 71 calls to read() each returning 1 event.
785-
//
786-
// Sleep for a short period of time after waking up from the poll() to give
787-
// the kernel time to finish writing the entire packet of input events.
788-
if (mNumCpus > 1) {
789-
usleep(250);
790-
}
791776
}
792777
}
793778

services/input/EventHub.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -367,9 +367,6 @@ class EventHub : public EventHubInterface
367367
size_t mPendingEventCount;
368368
size_t mPendingEventIndex;
369369
bool mPendingINotify;
370-
371-
// Set to the number of CPUs.
372-
int32_t mNumCpus;
373370
};
374371

375372
}; // namespace android

0 commit comments

Comments
 (0)