diff options
-rw-r--r-- | src/libinput-private.h | 2 | ||||
-rw-r--r-- | src/timer.c | 12 |
2 files changed, 10 insertions, 4 deletions
diff --git a/src/libinput-private.h b/src/libinput-private.h index 051e828b..6ff81a33 100644 --- a/src/libinput-private.h +++ b/src/libinput-private.h @@ -136,6 +136,8 @@ struct libinput { struct libinput_source *source; int fd; uint64_t next_expiry; + + struct ratelimit expiry_in_past_limit; } timer; struct libinput_event **events; diff --git a/src/timer.c b/src/timer.c index 22d7a962..e1d8dd60 100644 --- a/src/timer.c +++ b/src/timer.c @@ -43,6 +43,9 @@ libinput_timer_init(struct libinput_timer *timer, timer->timer_name = safe_strdup(timer_name); timer->timer_func = timer_func; timer->timer_func_data = timer_func_data; + /* at most 5 "expiry in the past" log messages per hour */ + ratelimit_init(&libinput->timer.expiry_in_past_limit, + s2us(60 * 60), 5); } void @@ -92,10 +95,11 @@ libinput_timer_set_flags(struct libinput_timer *timer, uint64_t now = libinput_now(timer->libinput); if (expire < now) { if ((flags & TIMER_FLAG_ALLOW_NEGATIVE) == 0) - log_bug_client(timer->libinput, - "timer %s: scheduled expiry is in the past (-%dms), your system is too slow\n", - timer->timer_name, - us2ms(now - expire)); + log_bug_client_ratelimit(timer->libinput, + &timer->libinput->timer.expiry_in_past_limit, + "timer %s: scheduled expiry is in the past (-%dms), your system is too slow\n", + timer->timer_name, + us2ms(now - expire)); } else if ((expire - now) > ms2us(5000)) { log_bug_libinput(timer->libinput, "timer %s: offset more than 5s, now %d expire %d\n", |