From fe607e93222ccdc72f29e7a67bd433046d96107e Mon Sep 17 00:00:00 2001 From: Tzafrir Cohen Date: Wed, 20 Jul 2011 16:48:46 +0000 Subject: xpp: rate limit queue overflow messages If the CPU becomes overly busy, merely printing the "Overflow in the recieve_queue" messages becomes CPU-intensive on its own right. Signed-off-by: Tzafrir Cohen git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10052 a0bf4364-ded3-4de4-8d8a-66a801d63aff --- drivers/dahdi/xpp/xframe_queue.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'drivers/dahdi/xpp') diff --git a/drivers/dahdi/xpp/xframe_queue.c b/drivers/dahdi/xpp/xframe_queue.c index d3c3e48..6014961 100644 --- a/drivers/dahdi/xpp/xframe_queue.c +++ b/drivers/dahdi/xpp/xframe_queue.c @@ -48,6 +48,7 @@ static void __xframe_dump_queue(struct xframe_queue *q) static bool __xframe_enqueue(struct xframe_queue *q, xframe_t *xframe) { int ret = 1; + static int overflow_cnt = 0; if(unlikely(q->disabled)) { ret = 0; @@ -55,7 +56,8 @@ static bool __xframe_enqueue(struct xframe_queue *q, xframe_t *xframe) } if(q->count >= q->max_count) { q->overflows++; - NOTICE("Overflow of %-15s: counts %3d, %3d, %3d worst %3d, overflows %3d worst_lag %02ld.%ld ms\n", + if ((overflow_cnt++ % 1000) < 5) { + NOTICE("Overflow of %-15s: counts %3d, %3d, %3d worst %3d, overflows %3d worst_lag %02ld.%ld ms\n", q->name, q->steady_state_count, q->count, @@ -64,7 +66,8 @@ static bool __xframe_enqueue(struct xframe_queue *q, xframe_t *xframe) q->overflows, q->worst_lag_usec / 1000, q->worst_lag_usec % 1000); - __xframe_dump_queue(q); + __xframe_dump_queue(q); + } ret = 0; goto out; } -- cgit v1.2.3