+static uword
+stat_segment_collector_process (vlib_main_t * vm, vlib_node_runtime_t * rt,
+ vlib_frame_t * f)
+{
+ stat_segment_main_t *sm = &stat_segment_main;
+
+ /* Wait for Godot... */
+ f64 sleep_duration = 10;
+
+ while (1)
+ {
+ do_stat_segment_updates (sm);
+ vlib_process_suspend (vm, sleep_duration);
+ }
+ return 0; /* or not */
+}
+
+static clib_error_t *
+statseg_init (vlib_main_t * vm)
+{
+ stat_segment_main_t *sm = &stat_segment_main;
+ clib_error_t *error;
+
+ if ((error = vlib_call_init_function (vm, unix_input_init)))
+ return error;
+
+ if (sm->socket_name)
+ stats_segment_socket_init ();
+
+ return 0;
+}
+
+static clib_error_t *
+statseg_config (vlib_main_t * vm, unformat_input_t * input)
+{
+ stat_segment_main_t *sm = &stat_segment_main;
+
+ while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (input, "socket-name %s", &sm->socket_name))
+ ;
+ else if (unformat (input, "default"))
+ sm->socket_name = format (0, "%s", STAT_SEGMENT_SOCKET_FILE);
+ else
+ if (unformat
+ (input, "size %U", unformat_memory_size, &sm->memory_size))
+ ;
+ else if (unformat (input, "per-node-counters on"))
+ sm->node_counters_enabled = 1;
+ else if (unformat (input, "per-node-counters off"))
+ sm->node_counters_enabled = 0;
+ else
+ return clib_error_return (0, "unknown input `%U'",
+ format_unformat_error, input);
+ }
+
+ return 0;
+}
+
+VLIB_INIT_FUNCTION (statseg_init);
+VLIB_EARLY_CONFIG_FUNCTION (statseg_config, "statseg");
+
+/* *INDENT-OFF* */
+VLIB_REGISTER_NODE (stat_segment_collector, static) =
+{
+.function = stat_segment_collector_process,.name =
+ "statseg-collector-process",.type = VLIB_NODE_TYPE_PROCESS,};
+
+/* *INDENT-ON* */