X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=app%2Ftest-compress-perf%2Fmain.c;h=6b56dd6809ed6d3831a895ac8a3a6bed587c5cb6;hb=1a714d200966430029065e4d3d33bc737a1e0c4b;hp=3a3da4c90a00b68fd7e7afd8e65ea7933b11a9cc;hpb=424dd6c8c1a86fbc73c3e8f739bafa0324640ca8;p=dpdk.git diff --git a/app/test-compress-perf/main.c b/app/test-compress-perf/main.c index 3a3da4c90a..6b56dd6809 100644 --- a/app/test-compress-perf/main.c +++ b/app/test-compress-perf/main.c @@ -2,12 +2,18 @@ * Copyright(c) 2018 Intel Corporation */ +#include +#include +#include + #include #include #include #include #include "comp_perf_options.h" +#include "comp_perf_test_verify.h" +#include "comp_perf_test_benchmark.h" #include "comp_perf.h" #include "comp_perf_test_common.h" @@ -15,7 +21,7 @@ #define NUM_MAX_INFLIGHT_OPS 512 __extension__ -const char *cperf_test_type_strs[] = { +const char *comp_perf_test_type_strs[] = { [CPERF_TEST_TYPE_BENCHMARK] = "benchmark", [CPERF_TEST_TYPE_VERIFY] = "verify" }; @@ -34,6 +40,8 @@ static const struct cperf_test cperf_testmap[] = { } }; +static struct comp_test_data *test_data; + static int comp_perf_check_capabilities(struct comp_test_data *test_data, uint8_t cdev_id) { @@ -119,9 +127,13 @@ comp_perf_initialize_compressdev(struct comp_test_data *test_data, * if there are more available than cores. */ if (enabled_cdev_count > nb_lcores) { + if (nb_lcores == 0) { + RTE_LOG(ERR, USER1, "Cannot run with 0 cores! Increase the number of cores\n"); + return -EINVAL; + } enabled_cdev_count = nb_lcores; RTE_LOG(INFO, USER1, - " There's more available devices than cores!" + "There's more available devices than cores!" " The number of devices has been aligned to %d cores\n", nb_lcores); } @@ -275,12 +287,24 @@ end: return ret; } +static void +comp_perf_cleanup_on_signal(int signalNumber __rte_unused) +{ + test_data->perf_comp_force_stop = 1; +} + +static void +comp_perf_register_cleanup_on_signal(void) +{ + signal(SIGTERM, comp_perf_cleanup_on_signal); + signal(SIGINT, comp_perf_cleanup_on_signal); +} + int main(int argc, char **argv) { uint8_t level_idx = 0; int ret, i; - struct comp_test_data *test_data; void *ctx[RTE_MAX_LCORE] = {}; uint8_t enabled_cdevs[RTE_COMPRESS_MAX_DEVS]; int nb_compressdevs = 0; @@ -302,6 +326,8 @@ main(int argc, char **argv) rte_exit(EXIT_FAILURE, "Cannot reserve memory in socket %d\n", rte_socket_id()); + comp_perf_register_cleanup_on_signal(); + ret = EXIT_SUCCESS; test_data->cleanup = ST_TEST_DATA; comp_perf_options_default(test_data); @@ -341,7 +367,7 @@ main(int argc, char **argv) printf("App uses socket: %u\n", rte_socket_id()); printf("Burst size = %u\n", test_data->burst_sz); - printf("File size = %zu\n", test_data->input_data_sz); + printf("Input data size = %zu\n", test_data->input_data_sz); test_data->cleanup = ST_DURING_TEST; total_nb_qps = nb_compressdevs * test_data->nb_qps; @@ -368,6 +394,8 @@ main(int argc, char **argv) i++; } + print_test_dynamics(); /* constructors must be executed first */ + while (test_data->level <= test_data->level_lst.max) { i = 0; @@ -422,8 +450,10 @@ end: /* fallthrough */ case ST_COMPDEV: for (i = 0; i < nb_compressdevs && - i < RTE_COMPRESS_MAX_DEVS; i++) + i < RTE_COMPRESS_MAX_DEVS; i++) { rte_compressdev_stop(enabled_cdevs[i]); + rte_compressdev_close(enabled_cdevs[i]); + } /* fallthrough */ case ST_TEST_DATA: rte_free(test_data);