* Performance test function to measure enqueue performance when the * queue is empty. This runs performance tests 4, 5 and 6 */
| 1421 | * queue is empty. This runs performance tests 4, 5 and 6 |
| 1422 | */ |
| 1423 | static enum test_result perf2_test(struct test_config *tcfg) |
| 1424 | { |
| 1425 | enum test_result result = PASS; |
| 1426 | struct rdtsc_prof prof = {0, 0, 0, 0, 0.0, NULL}; |
| 1427 | uint32_t total = 0; |
| 1428 | uint32_t i = 0; |
| 1429 | |
| 1430 | printf("%s", tcfg->msg); |
| 1431 | |
| 1432 | rdtsc_prof_init(&prof, "enqueue"); |
| 1433 | |
| 1434 | if (test_rte_red_init(tcfg) != PASS) { |
| 1435 | result = FAIL; |
| 1436 | goto out; |
| 1437 | } |
| 1438 | |
| 1439 | printf("%s", tcfg->htxt); |
| 1440 | |
| 1441 | for (i = 0; i < tcfg->tvar->num_iterations; i++) { |
| 1442 | uint32_t count = 0; |
| 1443 | uint64_t ts = 0; |
| 1444 | double avg_before = 0; |
| 1445 | int ret = 0; |
| 1446 | |
| 1447 | /** |
| 1448 | * set average queue size to target level |
| 1449 | */ |
| 1450 | *tcfg->tqueue->q = *tcfg->tlevel; |
| 1451 | count = (*tcfg->tqueue->rdata).count; |
| 1452 | |
| 1453 | /** |
| 1454 | * initialize the rte_red run time data structure |
| 1455 | */ |
| 1456 | rte_red_rt_data_init(tcfg->tqueue->rdata); |
| 1457 | (*tcfg->tqueue->rdata).count = count; |
| 1458 | |
| 1459 | /** |
| 1460 | * set the queue average |
| 1461 | */ |
| 1462 | rte_red_set_avg_int(tcfg->tconfig->rconfig, tcfg->tqueue->rdata, *tcfg->tlevel); |
| 1463 | avg_before = rte_red_get_avg_float(tcfg->tconfig->rconfig, tcfg->tqueue->rdata); |
| 1464 | if ((avg_before < *tcfg->tlevel) || (avg_before > *tcfg->tlevel)) { |
| 1465 | result = FAIL; |
| 1466 | goto out; |
| 1467 | } |
| 1468 | |
| 1469 | /** |
| 1470 | * empty the queue |
| 1471 | */ |
| 1472 | *tcfg->tqueue->q = 0; |
| 1473 | rte_red_mark_queue_empty(tcfg->tqueue->rdata, get_port_ts()); |
| 1474 | |
| 1475 | /** |
| 1476 | * wait for specified period of time |
| 1477 | */ |
| 1478 | rte_delay_us(tcfg->tvar->wait_usec); |
| 1479 | |
| 1480 | /** |
nothing calls this directly
no test coverage detected