diff options
| author | 2012-05-08 16:38:33 -0700 | |
|---|---|---|
| committer | 2012-05-08 16:38:33 -0700 | |
| commit | df0a89daa8018f9dec53d8d766e5a045347ffc93 (patch) | |
| tree | 3e67728f90e7790314fae581581c0db89a6fd4bd /services/input/EventHub.cpp | |
| parent | 29bb27ef90564a294d506c2ffd546ba21788aeac (diff) | |
services: input events: enable debugging in EventHub (touch screen issues)
Enable verbose logging, but limit the output of events to only those that
are stale by more than 1ms.
This does not overly pollute the logcat output.
Bug: 6258051
Change-Id: I32012a379ca0e97c0834975482cd91f9eeb08907
Diffstat (limited to 'services/input/EventHub.cpp')
| -rw-r--r-- | services/input/EventHub.cpp | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/services/input/EventHub.cpp b/services/input/EventHub.cpp index f80ac18450ca..50bfee60b05e 100644 --- a/services/input/EventHub.cpp +++ b/services/input/EventHub.cpp @@ -16,7 +16,7 @@ #define LOG_TAG "EventHub" -// #define LOG_NDEBUG 0 +#define LOG_NDEBUG 0 #include "EventHub.h" @@ -767,11 +767,7 @@ size_t EventHub::getEvents(int timeoutMillis, RawEvent* buffer, size_t bufferSiz size_t count = size_t(readSize) / sizeof(struct input_event); for (size_t i = 0; i < count; i++) { const struct input_event& iev = readBuffer[i]; - ALOGV("%s got: t0=%d, t1=%d, type=%d, code=%d, value=%d", - device->path.string(), - (int) iev.time.tv_sec, (int) iev.time.tv_usec, - iev.type, iev.code, iev.value); - + nsecs_t delta = 0; #ifdef HAVE_POSIX_CLOCKS // Use the time specified in the event instead of the current time // so that downstream code can get more accurate estimates of @@ -786,10 +782,23 @@ size_t EventHub::getEvents(int timeoutMillis, RawEvent* buffer, size_t bufferSiz // system call that also queries ktime_get_ts(). event->when = nsecs_t(iev.time.tv_sec) * 1000000000LL + nsecs_t(iev.time.tv_usec) * 1000LL; - ALOGV("event time %lld, now %lld", event->when, now); + delta = now - event->when; + + // Only log verbose if events are older that 1ms + if (delta > 1 * 1000000LL) { + ALOGV("event time %lld, now %lld, delta %lldus", event->when, now, delta / 1000LL); + } #else event->when = now; #endif + if (delta > 1 * 1000000LL) { + ALOGV("%s got: t0=%d, t1=%d, type=%d, code=%d, value=%d", + device->path.string(), + (int) iev.time.tv_sec, (int) iev.time.tv_usec, + iev.type, iev.code, iev.value); + } + + event->deviceId = deviceId; event->type = iev.type; event->code = iev.code; |