From 0b89f72e883d972661bc142e7b02e079e784d123 Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Tue, 23 Jan 2018 14:46:51 +0100 Subject: [PATCH] MINOR: spoa_example: Count the number of frames processed by each worker This is done for debug purpose. This way, it is easy to know if the load is equally distributed between workers. --- contrib/spoa_example/spoa.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/contrib/spoa_example/spoa.c b/contrib/spoa_example/spoa.c index d8defd192a..026f25680f 100644 --- a/contrib/spoa_example/spoa.c +++ b/contrib/spoa_example/spoa.c @@ -150,6 +150,7 @@ struct worker { struct list clients; struct list frames; + unsigned int nbframes; }; @@ -1287,7 +1288,7 @@ worker_monitor_cb(evutil_socket_t fd, short events, void *arg) { struct worker *worker = arg; - LOG(worker, "%u clients connected", worker->nbclients); + LOG(worker, "%u clients connected (%u frames)", worker->nbclients, worker->nbframes); } static void @@ -1330,7 +1331,7 @@ process_frame_cb(evutil_socket_t fd, short events, void *arg) goto stop_processing; if (spoe_decode_data(&p, end, &data, &type) == -1) goto skip_message; - + frame->worker->nbframes++; if (type == SPOE_DATA_T_IPV4) check_ipv4_reputation(frame, &data.ipv4); if (type == SPOE_DATA_T_IPV6) @@ -1819,6 +1820,7 @@ main(int argc, char **argv) w->id = i+1; w->nbclients = 0; + w->nbframes = 0; LIST_INIT(&w->engines); LIST_INIT(&w->clients); LIST_INIT(&w->frames);