aboutsummaryrefslogtreecommitdiffstats
path: root/src/vpp/stats/stat_segment.h
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2019-08-14 09:35:41 -0400
committerNeale Ranns <nranns@cisco.com>2019-08-15 10:14:52 +0000
commit531969ef614bdc15c45dae0f1b5e90afaf86eb7b (patch)
tree69141710a458ec3a486a83b5fbaadb590001a93a /src/vpp/stats/stat_segment.h
parent9094b5c319d3f072d3c248fe7c876e4048c13ac2 (diff)
stats: refactor header files
Performant stat segment scraping involves caching the results of stat_segment_ls (...) and directly fishing counter data from the shared-memory segment. To do that, we need to publish several things previously hidden, declared in stat_client.c: o stat_client_main_t typedef o stat_segment_access_t typedef o stat_segment_access_start inline function o stat_segment_access_end inline function Type: refactor Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I3175e3d1f1fd8ea816336a584565179d1972115c
Diffstat (limited to 'src/vpp/stats/stat_segment.h')
-rw-r--r--src/vpp/stats/stat_segment.h34
1 files changed, 1 insertions, 33 deletions
diff --git a/src/vpp/stats/stat_segment.h b/src/vpp/stats/stat_segment.h
index a67c59feed5..5c55cf94ff9 100644
--- a/src/vpp/stats/stat_segment.h
+++ b/src/vpp/stats/stat_segment.h
@@ -16,10 +16,9 @@
#ifndef included_stat_segment_h
#define included_stat_segment_h
-#include <stdatomic.h>
#include <vlib/vlib.h>
#include <vppinfra/socket.h>
-#include <vpp-api/client/stat_client.h>
+#include <vpp/stats/stat_segment_shared.h>
typedef enum
{
@@ -59,49 +58,18 @@ typedef enum
_(MEM_STATSEG_TOTAL, SCALAR_INDEX, total, /mem/statseg) \
_(MEM_STATSEG_USED, SCALAR_INDEX, used, /mem/statseg)
-typedef struct
-{
- stat_directory_type_t type;
- union {
- uint64_t offset;
- uint64_t index;
- uint64_t value;
- };
- uint64_t offset_vector;
- char name[128]; // TODO change this to pointer to "somewhere"
-} stat_segment_directory_entry_t;
-
/* Default stat segment 32m */
#define STAT_SEGMENT_DEFAULT_SIZE (32<<20)
/* Shared segment memory layout version */
#define STAT_SEGMENT_VERSION 1
-/*
- * Shared header first in the shared memory segment.
- */
-typedef struct
-{
- u64 version;
- atomic_int_fast64_t epoch;
- atomic_int_fast64_t in_progress;
- atomic_int_fast64_t directory_offset;
- atomic_int_fast64_t error_offset;
- atomic_int_fast64_t stats_offset;
-} stat_segment_shared_header_t;
-
static inline uint64_t
stat_segment_offset (void *start, void *data)
{
return (char *) data - (char *) start;
}
-static inline void *
-stat_segment_pointer (void *start, uint64_t offset)
-{
- return ((char *) start + offset);
-}
-
typedef void (*stat_segment_update_fn)(stat_segment_directory_entry_t * e, u32 i);
typedef struct {