aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2018-07-05 11:48:20 -0400
committerDave Barach <dave@barachs.net>2018-07-05 11:49:00 -0400
commit01a771b12198b3f07d67a4bc73650c1f65257708 (patch)
treed53265b82083fe53c311b9e31f9344fd0f1b8a00 /src
parent0fa56788f71d570ce585027e2acdf19e82e6d433 (diff)
add stat segment size configuration
Change-Id: I395ff9c91d670a9f9e50dc1b030e0412b7234de5 Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'src')
-rw-r--r--src/vpp/stats/stat_segment.c26
-rw-r--r--src/vpp/stats/stats.h4
2 files changed, 29 insertions, 1 deletions
diff --git a/src/vpp/stats/stat_segment.c b/src/vpp/stats/stat_segment.c
index 08f1d309f50..72333746fbd 100644
--- a/src/vpp/stats/stat_segment.c
+++ b/src/vpp/stats/stat_segment.c
@@ -198,8 +198,13 @@ vlib_map_stat_segment_init (void)
void *oldheap;
u32 *lock;
int rv;
+ u64 memory_size;
- ssvmp->ssvm_size = 32 << 20; /*$$$$$ CONFIG PARAM */
+ memory_size = sm->memory_size;
+ if (memory_size == 0)
+ memory_size = STAT_SEGMENT_DEFAULT_SIZE;
+
+ ssvmp->ssvm_size = memory_size;
ssvmp->i_am_master = 1;
ssvmp->my_pid = getpid ();
ssvmp->name = format (0, "/stats%c", 0);
@@ -508,6 +513,25 @@ do_stat_segment_updates (stats_main_t * sm)
update_serialized_nodes (sm);
}
+static clib_error_t *
+statseg_config (vlib_main_t * vm, unformat_input_t * input)
+{
+ stats_main_t *sm = &stats_main;
+ uword ms;
+
+ while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (input, "size %U", unformat_memory_size, &sm->memory_size))
+ ;
+ else
+ return clib_error_return (0, "unknown input `%U'",
+ format_unformat_error, input);
+ }
+
+ return 0;
+}
+
+VLIB_EARLY_CONFIG_FUNCTION (statseg_config, "statseg");
/*
* fd.io coding-style-patch-verification: ON
diff --git a/src/vpp/stats/stats.h b/src/vpp/stats/stats.h
index 3b6f781eee3..bb4cbebe035 100644
--- a/src/vpp/stats/stats.h
+++ b/src/vpp/stats/stats.h
@@ -167,6 +167,7 @@ typedef struct
clib_spinlock_t *stat_segment_lockp;
clib_socket_t *socket;
u8 *socket_name;
+ uword memory_size;
/* Pointers to scalar stats maintained by the stat thread */
f64 *input_rate_ptr;
@@ -195,6 +196,9 @@ typedef struct
extern stats_main_t stats_main;
+/* Default stat segment 32m */
+#define STAT_SEGMENT_DEFAULT_SIZE (32<<20)
+
#define STAT_SEGMENT_OPAQUE_LOCK 0
#define STAT_SEGMENT_OPAQUE_DIR 1
#define STAT_SEGMENT_OPAQUE_EPOCH 2