| 202 | } |
| 203 | |
| 204 | static void |
| 205 | graph_stats_print_to_file(void) |
| 206 | { |
| 207 | struct rte_graph_cluster_stats_param s_param; |
| 208 | struct rte_graph_cluster_stats *stats; |
| 209 | const char *pattern = "worker_*"; |
| 210 | FILE *fp = NULL; |
| 211 | size_t sz, len; |
| 212 | |
| 213 | /* Prepare stats object */ |
| 214 | fp = fopen("/tmp/graph_stats.txt", "w+"); |
| 215 | if (fp == NULL) |
| 216 | rte_exit(EXIT_FAILURE, "Error in opening stats file\n"); |
| 217 | |
| 218 | memset(&s_param, 0, sizeof(s_param)); |
| 219 | s_param.f = fp; |
| 220 | s_param.socket_id = SOCKET_ID_ANY; |
| 221 | s_param.graph_patterns = &pattern; |
| 222 | s_param.nb_graph_patterns = 1; |
| 223 | |
| 224 | stats = rte_graph_cluster_stats_create(&s_param); |
| 225 | if (stats == NULL) |
| 226 | rte_exit(EXIT_FAILURE, "Unable to create stats object\n"); |
| 227 | |
| 228 | /* Clear screen and move to top left */ |
| 229 | rte_graph_cluster_stats_get(stats, 0); |
| 230 | rte_delay_ms(1E3); |
| 231 | |
| 232 | fseek(fp, 0L, SEEK_END); |
| 233 | sz = ftell(fp); |
| 234 | fseek(fp, 0L, SEEK_SET); |
| 235 | |
| 236 | len = strlen(conn->msg_out); |
| 237 | conn->msg_out += len; |
| 238 | |
| 239 | sz = fread(conn->msg_out, sizeof(char), sz, fp); |
| 240 | len = strlen(conn->msg_out); |
| 241 | conn->msg_out_len_max -= len; |
| 242 | rte_graph_cluster_stats_destroy(stats); |
| 243 | |
| 244 | fclose(fp); |
| 245 | } |
| 246 | |
| 247 | static void |
| 248 | cli_graph_stats(__rte_unused void *parsed_result, __rte_unused struct cmdline *cl, |
no test coverage detected