MCPcopy Create free account
hub / github.com/F-Stack/f-stack / perf_producer

Function perf_producer

dpdk/app/test-eventdev/test_perf_common.c:119–172  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

117}
118
119static inline int
120perf_producer(void *arg)
121{
122 int i;
123 struct prod_data *p = arg;
124 struct test_perf *t = p->t;
125 struct evt_options *opt = t->opt;
126 const uint8_t dev_id = p->dev_id;
127 const uint8_t port = p->port_id;
128 struct rte_mempool *pool = t->pool;
129 const uint64_t nb_pkts = t->nb_pkts;
130 const uint32_t nb_flows = t->nb_flows;
131 uint32_t flow_counter = 0;
132 uint64_t count = 0;
133 struct perf_elt *m[BURST_SIZE + 1] = {NULL};
134 uint8_t enable_fwd_latency;
135 struct rte_event ev;
136
137 enable_fwd_latency = opt->fwd_latency;
138 if (opt->verbose_level > 1)
139 printf("%s(): lcore %d dev_id %d port=%d queue %d\n", __func__,
140 rte_lcore_id(), dev_id, port, p->queue_id);
141
142 ev.event = 0;
143 ev.op = RTE_EVENT_OP_NEW;
144 ev.queue_id = p->queue_id;
145 ev.sched_type = t->opt->sched_type_list[0];
146 ev.priority = RTE_EVENT_DEV_PRIORITY_NORMAL;
147 ev.event_type = RTE_EVENT_TYPE_CPU;
148 ev.sub_event_type = 0; /* stage 0 */
149
150 while (count < nb_pkts && t->done == false) {
151 if (rte_mempool_get_bulk(pool, (void **)m, BURST_SIZE) < 0)
152 continue;
153 for (i = 0; i < BURST_SIZE; i++) {
154 ev.flow_id = flow_counter++ % nb_flows;
155 ev.event_ptr = m[i];
156 if (enable_fwd_latency)
157 m[i]->timestamp = rte_get_timer_cycles();
158 while (rte_event_enqueue_new_burst(dev_id, port, &ev,
159 1) != 1) {
160 if (t->done)
161 break;
162 rte_pause();
163 if (enable_fwd_latency)
164 m[i]->timestamp =
165 rte_get_timer_cycles();
166 }
167 }
168 count += BURST_SIZE;
169 }
170
171 return 0;
172}
173
174static inline int
175perf_producer_burst(void *arg)

Callers 1

perf_producer_wrapperFunction · 0.85

Calls 5

rte_lcore_idFunction · 0.85
rte_mempool_get_bulkFunction · 0.85
printfFunction · 0.50
rte_pauseFunction · 0.50

Tested by

no test coverage detected