diff options
author | Jeff Brown <jeffbrown@google.com> | 2011-03-18 18:14:26 -0700 |
---|---|---|
committer | Jeff Brown <jeffbrown@android.com> | 2011-05-24 15:21:21 -0700 |
commit | dbf8d27f4c32e20e132e90ad713c6ebaf71d7756 (patch) | |
tree | a7dbe3db8501916c9b564c12bd997b59335c9182 /services/input/tests | |
parent | 68d6075b4ad2205c10064c78cde552e3210cca91 (diff) | |
download | frameworks_base-dbf8d27f4c32e20e132e90ad713c6ebaf71d7756.zip frameworks_base-dbf8d27f4c32e20e132e90ad713c6ebaf71d7756.tar.gz frameworks_base-dbf8d27f4c32e20e132e90ad713c6ebaf71d7756.tar.bz2 |
Optimize EventHub to process events in big chunks. (DO NOT MERGE)
When 10 fingers are down, reduces the CPU time spent by the InputReader
thread from ~30% to ~5% on Stingray.
Change-Id: I42ee5c67b8521af715cbab43e763a4af4eb1f914
Diffstat (limited to 'services/input/tests')
-rw-r--r-- | services/input/tests/InputReader_test.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/services/input/tests/InputReader_test.cpp b/services/input/tests/InputReader_test.cpp index 4d92207..60549c6 100644 --- a/services/input/tests/InputReader_test.cpp +++ b/services/input/tests/InputReader_test.cpp @@ -622,14 +622,14 @@ private: mExcludedDevices.add(String8(deviceName)); } - virtual bool getEvent(int timeoutMillis, RawEvent* outEvent) { + virtual size_t getEvents(int timeoutMillis, RawEvent* buffer, size_t bufferSize) { if (mEvents.empty()) { - return false; + return 0; } - *outEvent = *mEvents.begin(); + *buffer = *mEvents.begin(); mEvents.erase(mEvents.begin()); - return true; + return 1; } virtual int32_t getScanCodeState(int32_t deviceId, int32_t scanCode) const { @@ -1445,7 +1445,7 @@ TEST_F(InputDeviceTest, WhenMappersAreRegistered_DeviceIsNotIgnoredAndForwardsRe // Event handling. RawEvent event; - mDevice->process(&event); + mDevice->process(&event, 1); ASSERT_NO_FATAL_FAILURE(mapper1->assertProcessWasCalled()); ASSERT_NO_FATAL_FAILURE(mapper2->assertProcessWasCalled()); |