summaryrefslogtreecommitdiffstats
path: root/vnet/vnet/devices/dpdk/threads.c
diff options
context:
space:
mode:
authorBud Grise <griseb@cisco.com>2016-03-30 15:54:58 -0400
committerDave Barach <openvpp@barachs.net>2016-04-28 14:04:15 +0000
commite0ef46b7c0d7a1d1b0078450d73470b6e6a812bf (patch)
treef008f35999ae4fb22a0cc918c2cf562adff153a6 /vnet/vnet/devices/dpdk/threads.c
parente6749e4f6b8d5df52495e0c6802c05505bb50b62 (diff)
Add histogram to frame queue tracing
Display it via "show frame histogram" CLI. Change-Id: I436a2125f391af85d1743cf8765e5f27fa0ca809 Signed-off-by: Todd Foggoa (tfoggoa) <tfoggoa@cisco.com>
Diffstat (limited to 'vnet/vnet/devices/dpdk/threads.c')
-rw-r--r--vnet/vnet/devices/dpdk/threads.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/vnet/vnet/devices/dpdk/threads.c b/vnet/vnet/devices/dpdk/threads.c
index eeb440e2851..d8fb698e66b 100644
--- a/vnet/vnet/devices/dpdk/threads.c
+++ b/vnet/vnet/devices/dpdk/threads.c
@@ -35,9 +35,6 @@
#include <vlibmemory/vl_memory_api_h.h>
#undef vl_printfun
-vlib_thread_main_t vlib_thread_main;
-
-frame_queue_trace_t *frame_queue_traces;
/*
* Check the frame queue to see if any frames are available.
@@ -65,19 +62,27 @@ static inline int vlib_frame_queue_dequeue_internal (vlib_main_t *vm)
if (PREDICT_FALSE(fq->trace))
{
frame_queue_trace_t *fqt;
+ frame_queue_nelt_counter_t *fqh;
u32 elix;
- fqt = &frame_queue_traces[thread_id];
+ fqt = &dpdk_main.frame_queue_traces[thread_id];
+
fqt->nelts = fq->nelts;
fqt->head = fq->head;
fqt->head_hint = fq->head_hint;
fqt->tail = fq->tail;
fqt->threshold = fq->vector_threshold;
fqt->n_in_use = fqt->tail - fqt->head;
- if (fqt->n_in_use > fqt->nelts){
- fqt->n_in_use = 0;
+ if (fqt->n_in_use >= fqt->nelts){
+ // if beyond max then use max
+ fqt->n_in_use = fqt->nelts-1;
}
+ /* Record the number of elements in use in the histogram */
+ fqh = &dpdk_main.frame_queue_histogram[thread_id];
+ fqh->count[ fqt->n_in_use ]++;
+
+ /* Record a snapshot of the elements in use */
for (elix=0; elix<fqt->nelts; elix++) {
elt = fq->elts + ((fq->head+1 + elix) & (fq->nelts-1));
if (1 || elt->valid)