summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
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