From 9e4f290dee7906b89cb78f10ddb061bef909f848 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Sun, 19 Jul 2009 14:10:31 +0200 Subject: [PATCH] audiod: Only call audiod_status_dump twice per second. audiod_status_dump() is quite expensive and is called in a rather hot path. --- audiod.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/audiod.c b/audiod.c index 32c83941..3d0cd648 100644 --- a/audiod.c +++ b/audiod.c @@ -902,8 +902,15 @@ static void command_post_select(struct sched *s, struct task *t) { int ret; struct command_task *ct = container_of(t, struct command_task, task); + static struct timeval last_status_dump; + struct timeval tmp; + + tv_add(&last_status_dump, &(struct timeval){0, 500 * 1000}, &tmp); + if (tv_diff(&tmp, now, NULL) < 0) { + audiod_status_dump(); + last_status_dump = *now; + } - audiod_status_dump(); if (!FD_ISSET(ct->fd, &s->rfds)) return; ret = handle_connect(ct->fd); -- 2.39.5