summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTzafrir Cohen <tzafrir.cohen@xorcom.com>2011-07-20 16:48:46 +0000
committerTzafrir Cohen <tzafrir.cohen@xorcom.com>2011-07-20 16:48:46 +0000
commitfe607e93222ccdc72f29e7a67bd433046d96107e (patch)
treefed292b8d26ec0f3805131fb6f6f08c4639b9b31
parentd9802d526d7c51f24af4a519297afc7053ae4711 (diff)
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 <tzafrir.cohen@xorcom.com> git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10052 a0bf4364-ded3-4de4-8d8a-66a801d63aff
-rw-r--r--drivers/dahdi/xpp/xframe_queue.c7
1 files changed, 5 insertions, 2 deletions
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;
}