* Performance test function to measure enqueue performance. * This runs performance tests 1, 2 and 3 */
| 1289 | * This runs performance tests 1, 2 and 3 |
| 1290 | */ |
| 1291 | static enum test_result perf1_test(struct test_config *tcfg) |
| 1292 | { |
| 1293 | enum test_result result = PASS; |
| 1294 | struct rdtsc_prof prof = {0, 0, 0, 0, 0.0, NULL}; |
| 1295 | uint32_t total = 0; |
| 1296 | |
| 1297 | printf("%s", tcfg->msg); |
| 1298 | |
| 1299 | rdtsc_prof_init(&prof, "enqueue"); |
| 1300 | |
| 1301 | if (test_rte_red_init(tcfg) != PASS) { |
| 1302 | result = FAIL; |
| 1303 | goto out; |
| 1304 | } |
| 1305 | |
| 1306 | /** |
| 1307 | * set average queue size to target level |
| 1308 | */ |
| 1309 | *tcfg->tqueue->q = *tcfg->tlevel; |
| 1310 | |
| 1311 | /** |
| 1312 | * initialize the rte_red run time data structure |
| 1313 | */ |
| 1314 | rte_red_rt_data_init(tcfg->tqueue->rdata); |
| 1315 | |
| 1316 | /** |
| 1317 | * set the queue average |
| 1318 | */ |
| 1319 | rte_red_set_avg_int(tcfg->tconfig->rconfig, tcfg->tqueue->rdata, *tcfg->tlevel); |
| 1320 | if (rte_red_get_avg_int(tcfg->tconfig->rconfig, tcfg->tqueue->rdata) |
| 1321 | != *tcfg->tlevel) { |
| 1322 | result = FAIL; |
| 1323 | goto out; |
| 1324 | } |
| 1325 | |
| 1326 | enqueue_dequeue_perf(tcfg->tconfig->rconfig, |
| 1327 | tcfg->tqueue->rdata, |
| 1328 | tcfg->tqueue->q, |
| 1329 | tcfg->tvar->num_ops, |
| 1330 | tcfg->tvar->enqueued, |
| 1331 | tcfg->tvar->dropped, |
| 1332 | &prof); |
| 1333 | |
| 1334 | total = *tcfg->tvar->enqueued + *tcfg->tvar->dropped; |
| 1335 | |
| 1336 | printf("\ntotal: %u, enqueued: %u (%.2lf%%), dropped: %u (%.2lf%%)\n", total, |
| 1337 | *tcfg->tvar->enqueued, ((double)(*tcfg->tvar->enqueued) / (double)total) * 100.0, |
| 1338 | *tcfg->tvar->dropped, ((double)(*tcfg->tvar->dropped) / (double)total) * 100.0); |
| 1339 | |
| 1340 | rdtsc_prof_print(&prof); |
| 1341 | out: |
| 1342 | return result; |
| 1343 | } |
| 1344 | |
| 1345 | /** |
| 1346 | * Setup test structures for tests P4, P5, P6 |
nothing calls this directly
no test coverage detected