From: Jerin Jacob Date: Tue, 4 Jul 2017 04:53:15 +0000 (+0530) Subject: app/testeventdev: add perf basic functions X-Git-Tag: spdx-start~2590 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=41c219e6c6d0df3c36464c0910dd43e4137f06f0;p=dpdk.git app/testeventdev: add perf basic functions add functions to create mempool, destroy mempool and print the test result. Signed-off-by: Jerin Jacob Acked-by: Harry van Haaren --- diff --git a/app/test-eventdev/test_perf_common.c b/app/test-eventdev/test_perf_common.c index d95eb62525..a44f2df5c2 100644 --- a/app/test-eventdev/test_perf_common.c +++ b/app/test-eventdev/test_perf_common.c @@ -32,6 +32,59 @@ #include "test_perf_common.h" +int +perf_test_result(struct evt_test *test, struct evt_options *opt) +{ + RTE_SET_USED(opt); + struct test_perf *t = evt_test_priv(test); + + return t->result; +} + +void +perf_eventdev_destroy(struct evt_test *test, struct evt_options *opt) +{ + RTE_SET_USED(test); + + rte_event_dev_stop(opt->dev_id); + rte_event_dev_close(opt->dev_id); +} + +static inline void +perf_elt_init(struct rte_mempool *mp, void *arg __rte_unused, + void *obj, unsigned i __rte_unused) +{ + memset(obj, 0, mp->elt_size); +} + +int +perf_mempool_setup(struct evt_test *test, struct evt_options *opt) +{ + struct test_perf *t = evt_test_priv(test); + + t->pool = rte_mempool_create(test->name, /* mempool name */ + opt->pool_sz, /* number of elements*/ + sizeof(struct perf_elt), /* element size*/ + 512, /* cache size*/ + 0, NULL, NULL, + perf_elt_init, /* obj constructor */ + NULL, opt->socket_id, 0); /* flags */ + if (t->pool == NULL) { + evt_err("failed to create mempool"); + return -ENOMEM; + } + + return 0; +} + +void +perf_mempool_destroy(struct evt_test *test, struct evt_options *opt) +{ + RTE_SET_USED(opt); + struct test_perf *t = evt_test_priv(test); + + rte_mempool_free(t->pool); +} int perf_test_setup(struct evt_test *test, struct evt_options *opt) diff --git a/app/test-eventdev/test_perf_common.h b/app/test-eventdev/test_perf_common.h index ab5c082f5e..442ec99b81 100644 --- a/app/test-eventdev/test_perf_common.h +++ b/app/test-eventdev/test_perf_common.h @@ -82,7 +82,15 @@ struct test_perf { uint8_t sched_type_list[EVT_MAX_STAGES] __rte_cache_aligned; } __rte_cache_aligned; +struct perf_elt { + uint64_t timestamp; +} __rte_cache_aligned; + +int perf_test_result(struct evt_test *test, struct evt_options *opt); int perf_test_setup(struct evt_test *test, struct evt_options *opt); +int perf_mempool_setup(struct evt_test *test, struct evt_options *opt); void perf_test_destroy(struct evt_test *test, struct evt_options *opt); +void perf_eventdev_destroy(struct evt_test *test, struct evt_options *opt); +void perf_mempool_destroy(struct evt_test *test, struct evt_options *opt); #endif /* _TEST_PERF_COMMON_ */