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 v4] test: bench_misc: short and long time stamps #1956

Merged
Merged
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
34 changes: 29 additions & 5 deletions test/performance/odp_bench_misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,17 @@ typedef struct {
/* Common benchmark suite data */
bench_suite_t suite;

/* Test case input / output data */
/* Time stamp 1 */
odp_time_t t1[REPEAT_COUNT];
/* Time stamp 2 */
odp_time_t t2[REPEAT_COUNT];
/* Resulting time stamp */
odp_time_t t3[REPEAT_COUNT];

odp_time_t global_short[REPEAT_COUNT];
odp_time_t global_long[REPEAT_COUNT];

/* Integer input / output data */
uint64_t a1[REPEAT_COUNT];
uint64_t a2[REPEAT_COUNT];
uint32_t b1[REPEAT_COUNT];
Expand Down Expand Up @@ -266,14 +273,28 @@ static int time_sum(void)
return i;
}

static int time_to_ns(void)
static int time_to_ns_short(void)
{
int i;
odp_time_t *t1 = gbl_args->t1;
odp_time_t *t = gbl_args->global_short;
uint64_t res = 0;

for (i = 0; i < REPEAT_COUNT; i++)
res += odp_time_to_ns(t[i]);

gbl_args->suite.dummy += res;

return i;
}

static int time_to_ns_long(void)
{
int i;
odp_time_t *t = gbl_args->global_long;
uint64_t res = 0;

for (i = 0; i < REPEAT_COUNT; i++)
res += odp_time_to_ns(t1[i]);
res += odp_time_to_ns(t[i]);

gbl_args->suite.dummy += res;

Expand Down Expand Up @@ -698,7 +719,8 @@ bench_info_t test_suite[] = {
BENCH_INFO(time_diff, init_time_local, 0, "time_diff (local)"),
BENCH_INFO(time_diff_ns, init_time_global, 0, NULL),
BENCH_INFO(time_sum, init_time_global, 0, NULL),
BENCH_INFO(time_to_ns, init_time_global, 0, NULL),
BENCH_INFO(time_to_ns_short, NULL, 0, "time_to_ns (short)"),
BENCH_INFO(time_to_ns_long, NULL, 0, "time_to_ns (long)"),
BENCH_INFO(time_local_from_ns, init_time_global, 0, NULL),
BENCH_INFO(time_global_from_ns, init_time_global, 0, NULL),
BENCH_INFO(time_cmp, init_time_global, 0, NULL),
Expand Down Expand Up @@ -884,6 +906,8 @@ int main(int argc, char *argv[])
gbl_args->t1[i] = ODP_TIME_NULL;
gbl_args->t2[i] = ODP_TIME_NULL;
gbl_args->t3[i] = ODP_TIME_NULL;
gbl_args->global_short[i] = odp_time_global_from_ns(ODP_TIME_MSEC_IN_NS);
gbl_args->global_long[i] = odp_time_global_from_ns(10 * ODP_TIME_SEC_IN_NS);
gbl_args->a1[i] = i;
gbl_args->a2[i] = i;
gbl_args->b1[i] = i;
Expand Down