summaryrefslogtreecommitdiffstats
path: root/src/vpp-api/client
diff options
context:
space:
mode:
authorOle Troan <ot@cisco.com>2019-05-16 15:01:34 +0200
committerAndrew Yourtchenko <ayourtch@gmail.com>2019-05-22 09:43:49 +0000
commit233e4681830bc2a9cd40deb4b5909b4e310d1a2a (patch)
tree495c36ffbafdfaf8c85672024e2162ea8ee923ac /src/vpp-api/client
parenta29d18ae6bb7cda3923693a052c3b9208588be8e (diff)
stats: support multiple works for error counters
The current code only allowed access to the main thread error counters. That is not so useful for a multi worker instance. No return a vector indexed by thread of counter_t values. Type: fix Change-Id: Ie322c8889c0c8175e1116e71de04a2cf453b9ed7 Signed-off-by: Ole Troan <ot@cisco.com>
Diffstat (limited to 'src/vpp-api/client')
-rw-r--r--src/vpp-api/client/stat_client.c15
-rw-r--r--src/vpp-api/client/stat_client.h4
2 files changed, 12 insertions, 7 deletions
diff --git a/src/vpp-api/client/stat_client.c b/src/vpp-api/client/stat_client.c
index a386eec30c3..8991806448a 100644
--- a/src/vpp-api/client/stat_client.c
+++ b/src/vpp-api/client/stat_client.c
@@ -231,7 +231,6 @@ copy_data (stat_segment_directory_entry_t * ep, stat_client_main_t * sm)
int i;
vlib_counter_t **combined_c; /* Combined counter */
counter_t **simple_c; /* Simple counter */
- counter_t *error_base;
uint64_t *offset_vector;
assert (sm->shared_header);
@@ -275,10 +274,16 @@ copy_data (stat_segment_directory_entry_t * ep, stat_client_main_t * sm)
break;
case STAT_DIR_TYPE_ERROR_INDEX:
- error_base =
- stat_segment_pointer (sm->shared_header,
- sm->shared_header->error_offset);
- result.error_value = error_base[ep->index];
+ /* Gather errors from all threads into a vector */
+ offset_vector = stat_segment_pointer (sm->shared_header,
+ sm->shared_header->error_offset);
+ vec_validate (result.error_vector, vec_len (offset_vector) - 1);
+ for (i = 0; i < vec_len (offset_vector); i++)
+ {
+ counter_t *cb =
+ stat_segment_pointer (sm->shared_header, offset_vector[i]);
+ result.error_vector[i] = cb[ep->index];
+ }
break;
case STAT_DIR_TYPE_NAME_VECTOR:
diff --git a/src/vpp-api/client/stat_client.h b/src/vpp-api/client/stat_client.h
index 1c76a938b30..901ec325522 100644
--- a/src/vpp-api/client/stat_client.h
+++ b/src/vpp-api/client/stat_client.h
@@ -18,7 +18,7 @@
#define included_stat_client_h
#define STAT_VERSION_MAJOR 1
-#define STAT_VERSION_MINOR 1
+#define STAT_VERSION_MINOR 2
#include <stdint.h>
#include <unistd.h>
@@ -46,7 +46,7 @@ typedef struct
union
{
double scalar_value;
- uint64_t error_value;
+ counter_t *error_vector;
counter_t **simple_counter_vec;
vlib_counter_t **combined_counter_vec;
uint8_t **name_vector;