| 626 | } |
| 627 | |
| 628 | static int |
| 629 | measure_perf_get(rte_graph_t graph_id) |
| 630 | { |
| 631 | const char *pattern = rte_graph_id_to_name(graph_id); |
| 632 | uint32_t lcore_id = rte_get_next_lcore(-1, 1, 0); |
| 633 | struct rte_graph_cluster_stats_param param; |
| 634 | struct rte_graph_cluster_stats *stats; |
| 635 | struct graph_lcore_data *data; |
| 636 | |
| 637 | data = rte_zmalloc("Graph_perf", sizeof(struct graph_lcore_data), |
| 638 | RTE_CACHE_LINE_SIZE); |
| 639 | data->graph_id = graph_id; |
| 640 | data->done = 0; |
| 641 | |
| 642 | /* Run graph worker thread function */ |
| 643 | rte_eal_remote_launch(_graph_perf_wrapper, data, lcore_id); |
| 644 | |
| 645 | /* Collect stats for few msecs */ |
| 646 | if (rte_graph_has_stats_feature()) { |
| 647 | memset(¶m, 0, sizeof(param)); |
| 648 | param.f = stdout; |
| 649 | param.socket_id = SOCKET_ID_ANY; |
| 650 | param.graph_patterns = &pattern; |
| 651 | param.nb_graph_patterns = 1; |
| 652 | |
| 653 | stats = rte_graph_cluster_stats_create(¶m); |
| 654 | if (stats == NULL) { |
| 655 | printf("Failed to create stats\n"); |
| 656 | return -ENOMEM; |
| 657 | } |
| 658 | |
| 659 | rte_delay_ms(3E2); |
| 660 | rte_graph_cluster_stats_get(stats, true); |
| 661 | rte_delay_ms(1E3); |
| 662 | rte_graph_cluster_stats_get(stats, false); |
| 663 | rte_graph_cluster_stats_destroy(stats); |
| 664 | } else |
| 665 | rte_delay_ms(1E3); |
| 666 | |
| 667 | data->done = 1; |
| 668 | rte_eal_wait_lcore(lcore_id); |
| 669 | |
| 670 | return 0; |
| 671 | } |
| 672 | |
| 673 | static inline void |
| 674 | graph_fini(void) |
no test coverage detected