aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorTuomas Taipale <tuomas.taipale@nokia.com>2022-11-18 11:32:53 +0000
committerPetri Savolainen <petri.savolainen@nokia.com>2022-11-25 09:19:15 +0200
commitbd02f4345ce2f4c5e98a1f88ff6c3d3f28e22bef (patch)
tree1a38c6ecaff737e75ee6cf80760cc70182f48709 /test
parent1cfb0e7be600580606d72d50094dda69ff226e5e (diff)
test: dma_perf: make completion event wait period configurable
In certain situations it can be useful to configure the completion event waiting period instead of using the default hard-coded value, thus it is now configurable with nanosecond precision with the new `-w` option. Additionally, current default is changed to one (1) second, as this should make the tester a bit more responsive in case of a timeout. Signed-off-by: Tuomas Taipale <tuomas.taipale@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
Diffstat (limited to 'test')
-rw-r--r--test/performance/odp_dma_perf.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/test/performance/odp_dma_perf.c b/test/performance/odp_dma_perf.c
index 615107299..0decdac08 100644
--- a/test/performance/odp_dma_perf.c
+++ b/test/performance/odp_dma_perf.c
@@ -21,6 +21,7 @@
#define DEFAULT_SEG_SIZE 1024U
#define ROUNDS 1000000
+#define DEFAULT_WAIT_NS ODP_TIME_SEC_IN_NS
#define COMPL_DELIMITER ","
/* For now, a static maximum amount of input segments */
#define MAX_NUM_IN_SEGS 64
@@ -51,6 +52,7 @@ typedef struct test_config_t {
int seg_type;
int num_rounds;
int dma_rounds;
+ uint64_t wait_ns;
struct {
int num_modes;
@@ -104,6 +106,7 @@ static void set_option_defaults(test_config_t *config)
config->num_in_seg = 1;
config->seg_size = DEFAULT_SEG_SIZE;
config->num_rounds = ROUNDS;
+ config->wait_ns = DEFAULT_WAIT_NS;
config->compl_modes.compl_mask = ODP_DMA_COMPL_SYNC;
}
@@ -172,6 +175,8 @@ static void print_usage(void)
" 1: event\n"
" -r, --num_rounds Number of times to run the test scenario. %d by\n"
" default.\n"
+ " -w, --wait_nsec Number of nanoseconds to wait for completion events.\n"
+ " 1 second (1000000000) by default.\n"
" -h, --help This help.\n"
"\n",
MAX_NUM_IN_SEGS, ROUNDS);
@@ -254,11 +259,12 @@ static int parse_options(int argc, char **argv, test_config_t *config)
{ "in_seg_type", required_argument, NULL, 'T' },
{ "compl_modes", required_argument, NULL, 'm' },
{ "num_rounds", required_argument, NULL, 'r' },
+ { "wait_nsec", required_argument, NULL, 'w' },
{ "help", no_argument, NULL, 'h' },
{ NULL, 0, NULL, 0 }
};
- static const char *shortopts = "t:g:i:s:T:m:r:h";
+ static const char *shortopts = "t:g:i:s:T:m:r:w:h";
set_option_defaults(config);
@@ -290,6 +296,9 @@ static int parse_options(int argc, char **argv, test_config_t *config)
case 'r':
config->num_rounds = atoi(optarg);
break;
+ case 'w':
+ config->wait_ns = atoll(optarg);
+ break;
case 'h':
default:
print_usage();
@@ -854,7 +863,7 @@ static void build_wait_list(const test_config_t *config, odp_dma_compl_param_t c
static inline int wait_dma_transfers_ready(test_config_t *config, compl_wait_entry_t list[])
{
odp_event_t ev;
- const uint64_t wait_time = odp_schedule_wait_time(ODP_TIME_SEC_IN_NS * 5U);
+ const uint64_t wait_time = odp_schedule_wait_time(config->wait_ns);
int done = 0;
for (int i = 0; i < config->dma_rounds; ++i) {