mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-07 15:33:56 +00:00
lib, zebra: Add a bit of code to look at fifo
When in a dev build add a bit of code to track max depth of a fifo and to allow zebra to report on it. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
parent
34fa087036
commit
03ed85a6c0
13
lib/stream.c
13
lib/stream.c
@ -1109,6 +1109,10 @@ struct stream_fifo *stream_fifo_new(void)
|
|||||||
/* Add new stream to fifo. */
|
/* Add new stream to fifo. */
|
||||||
void stream_fifo_push(struct stream_fifo *fifo, struct stream *s)
|
void stream_fifo_push(struct stream_fifo *fifo, struct stream *s)
|
||||||
{
|
{
|
||||||
|
#if defined DEV_BUILD
|
||||||
|
size_t max, curmax;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (fifo->tail)
|
if (fifo->tail)
|
||||||
fifo->tail->next = s;
|
fifo->tail->next = s;
|
||||||
else
|
else
|
||||||
@ -1116,8 +1120,15 @@ void stream_fifo_push(struct stream_fifo *fifo, struct stream *s)
|
|||||||
|
|
||||||
fifo->tail = s;
|
fifo->tail = s;
|
||||||
fifo->tail->next = NULL;
|
fifo->tail->next = NULL;
|
||||||
|
#if !defined DEV_BUILD
|
||||||
atomic_fetch_add_explicit(&fifo->count, 1, memory_order_release);
|
atomic_fetch_add_explicit(&fifo->count, 1, memory_order_release);
|
||||||
|
#else
|
||||||
|
max = atomic_fetch_add_explicit(&fifo->count, 1, memory_order_release);
|
||||||
|
curmax = atomic_load_explicit(&fifo->max_count, memory_order_relaxed);
|
||||||
|
if (max > curmax)
|
||||||
|
atomic_store_explicit(&fifo->max_count, max,
|
||||||
|
memory_order_relaxed);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void stream_fifo_push_safe(struct stream_fifo *fifo, struct stream *s)
|
void stream_fifo_push_safe(struct stream_fifo *fifo, struct stream *s)
|
||||||
|
@ -115,6 +115,9 @@ struct stream_fifo {
|
|||||||
|
|
||||||
/* number of streams in this fifo */
|
/* number of streams in this fifo */
|
||||||
_Atomic size_t count;
|
_Atomic size_t count;
|
||||||
|
#if defined DEV_BUILD
|
||||||
|
_Atomic size_t max_count;
|
||||||
|
#endif
|
||||||
|
|
||||||
struct stream *head;
|
struct stream *head;
|
||||||
struct stream *tail;
|
struct stream *tail;
|
||||||
|
@ -939,6 +939,11 @@ static void zebra_show_client_detail(struct vty *vty, struct zserv *client)
|
|||||||
vty_out(vty, "MAC-IP add notifications: %d\n", client->macipadd_cnt);
|
vty_out(vty, "MAC-IP add notifications: %d\n", client->macipadd_cnt);
|
||||||
vty_out(vty, "MAC-IP delete notifications: %d\n", client->macipdel_cnt);
|
vty_out(vty, "MAC-IP delete notifications: %d\n", client->macipdel_cnt);
|
||||||
|
|
||||||
|
#if defined DEV_BUILD
|
||||||
|
vty_out(vty, "Input Fifo: %zu:%zu Output Fifo: %zu:%zu\n",
|
||||||
|
client->ibuf_fifo->count, client->ibuf_fifo->max_count,
|
||||||
|
client->obuf_fifo->count, client->obuf_fifo->max_count);
|
||||||
|
#endif
|
||||||
vty_out(vty, "\n");
|
vty_out(vty, "\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user