]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
audiod: Only call audiod_status_dump twice per second.
authorAndre Noll <maan@systemlinux.org>
Sun, 19 Jul 2009 12:10:31 +0000 (14:10 +0200)
committerAndre Noll <maan@systemlinux.org>
Sun, 19 Jul 2009 12:10:31 +0000 (14:10 +0200)
audiod_status_dump() is quite expensive and is called in a rather hot path.

audiod.c

index 32c839411b138406ab4bb760f8b8b9b873c1305d..3d0cd6483173cd75f571cb9669f297be4954afea 100644 (file)
--- 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);