| 769 | } |
| 770 | |
| 771 | static void |
| 772 | print_stats(void) |
| 773 | { |
| 774 | const char topLeft[] = {27, '[', '1', ';', '1', 'H', '\0'}; |
| 775 | const char clr[] = {27, '[', '2', 'J', '\0'}; |
| 776 | struct rte_graph_cluster_stats_param s_param; |
| 777 | struct rte_graph_cluster_stats *stats; |
| 778 | const char *pattern = "worker_*"; |
| 779 | |
| 780 | /* Prepare stats object */ |
| 781 | memset(&s_param, 0, sizeof(s_param)); |
| 782 | s_param.f = stdout; |
| 783 | s_param.socket_id = SOCKET_ID_ANY; |
| 784 | s_param.graph_patterns = &pattern; |
| 785 | s_param.nb_graph_patterns = 1; |
| 786 | |
| 787 | stats = rte_graph_cluster_stats_create(&s_param); |
| 788 | if (stats == NULL) |
| 789 | rte_exit(EXIT_FAILURE, "Unable to create stats object\n"); |
| 790 | |
| 791 | while (!force_quit) { |
| 792 | /* Clear screen and move to top left */ |
| 793 | printf("%s%s", clr, topLeft); |
| 794 | rte_graph_cluster_stats_get(stats, 0); |
| 795 | rte_delay_ms(1E3); |
| 796 | } |
| 797 | |
| 798 | rte_graph_cluster_stats_destroy(stats); |
| 799 | } |
| 800 | |
| 801 | /* Main processing loop. 8< */ |
| 802 | static int |
no test coverage detected