#include #include #include #include #include #include int main(int argc, char *argv[]) { struct input_event ev; double unow = 0, old_unow = 0; int fd; if (argc != 2) { printf("Usage: %s \n", argv[0]); return 1; } fd = open(argv[1], O_RDONLY); if (fd < 0) { printf("Cannot open %s.\n", argv[1]); return 2; } while (read(fd, &ev, sizeof(struct input_event)) == sizeof(struct input_event)) { if (ev.type != EV_SYN) continue; unow = ev.time.tv_sec + ev.time.tv_usec/1000000.0; if (unow - old_unow < 0.001) { struct timeval tm; gettimeofday(&tm, NULL); printf("[%5lu.%06lu] Premature timer expiry.\n", tm.tv_sec, tm.tv_usec); } old_unow = unow; } return 0; }