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
This commit is contained in:
Tzafrir Cohen 2011-07-20 16:48:46 +00:00
parent dd270a3fdc
commit 6308ee5f7a

View File

@ -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,6 +56,7 @@ static bool __xframe_enqueue(struct xframe_queue *q, xframe_t *xframe)
}
if(q->count >= q->max_count) {
q->overflows++;
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,
@ -65,6 +67,7 @@ static bool __xframe_enqueue(struct xframe_queue *q, xframe_t *xframe)
q->worst_lag_usec / 1000,
q->worst_lag_usec % 1000);
__xframe_dump_queue(q);
}
ret = 0;
goto out;
}