app/testeventdev: add helper functions to dump options

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Signed-off-by: Guduri Prathyusha <gprathyusha@caviumnetworks.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
This commit is contained in:
Jerin Jacob 2017-07-04 10:23:03 +05:30
parent 3c59fb10e7
commit 89e840264e
2 changed files with 114 additions and 0 deletions

View File

@ -56,3 +56,26 @@ evt_options_default(struct evt_options *opt)
opt->wkr_deq_dep = 16;
opt->nb_pkts = (1ULL << 26); /* do ~64M packets */
}
void
evt_options_dump(struct evt_options *opt)
{
int lcore_id;
struct rte_event_dev_info dev_info;
rte_event_dev_info_get(opt->dev_id, &dev_info);
evt_dump("driver", "%s", dev_info.driver_name);
evt_dump("test", "%s", opt->test_name);
evt_dump("dev", "%d", opt->dev_id);
evt_dump("verbose_level", "%d", opt->verbose_level);
evt_dump("socket_id", "%d", opt->socket_id);
evt_dump("pool_sz", "%d", opt->pool_sz);
evt_dump("master lcore", "%d", rte_get_master_lcore());
evt_dump("nb_pkts", "%"PRIu64, opt->nb_pkts);
evt_dump_begin("available lcores");
RTE_LCORE_FOREACH(lcore_id)
printf("%d ", lcore_id);
evt_dump_end;
evt_dump_nb_flows(opt);
evt_dump_worker_dequeue_depth(opt);
}

View File

@ -42,6 +42,8 @@
#include "evt_common.h"
#define EVT_BOOL_FMT(x) ((x) ? "true" : "false")
struct evt_options {
#define EVT_TEST_NAME_MAX_LEN 32
char test_name[EVT_TEST_NAME_MAX_LEN];
@ -62,6 +64,7 @@ struct evt_options {
};
void evt_options_default(struct evt_options *opt);
void evt_options_dump(struct evt_options *opt);
/* options check helpers */
static inline bool
@ -164,5 +167,93 @@ evt_has_invalid_sched_type(struct evt_options *opt)
return false;
}
/* option dump helpers */
static inline void
evt_dump_worker_lcores(struct evt_options *opt)
{
int c;
evt_dump_begin("worker lcores");
for (c = 0; c < RTE_MAX_LCORE; c++) {
if (opt->wlcores[c])
printf("%d ", c);
}
evt_dump_end;
}
static inline void
evt_dump_producer_lcores(struct evt_options *opt)
{
int c;
evt_dump_begin("producer lcores");
for (c = 0; c < RTE_MAX_LCORE; c++) {
if (opt->plcores[c])
printf("%d ", c);
}
evt_dump_end;
}
static inline void
evt_dump_nb_flows(struct evt_options *opt)
{
evt_dump("nb_flows", "%d", opt->nb_flows);
}
static inline void
evt_dump_scheduler_lcore(struct evt_options *opt)
{
evt_dump("scheduler lcore", "%d", opt->slcore);
}
static inline void
evt_dump_worker_dequeue_depth(struct evt_options *opt)
{
evt_dump("worker deq depth", "%d", opt->wkr_deq_dep);
}
static inline void
evt_dump_nb_stages(struct evt_options *opt)
{
evt_dump("nb_stages", "%d", opt->nb_stages);
}
static inline void
evt_dump_fwd_latency(struct evt_options *opt)
{
evt_dump("fwd_latency", "%s", EVT_BOOL_FMT(opt->fwd_latency));
}
static inline void
evt_dump_queue_priority(struct evt_options *opt)
{
evt_dump("queue_priority", "%s", EVT_BOOL_FMT(opt->q_priority));
}
static inline const char*
evt_sched_type_2_str(uint8_t sched_type)
{
if (sched_type == RTE_SCHED_TYPE_ORDERED)
return "O";
else if (sched_type == RTE_SCHED_TYPE_ATOMIC)
return "A";
else if (sched_type == RTE_SCHED_TYPE_PARALLEL)
return "P";
else
return "I";
}
static inline void
evt_dump_sched_type_list(struct evt_options *opt)
{
int i;
evt_dump_begin("sched_type_list");
for (i = 0; i < opt->nb_stages; i++)
printf("%s ", evt_sched_type_2_str(opt->sched_type_list[i]));
evt_dump_end;
}
#endif /* _EVT_OPTIONS_ */