diff options
author | Ole Troan <ot@cisco.com> | 2018-06-04 22:27:49 +0200 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2018-06-05 14:30:01 +0000 |
commit | 73710c7da2f8deaea83dbbbfce8737c9c6cd2949 (patch) | |
tree | 7d9cc75fe38de525a5b78634317e94b83880534a /src/vpp-api/client/test.c | |
parent | 0b061112f73fda45084671120411a6484d9c11d2 (diff) |
VPP API: Memory trace
if you plan to put a hash into shared memory, the key sum and key
equal functions MUST be set to constants such as KEY_FUNC_STRING,
KEY_FUNC_MEM, etc. -lvppinfra is PIC, which means that the process
which set up the hash won't have the same idea where the key sum and
key compare functions live in other processes.
Change-Id: Ib3b5963a0d2fb467b91e1f16274df66ac74009e9
Signed-off-by: Ole Troan <ot@cisco.com>
Signed-off-by: Dave Barach <dave@barachs.net>
Signed-off-by: Ole Troan <ot@cisco.com>
Diffstat (limited to 'src/vpp-api/client/test.c')
-rw-r--r-- | src/vpp-api/client/test.c | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/src/vpp-api/client/test.c b/src/vpp-api/client/test.c index c1b3808a5f5..8061fe58fb6 100644 --- a/src/vpp-api/client/test.c +++ b/src/vpp-api/client/test.c @@ -70,20 +70,34 @@ wrap_vac_callback (unsigned char *data, int len) result_msg_id = ntohs(*((u16 *)data)); } -int main (int argc, char ** argv) +static void +test_connect () +{ + static int i; + int rv = vac_connect("vac_client", NULL, wrap_vac_callback, 32 /* rx queue-length*/); + if (rv != 0) { + printf("Connect failed: %d\n", rv); + exit(rv); + } + printf("."); + vac_disconnect(); + i++; +} + +static void +test_messages (void) { api_main_t * am = &api_main; vl_api_show_version_t message; vl_api_show_version_t *mp; int async = 1; - int rv = vac_connect("vac_client", NULL, wrap_vac_callback, 32 /* rx queue-length*/); + int rv = vac_connect("vac_client", NULL, wrap_vac_callback, 32 /* rx queue-length*/); if (rv != 0) { printf("Connect failed: %d\n", rv); exit(rv); } - - struct timeb timer_msec; + struct timeb timer_msec; long long int timestamp_msec_start; /* timestamp in millisecond. */ if (!ftime(&timer_msec)) { timestamp_msec_start = ((long long int) timer_msec.time) * 1000ll + @@ -135,5 +149,15 @@ int main (int argc, char ** argv) no_msgs/(timestamp_msec_end - timestamp_msec_start)); printf("Exiting...\n"); vac_disconnect(); +} + +int main (int argc, char ** argv) +{ + int i; + + for (i = 0; i < 1000; i++) { + test_connect(); + } + test_messages(); exit (0); } |