Skip to content

Commit

Permalink
test/compress: add cycle-count mode to perf tool
Browse files Browse the repository at this point in the history
This commit adds cycle-count mode to the compression perf tool.
The new mode enhances the compression performance tool to allow
cycle-count measurement of both hardware and softwate PMDs.

Signed-off-by: Artur Trybula <arturx.trybula@intel.com>
Acked-by: Fiona Trahe <fiona.trahe@intel.com>
  • Loading branch information
ArturTrybulaIntel authored and akhilnxp committed Feb 5, 2020
1 parent 94b686e commit 2695db9
Show file tree
Hide file tree
Showing 13 changed files with 755 additions and 47 deletions.
3 changes: 2 additions & 1 deletion app/test-compress-perf/Makefile
Expand Up @@ -13,7 +13,8 @@ CFLAGS += -O3
SRCS-y := main.c
SRCS-y += comp_perf_options_parse.c
SRCS-y += comp_perf_test_verify.c
SRCS-y += comp_perf_test_benchmark.c
SRCS-y += comp_perf_test_throughput.c
SRCS-y += comp_perf_test_cyclecount.c
SRCS-y += comp_perf_test_common.c

include $(RTE_SDK)/mk/rte.app.mk
6 changes: 3 additions & 3 deletions app/test-compress-perf/comp_perf.h
Expand Up @@ -26,15 +26,15 @@ struct cperf_test {
/* Needed for weak functions*/

void *
cperf_benchmark_test_constructor(uint8_t dev_id __rte_unused,
cperf_throughput_test_constructor(uint8_t dev_id __rte_unused,
uint16_t qp_id __rte_unused,
struct comp_test_data *options __rte_unused);

void
cperf_benchmark_test_destructor(void *arg __rte_unused);
cperf_throughput_test_destructor(void *arg __rte_unused);

int
cperf_benchmark_test_runner(void *test_ctx __rte_unused);
cperf_throughput_test_runner(void *test_ctx __rte_unused);

void *
cperf_verify_test_constructor(uint8_t dev_id __rte_unused,
Expand Down
7 changes: 5 additions & 2 deletions app/test-compress-perf/comp_perf_options.h
Expand Up @@ -24,8 +24,9 @@ enum cleanup_st {
};

enum cperf_test_type {
CPERF_TEST_TYPE_BENCHMARK,
CPERF_TEST_TYPE_VERIFY
CPERF_TEST_TYPE_THROUGHPUT,
CPERF_TEST_TYPE_VERIFY,
CPERF_TEST_TYPE_PMDCC
};

enum comp_operation {
Expand Down Expand Up @@ -68,6 +69,8 @@ struct comp_test_data {
double ratio;
enum cleanup_st cleanup;
int perf_comp_force_stop;

uint32_t cyclecount_delay;
};

int
Expand Down
35 changes: 29 additions & 6 deletions app/test-compress-perf/comp_perf_options_parse.c
Expand Up @@ -30,6 +30,9 @@
#define CPERF_WINDOW_SIZE ("window-sz")
#define CPERF_EXTERNAL_MBUFS ("external-mbufs")

/* cyclecount-specific options */
#define CPERF_CYCLECOUNT_DELAY_US ("cc-delay-us")

struct name_id_map {
const char *name;
uint32_t id;
Expand All @@ -39,7 +42,7 @@ static void
usage(char *progname)
{
printf("%s [EAL options] --\n"
" --ptest benchmark / verify :"
" --ptest throughput / verify / pmd-cyclecount\n"
" --driver-name NAME: compress driver to use\n"
" --input-file NAME: file to compress and decompress\n"
" --extended-input-sz N: extend file data up to this size (default: no extension)\n"
Expand All @@ -61,6 +64,8 @@ usage(char *progname)
" (e.g.: 15 => 32k, default: max supported by PMD)\n"
" --external-mbufs: use memzones as external buffers instead of\n"
" keeping the data directly in mbuf area\n"
" --cc-delay-us N: delay between enqueue and dequeue operations in microseconds\n"
" valid only for cyclecount perf test (default: 500 us)\n"
" -h: prints this help\n",
progname);
}
Expand All @@ -85,12 +90,16 @@ parse_cperf_test_type(struct comp_test_data *test_data, const char *arg)
{
struct name_id_map cperftest_namemap[] = {
{
comp_perf_test_type_strs[CPERF_TEST_TYPE_BENCHMARK],
CPERF_TEST_TYPE_BENCHMARK
comp_perf_test_type_strs[CPERF_TEST_TYPE_THROUGHPUT],
CPERF_TEST_TYPE_THROUGHPUT
},
{
comp_perf_test_type_strs[CPERF_TEST_TYPE_VERIFY],
CPERF_TEST_TYPE_VERIFY
},
{
comp_perf_test_type_strs[CPERF_TEST_TYPE_PMDCC],
CPERF_TEST_TYPE_PMDCC
}
};

Expand Down Expand Up @@ -531,17 +540,28 @@ parse_external_mbufs(struct comp_test_data *test_data,
return 0;
}

static int
parse_cyclecount_delay_us(struct comp_test_data *test_data,
const char *arg)
{
int ret = parse_uint32_t(&(test_data->cyclecount_delay), arg);

if (ret) {
RTE_LOG(ERR, USER1, "Failed to parse cyclecount delay\n");
return -1;
}
return 0;
}

typedef int (*option_parser_t)(struct comp_test_data *test_data,
const char *arg);

struct long_opt_parser {
const char *lgopt_name;
option_parser_t parser_fn;

};

static struct option lgopts[] = {

{ CPERF_PTEST_TYPE, required_argument, 0, 0 },
{ CPERF_DRIVER_NAME, required_argument, 0, 0 },
{ CPERF_TEST_FILE, required_argument, 0, 0 },
Expand All @@ -556,6 +576,7 @@ static struct option lgopts[] = {
{ CPERF_LEVEL, required_argument, 0, 0 },
{ CPERF_WINDOW_SIZE, required_argument, 0, 0 },
{ CPERF_EXTERNAL_MBUFS, 0, 0, 0 },
{ CPERF_CYCLECOUNT_DELAY_US, required_argument, 0, 0 },
{ NULL, 0, 0, 0 }
};

Expand All @@ -577,6 +598,7 @@ comp_perf_opts_parse_long(int opt_idx, struct comp_test_data *test_data)
{ CPERF_LEVEL, parse_level },
{ CPERF_WINDOW_SIZE, parse_window_sz },
{ CPERF_EXTERNAL_MBUFS, parse_external_mbufs },
{ CPERF_CYCLECOUNT_DELAY_US, parse_cyclecount_delay_us },
};
unsigned int i;

Expand Down Expand Up @@ -631,8 +653,9 @@ comp_perf_options_default(struct comp_test_data *test_data)
test_data->level_lst.min = RTE_COMP_LEVEL_MIN;
test_data->level_lst.max = RTE_COMP_LEVEL_MAX;
test_data->level_lst.inc = 1;
test_data->test = CPERF_TEST_TYPE_BENCHMARK;
test_data->test = CPERF_TEST_TYPE_THROUGHPUT;
test_data->use_external_mbufs = 0;
test_data->cyclecount_delay = 500;
}

int
Expand Down
23 changes: 15 additions & 8 deletions app/test-compress-perf/comp_perf_test_common.c
Expand Up @@ -9,7 +9,8 @@

#include "comp_perf.h"
#include "comp_perf_options.h"
#include "comp_perf_test_benchmark.h"
#include "comp_perf_test_throughput.h"
#include "comp_perf_test_cyclecount.h"
#include "comp_perf_test_common.h"
#include "comp_perf_test_verify.h"

Expand Down Expand Up @@ -276,9 +277,11 @@ comp_perf_allocate_memory(struct comp_test_data *test_data,

snprintf(pool_name, sizeof(pool_name), "op_pool_%u_qp_%u",
mem->dev_id, mem->qp_id);

/* one mempool for both src and dst mbufs */
mem->op_pool = rte_comp_op_pool_create(pool_name,
mem->total_bufs,
0, 0, rte_socket_id());
mem->total_bufs * 2,
0, 0, rte_socket_id());
if (mem->op_pool == NULL) {
RTE_LOG(ERR, USER1, "Comp op mempool could not be created\n");
return -1;
Expand Down Expand Up @@ -495,20 +498,24 @@ prepare_bufs(struct comp_test_data *test_data, struct cperf_mem_resources *mem)
}

void
print_test_dynamics(void)
print_test_dynamics(const struct comp_test_data *test_data)
{
uint32_t opt_total_segs = DIV_CEIL(buffer_info.input_data_sz,
MAX_SEG_SIZE);

if (buffer_info.total_buffs > 1) {
printf("\nWarning: for the current input parameters, number"
if (test_data->test == CPERF_TEST_TYPE_THROUGHPUT) {
printf("\nWarning: for the current input parameters, number"
" of ops is higher than one, which may result"
" in sub-optimal performance.\n");
printf("To improve the performance (for the current"
printf("To improve the performance (for the current"
" input data) following parameters are"
" suggested:\n");
printf(" * Segment size: %d\n", MAX_SEG_SIZE);
printf(" * Number of segments: %u\n", opt_total_segs);
printf(" * Segment size: %d\n",
MAX_SEG_SIZE);
printf(" * Number of segments: %u\n",
opt_total_segs);
}
} else if (buffer_info.total_buffs == 1) {
printf("\nInfo: there is only one op with %u segments -"
" the compression ratio is the best.\n",
Expand Down
2 changes: 1 addition & 1 deletion app/test-compress-perf/comp_perf_test_common.h
Expand Up @@ -49,6 +49,6 @@ int
prepare_bufs(struct comp_test_data *test_data, struct cperf_mem_resources *mem);

void
print_test_dynamics(void);
print_test_dynamics(const struct comp_test_data *test_data);

#endif /* _COMP_PERF_TEST_COMMON_H_ */

0 comments on commit 2695db9

Please sign in to comment.