1616
1717#define LOG_TAG " EventHub"
1818
19- // #define LOG_NDEBUG 0
19+ #define LOG_NDEBUG 0
2020
2121#include " EventHub.h"
2222
@@ -767,11 +767,7 @@ size_t EventHub::getEvents(int timeoutMillis, RawEvent* buffer, size_t bufferSiz
767767 size_t count = size_t (readSize) / sizeof (struct input_event );
768768 for (size_t i = 0 ; i < count; i++) {
769769 const struct input_event & iev = readBuffer[i];
770- ALOGV (" %s got: t0=%d, t1=%d, type=%d, code=%d, value=%d" ,
771- device->path .string (),
772- (int ) iev.time .tv_sec , (int ) iev.time .tv_usec ,
773- iev.type , iev.code , iev.value );
774-
770+ nsecs_t delta = 0 ;
775771#ifdef HAVE_POSIX_CLOCKS
776772 // Use the time specified in the event instead of the current time
777773 // 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
786782 // system call that also queries ktime_get_ts().
787783 event->when = nsecs_t (iev.time .tv_sec ) * 1000000000LL
788784 + nsecs_t (iev.time .tv_usec ) * 1000LL ;
789- ALOGV (" event time %lld, now %lld" , event->when , now);
785+ delta = now - event->when ;
786+
787+ // Only log verbose if events are older that 1ms
788+ if (delta > 1 * 1000000LL ) {
789+ ALOGV (" event time %lld, now %lld, delta %lldus" , event->when , now, delta / 1000LL );
790+ }
790791#else
791792 event->when = now;
792793#endif
794+ if (delta > 1 * 1000000LL ) {
795+ ALOGV (" %s got: t0=%d, t1=%d, type=%d, code=%d, value=%d" ,
796+ device->path .string (),
797+ (int ) iev.time .tv_sec , (int ) iev.time .tv_usec ,
798+ iev.type , iev.code , iev.value );
799+ }
800+
801+
793802 event->deviceId = deviceId;
794803 event->type = iev.type ;
795804 event->code = iev.code ;
0 commit comments