Add per-thread, per-node runtime stats serialization

Change-Id: Ic4009cdbac67b7cd53c88079439496b9d9dfaa35
Signed-off-by: Dave Barach <dave@barachs.net>
This commit is contained in:
Dave Barach
2016-05-13 12:55:01 -04:00
parent 6f7b992f56
commit 6931f59e54
8 changed files with 321 additions and 63 deletions

View File

@@ -66,11 +66,6 @@ nobase_include_HEADERS += \
vlibsocket/vl_socket_msg_enum.h \
vlibsocket/sockclnt.api.h
noinst_PROGRAMS = sock_test
sock_test_SOURCES = vlibsocket/sock_test.c
sock_test_LDADD =
BUILT_SOURCES = vlibsocket/sockclnt.api.h vlibmemory/memclnt.api.h
SUFFIXES = .api.h .api

View File

@@ -216,7 +216,9 @@ void vl_msg_api_set_first_available_msg_id (u16 first_avail);
u16 vl_msg_api_get_msg_ids (char * name, int n);
/* node_serialize.c prototypes */
u8 * vlib_node_serialize (vlib_node_main_t *nm, u8 * vector);
u8 * vlib_node_serialize (vlib_node_main_t *nm, u8 * vector,
u32 max_threads, int include_nexts,
int include_stats);
vlib_node_t ** vlib_node_unserialize (u8 * vector);
#define VLIB_API_INIT_FUNCTION(x) VLIB_DECLARE_INIT_FUNCTION(x,api_init)

File diff suppressed because it is too large Load Diff

View File

@@ -248,3 +248,6 @@ result:
return rv;
}
void vlib_node_sync_stats (vlib_main_t * vm, vlib_node_t * n)
{ clib_warning ("STUB called..."); }

View File

@@ -314,4 +314,6 @@ u8 **vlib_thread_stacks;
/* Number of thread stacks that the application needs */
u32 vlib_app_num_thread_stacks_needed (void) __attribute__ ((weak));
extern void vlib_node_sync_stats (vlib_main_t * vm, vlib_node_t * n);
#endif /* included_vlib_main_h */

View File

@@ -311,6 +311,8 @@ typedef struct vlib_node_t {
u8 * (* validate_frame) (struct vlib_main_t * vm,
struct vlib_node_runtime_t *,
struct vlib_frame_t * f);
/* for pretty-printing, not typically valid */
u8 * state_string;
} vlib_node_t;
#define VLIB_INVALID_NODE_INDEX ((u32) ~0)

View File

@@ -93,16 +93,20 @@ SUFFIXES = .api.h .api
| vppapigen --input - --output $@ --show-name $@
noinst_PROGRAMS += test_client test_ha
noinst_PROGRAMS += test_client
test_client_SOURCES = api/test_client.c
test_client_LDADD = -lvlibmemoryclient -lvlibapi -lsvm -lvppinfra \
-lpthread -lm -lrt
noinst_PROGRAMS += test_client test_ha
test_ha_SOURCES = api/test_ha.c
test_ha_LDADD = -lvlibmemoryclient -lvlibapi -lsvmdb -lsvm -lvppinfra \
-lpthread -lm -lrt
noinst_PROGRAMS += summary_stats_client
summary_stats_client_SOURCES = api/summary_stats_client.c

View File

@@ -5828,13 +5828,15 @@ static void vl_api_get_node_graph_t_handler
/*
* Keep the number of memcpy ops to a minimum (e.g. 1).
* The current size of the serialized vector is
* slightly under 4K.
*/
vec_validate (vector, 4095);
vec_validate (vector, 16384);
vec_reset_length (vector);
vector = vlib_node_serialize (&vm->node_main, vector);
/* $$$$ FIXME */
vector = vlib_node_serialize (&vm->node_main, vector,
(u32)~0 /* all threads */,
1 /* include nexts */,
1 /* include stats */);
svm_pop_heap (oldheap);
pthread_mutex_unlock (&am->vlib_rp->mutex);
@@ -6178,6 +6180,7 @@ vpe_api_hookup (vlib_main_t *vm)
* Thread-safe API messages
*/
am->is_mp_safe [VL_API_IP_ADD_DEL_ROUTE] = 1;
am->is_mp_safe [VL_API_GET_NODE_GRAPH] = 1;
return 0;
}