Skip to content

Commit

Permalink
app/crypto-perf: fix display once detection
Browse files Browse the repository at this point in the history
[ upstream commit 90e0334 ]

This patch changes 'only_once' variable to 'display_once',
which should be atomic type due to fact, that all runner functions
can be executed in paraller way on different lcores.

Fixes: df52cb3 ("app/crypto-perf: move verify as single test type")

Signed-off-by: Tomasz Jozwiak <tjozwiakgm@gmail.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
  • Loading branch information
tjozwiak authored and kevintraynor committed Aug 26, 2019
1 parent 144158f commit 0f5ef64
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 18 deletions.
5 changes: 2 additions & 3 deletions app/test-crypto-perf/cperf_test_latency.c
Expand Up @@ -128,7 +128,7 @@ cperf_latency_test_runner(void *arg)
uint8_t burst_size_idx = 0;
uint32_t imix_idx = 0;

static int only_once;
static rte_atomic16_t display_once = RTE_ATOMIC16_INIT(0);

if (ctx == NULL)
return 0;
Expand Down Expand Up @@ -310,7 +310,7 @@ cperf_latency_test_runner(void *arg)
time_min = tunit*(double)(tsc_min) / tsc_hz;

if (ctx->options->csv) {
if (!only_once)
if (rte_atomic16_test_and_set(&display_once))
printf("\n# lcore, Buffer Size, Burst Size, Pakt Seq #, "
"Packet Size, cycles, time (us)");

Expand All @@ -325,7 +325,6 @@ cperf_latency_test_runner(void *arg)
/ tsc_hz);

}
only_once = 1;
} else {
printf("\n# Device %d on lcore %u\n", ctx->dev_id,
ctx->lcore_id);
Expand Down
8 changes: 3 additions & 5 deletions app/test-crypto-perf/cperf_test_pmd_cyclecount.c
Expand Up @@ -390,7 +390,7 @@ cperf_pmd_cyclecount_test_runner(void *test_ctx)
state.lcore = rte_lcore_id();
state.linearize = 0;

static int only_once;
static rte_atomic16_t display_once = RTE_ATOMIC16_INIT(0);
static bool warmup = true;

/*
Expand Down Expand Up @@ -436,13 +436,12 @@ cperf_pmd_cyclecount_test_runner(void *test_ctx)
}

if (!opts->csv) {
if (!only_once)
if (rte_atomic16_test_and_set(&display_once))
printf(PRETTY_HDR_FMT, "lcore id", "Buf Size",
"Burst Size", "Enqueued",
"Dequeued", "Enq Retries",
"Deq Retries", "Cycles/Op",
"Cycles/Enq", "Cycles/Deq");
only_once = 1;

printf(PRETTY_LINE_FMT, state.ctx->lcore_id,
opts->test_buffer_size, test_burst_size,
Expand All @@ -453,13 +452,12 @@ cperf_pmd_cyclecount_test_runner(void *test_ctx)
state.cycles_per_enq,
state.cycles_per_deq);
} else {
if (!only_once)
if (rte_atomic16_test_and_set(&display_once))
printf(CSV_HDR_FMT, "# lcore id", "Buf Size",
"Burst Size", "Enqueued",
"Dequeued", "Enq Retries",
"Deq Retries", "Cycles/Op",
"Cycles/Enq", "Cycles/Deq");
only_once = 1;

printf(CSV_LINE_FMT, state.ctx->lcore_id,
opts->test_buffer_size, test_burst_size,
Expand Down
8 changes: 3 additions & 5 deletions app/test-crypto-perf/cperf_test_throughput.c
Expand Up @@ -94,7 +94,7 @@ cperf_throughput_test_runner(void *test_ctx)
uint8_t burst_size_idx = 0;
uint32_t imix_idx = 0;

static int only_once;
static rte_atomic16_t display_once = RTE_ATOMIC16_INIT(0);

struct rte_crypto_op *ops[ctx->options->max_burst_size];
struct rte_crypto_op *ops_processed[ctx->options->max_burst_size];
Expand Down Expand Up @@ -261,13 +261,12 @@ cperf_throughput_test_runner(void *test_ctx)
ctx->options->total_ops);

if (!ctx->options->csv) {
if (!only_once)
if (rte_atomic16_test_and_set(&display_once))
printf("%12s%12s%12s%12s%12s%12s%12s%12s%12s%12s\n\n",
"lcore id", "Buf Size", "Burst Size",
"Enqueued", "Dequeued", "Failed Enq",
"Failed Deq", "MOps", "Gbps",
"Cycles/Buf");
only_once = 1;

printf("%12u%12u%12u%12"PRIu64"%12"PRIu64"%12"PRIu64
"%12"PRIu64"%12.4f%12.4f%12.2f\n",
Expand All @@ -282,12 +281,11 @@ cperf_throughput_test_runner(void *test_ctx)
throughput_gbps,
cycles_per_packet);
} else {
if (!only_once)
if (rte_atomic16_test_and_set(&display_once))
printf("#lcore id,Buffer Size(B),"
"Burst Size,Enqueued,Dequeued,Failed Enq,"
"Failed Deq,Ops(Millions),Throughput(Gbps),"
"Cycles/Buf\n\n");
only_once = 1;

printf("%u;%u;%u;%"PRIu64";%"PRIu64";%"PRIu64";%"PRIu64";"
"%.3f;%.3f;%.3f\n",
Expand Down
8 changes: 3 additions & 5 deletions app/test-crypto-perf/cperf_test_verify.c
Expand Up @@ -232,7 +232,7 @@ cperf_verify_test_runner(void *test_ctx)
uint64_t ops_deqd = 0, ops_deqd_total = 0, ops_deqd_failed = 0;
uint64_t ops_failed = 0;

static int only_once;
static rte_atomic16_t display_once = RTE_ATOMIC16_INIT(0);

uint64_t i;
uint16_t ops_unused = 0;
Expand Down Expand Up @@ -375,12 +375,11 @@ cperf_verify_test_runner(void *test_ctx)
}

if (!ctx->options->csv) {
if (!only_once)
if (rte_atomic16_test_and_set(&display_once))
printf("%12s%12s%12s%12s%12s%12s%12s%12s\n\n",
"lcore id", "Buf Size", "Burst size",
"Enqueued", "Dequeued", "Failed Enq",
"Failed Deq", "Failed Ops");
only_once = 1;

printf("%12u%12u%12u%12"PRIu64"%12"PRIu64"%12"PRIu64
"%12"PRIu64"%12"PRIu64"\n",
Expand All @@ -393,11 +392,10 @@ cperf_verify_test_runner(void *test_ctx)
ops_deqd_failed,
ops_failed);
} else {
if (!only_once)
if (rte_atomic16_test_and_set(&display_once))
printf("\n# lcore id, Buffer Size(B), "
"Burst Size,Enqueued,Dequeued,Failed Enq,"
"Failed Deq,Failed Ops\n");
only_once = 1;

printf("%10u;%10u;%u;%"PRIu64";%"PRIu64";%"PRIu64";%"PRIu64";"
"%"PRIu64"\n",
Expand Down

0 comments on commit 0f5ef64

Please sign in to comment.