Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PATCH v2] test: bench_pktio_sp: add new test for creating pmr rules #1926

Merged
merged 1 commit into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions test/performance/bench_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ void bench_tm_func_record(odp_time_t t2, odp_time_t t1, bench_tm_result_t *res,

if (odp_time_cmp(diff, res->func[id].max) > 0)
res->func[id].max = diff;

res->func[id].num++;
}

static void init_result(bench_tm_result_t *res)
Expand All @@ -183,13 +185,15 @@ static void init_result(bench_tm_result_t *res)
}
}

static void print_results(bench_tm_result_t *res, uint64_t repeat_count)
static void print_results(bench_tm_result_t *res)
{
for (uint8_t i = 0; i < res->num; i++) {
uint64_t num = res->func[i].num ? res->func[i].num : 1;

printf(" %-38s %-12" PRIu64 " %-12" PRIu64 " %-12" PRIu64 "\n",
res->func[i].name,
odp_time_to_ns(res->func[i].min),
odp_time_to_ns(res->func[i].tot) / repeat_count,
odp_time_to_ns(res->func[i].tot) / num,
odp_time_to_ns(res->func[i].max));
}
}
Expand Down Expand Up @@ -218,6 +222,13 @@ int bench_tm_run(void *arg)
if (bench->max_rounds && bench->max_rounds < rounds)
rounds = bench->max_rounds;

if (bench->cond != NULL && !bench->cond()) {
if (i > 0)
printf("[%02d] %-41s n/a n/a n/a\n",
j + 1, bench->name);
continue;
}

init_result(&res);

if (bench->init != NULL)
Expand All @@ -235,7 +246,7 @@ int bench_tm_run(void *arg)
/* No print or results from warm-up round */
if (i > 0) {
printf("[%02d] %-26s\n", j + 1, bench->name);
print_results(&res, rounds);
print_results(&res);
}
}
}
Expand Down
6 changes: 6 additions & 0 deletions test/performance/bench_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@ typedef struct bench_tm_results_s {
/* Maximum duration */
odp_time_t max;

/* Number of measurements */
uint64_t num;

} func[BENCH_TM_MAX_FUNC];

/* Number of registered test functions */
Expand All @@ -159,6 +162,9 @@ typedef struct {
/* Test case name */
const char *name;

/* Optional precondition to run test */
bench_cond_fn_t cond;

/* Optional test initializer function */
bench_init_fn_t init;

Expand Down
Loading