diff options
author | 2022-04-06 21:16:37 +0200 | |
---|---|---|
committer | 2022-04-08 15:53:10 +0000 | |
commit | d5045e68a782d484e3f0e54edb4a88dc3dfac291 (patch) | |
tree | f0cf5627b672050e4463d1dee4ea952a066c12d6 /src/vppinfra/vector/test/ip_csum.c | |
parent | dfc43164078b481e39dc0a87e8e358cc6a56d14e (diff) |
vppinfra: introduce clib_perfmom
Type: improvement
Change-Id: I85a90774eb313020435c9bc2297c1bdf23d52efc
Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vppinfra/vector/test/ip_csum.c')
-rw-r--r-- | src/vppinfra/vector/test/ip_csum.c | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/src/vppinfra/vector/test/ip_csum.c b/src/vppinfra/vector/test/ip_csum.c index cb33c036120..17a606523f2 100644 --- a/src/vppinfra/vector/test/ip_csum.c +++ b/src/vppinfra/vector/test/ip_csum.c @@ -115,48 +115,48 @@ done: } void __test_perf_fn -perftest_ip4_hdr (int fd, test_perf_t *tp) +perftest_ip4_hdr (test_perf_t *tp) { u32 n = tp->n_ops; u8 *data = test_mem_alloc_and_splat (20, n, (void *) &test1); u16 *res = test_mem_alloc (n * sizeof (u16)); - test_perf_event_enable (fd); + test_perf_event_enable (tp); for (int i = 0; i < n; i++) res[i] = clib_ip_csum (data + i * 20, 20); - test_perf_event_disable (fd); + test_perf_event_disable (tp); test_mem_free (data); test_mem_free (res); } void __test_perf_fn -perftest_tcp_payload (int fd, test_perf_t *tp) +perftest_tcp_payload (test_perf_t *tp) { u32 n = tp->n_ops; volatile uword *lenp = &tp->arg0; u8 *data = test_mem_alloc_and_splat (20, n, (void *) &test1); u16 *res = test_mem_alloc (n * sizeof (u16)); - test_perf_event_enable (fd); + test_perf_event_enable (tp); for (int i = 0; i < n; i++) res[i] = clib_ip_csum (data + i * lenp[0], lenp[0]); - test_perf_event_disable (fd); + test_perf_event_disable (tp); test_mem_free (data); test_mem_free (res); } void __test_perf_fn -perftest_byte (int fd, test_perf_t *tp) +perftest_byte (test_perf_t *tp) { volatile uword *np = &tp->n_ops; u8 *data = test_mem_alloc_and_fill_inc_u8 (*np, 0, 0); u16 *res = test_mem_alloc (sizeof (u16)); - test_perf_event_enable (fd); + test_perf_event_enable (tp); res[0] = clib_ip_csum (data, np[0]); - test_perf_event_disable (fd); + test_perf_event_disable (tp); test_mem_free (data); test_mem_free (res); @@ -166,16 +166,14 @@ REGISTER_TEST (clib_ip_csum) = { .name = "clib_ip_csum", .fn = test_clib_ip_csum, .perf_tests = PERF_TESTS ( - { .name = "ip4_hdr", - .op_name = "IP4Hdr", + { .name = "fixed size (per IPv4 Header)", .n_ops = 1024, .fn = perftest_ip4_hdr }, - { .name = "tcp_paylaad", - .op_name = "1460Byte", + { .name = "fixed size (per 1460 byte block)", .n_ops = 16, .arg0 = 1460, .fn = perftest_tcp_payload }, - { .name = "byte", .op_name = "Byte", .n_ops = 16384, .fn = perftest_byte } + { .name = "variable size (per byte)", .n_ops = 16384, .fn = perftest_byte } ), }; |