Branch data Line data Source code
1 : : /* SPDX-License-Identifier: BSD-3-Clause
2 : : * Copyright(C) 2020 Marvell International Ltd.
3 : : */
4 : :
5 : : #include <fnmatch.h>
6 : : #include <stdbool.h>
7 : : #include <stdlib.h>
8 : :
9 : : #include <eal_export.h>
10 : : #include <rte_common.h>
11 : : #include <rte_errno.h>
12 : : #include <rte_malloc.h>
13 : :
14 : : #include "graph_private.h"
15 : :
16 : : /* Capture all graphs of cluster */
17 : : struct cluster {
18 : : rte_graph_t nb_graphs;
19 : : rte_graph_t size;
20 : :
21 : : struct graph **graphs;
22 : : };
23 : :
24 : : /* Capture same node ID across cluster */
25 : : struct cluster_node {
26 : : struct rte_graph_cluster_node_stats stat;
27 : : rte_node_t nb_nodes;
28 : :
29 : : struct rte_node *nodes[];
30 : : };
31 : :
32 : : struct __rte_cache_aligned rte_graph_cluster_stats {
33 : : /* Header */
34 : : rte_graph_cluster_stats_cb_t fn;
35 : : uint32_t cluster_node_size; /* Size of struct cluster_node */
36 : : rte_node_t max_nodes;
37 : : int socket_id;
38 : : bool dispatch;
39 : : void *cookie;
40 : :
41 : : struct cluster_node clusters[];
42 : : };
43 : :
44 : : #define boarder_model_dispatch() \
45 : : fprintf(f, "+-------------------------------+---------------+--------" \
46 : : "-------+---------------+---------------+---------------+" \
47 : : "---------------+---------------+-" \
48 : : "----------+\n")
49 : :
50 : : #define boarder() \
51 : : fprintf(f, "+-------------------------------+---------------+--------" \
52 : : "-------+---------------+---------------+---------------+-" \
53 : : "----------+\n")
54 : :
55 : : static inline void
56 : 0 : print_banner_default(FILE *f)
57 : : {
58 : : boarder();
59 : : fprintf(f, "%-32s%-16s%-16s%-16s%-16s%-16s%-16s\n", "|Node", "|calls",
60 : : "|objs", "|realloc_count", "|objs/call", "|objs/sec(10E6)",
61 : : "|cycles/call|");
62 : : boarder();
63 : 0 : }
64 : :
65 : : static inline void
66 : 0 : print_banner_dispatch(FILE *f)
67 : : {
68 : : boarder_model_dispatch();
69 : : fprintf(f, "%-32s%-16s%-16s%-16s%-16s%-16s%-16s%-16s%-16s\n",
70 : : "|Node", "|calls",
71 : : "|objs", "|sched objs", "|sched fail",
72 : : "|realloc_count", "|objs/call", "|objs/sec(10E6)",
73 : : "|cycles/call|");
74 : : boarder_model_dispatch();
75 : 0 : }
76 : :
77 : : static inline void
78 : : print_banner(FILE *f, bool dispatch)
79 : : {
80 [ # # ]: 0 : if (dispatch)
81 : 0 : print_banner_dispatch(f);
82 : : else
83 : 0 : print_banner_default(f);
84 : : }
85 : :
86 : : static inline void
87 : 0 : print_node(FILE *f, const struct rte_graph_cluster_node_stats *stat, bool dispatch)
88 : : {
89 : : double objs_per_call, objs_per_sec, cycles_per_call, ts_per_hz;
90 : 0 : const uint64_t prev_calls = stat->prev_calls;
91 : 0 : const uint64_t prev_objs = stat->prev_objs;
92 : 0 : const uint64_t cycles = stat->cycles;
93 : 0 : const uint64_t calls = stat->calls;
94 : 0 : const uint64_t objs = stat->objs;
95 : : uint64_t call_delta;
96 : :
97 : 0 : call_delta = calls - prev_calls;
98 : : objs_per_call =
99 [ # # ]: 0 : call_delta ? (double)((objs - prev_objs) / call_delta) : 0;
100 : : cycles_per_call =
101 : 0 : call_delta ? (double)((cycles - stat->prev_cycles) / call_delta)
102 [ # # ]: 0 : : 0;
103 : 0 : ts_per_hz = (double)((stat->ts - stat->prev_ts) / stat->hz);
104 [ # # ]: 0 : objs_per_sec = ts_per_hz ? (objs - prev_objs) / ts_per_hz : 0;
105 : 0 : objs_per_sec /= 1000000;
106 : :
107 [ # # ]: 0 : if (dispatch) {
108 : : fprintf(f,
109 : : "|%-31s|%-15" PRIu64 "|%-15" PRIu64 "|%-15" PRIu64
110 : : "|%-15" PRIu64 "|%-15" PRIu64
111 : : "|%-15.3f|%-15.6f|%-11.4f|\n",
112 : 0 : stat->name, calls, objs, stat->dispatch.sched_objs,
113 : 0 : stat->dispatch.sched_fail, stat->realloc_count, objs_per_call,
114 : : objs_per_sec, cycles_per_call);
115 : : } else {
116 : : fprintf(f,
117 : : "|%-31s|%-15" PRIu64 "|%-15" PRIu64 "|%-15" PRIu64
118 : : "|%-15.3f|%-15.6f|%-11.4f|\n",
119 : 0 : stat->name, calls, objs, stat->realloc_count, objs_per_call,
120 : : objs_per_sec, cycles_per_call);
121 : : }
122 : 0 : }
123 : :
124 : : static inline void
125 : 0 : print_xstat(FILE *f, const struct rte_graph_cluster_node_stats *stat, bool dispatch)
126 : : {
127 : : int i;
128 : :
129 [ # # ]: 0 : if (dispatch) {
130 [ # # ]: 0 : for (i = 0; i < stat->xstat_cntrs; i++)
131 : 0 : fprintf(f,
132 : : "|\t%-24s|%15s|%-15" PRIu64 "|%15s|%15s|%15s|%15s|%15s|%11.4s|\n",
133 : 0 : stat->xstat_desc[i], "", stat->xstat_count[i], "", "", "", "", "",
134 : : "");
135 : : } else {
136 [ # # ]: 0 : for (i = 0; i < stat->xstat_cntrs; i++)
137 : 0 : fprintf(f,
138 : : "|\t%-24s|%15s|%-15" PRIu64 "|%15s|%15.3s|%15.6s|%11.4s|\n",
139 : 0 : stat->xstat_desc[i], "", stat->xstat_count[i], "", "", "", "");
140 : : }
141 : 0 : }
142 : :
143 : : static int
144 : 0 : graph_cluster_stats_cb(bool dispatch, bool is_first, bool is_last, void *cookie,
145 : : const struct rte_graph_cluster_node_stats *stat)
146 : : {
147 : : FILE *f = cookie;
148 : :
149 [ # # ]: 0 : if (unlikely(is_first))
150 : : print_banner(f, dispatch);
151 [ # # ]: 0 : if (stat->objs) {
152 : 0 : print_node(f, stat, dispatch);
153 [ # # ]: 0 : if (stat->xstat_cntrs)
154 : 0 : print_xstat(f, stat, dispatch);
155 : : }
156 [ # # ]: 0 : if (unlikely(is_last)) {
157 [ # # ]: 0 : if (dispatch)
158 : : boarder_model_dispatch();
159 : : else
160 : : boarder();
161 : : }
162 : :
163 : 0 : return 0;
164 : : };
165 : :
166 : : static int
167 : 0 : graph_cluster_stats_cb_rtc(bool is_first, bool is_last, void *cookie,
168 : : const struct rte_graph_cluster_node_stats *stat)
169 : : {
170 : 0 : return graph_cluster_stats_cb(false, is_first, is_last, cookie, stat);
171 : : };
172 : :
173 : : static int
174 : 0 : graph_cluster_stats_cb_dispatch(bool is_first, bool is_last, void *cookie,
175 : : const struct rte_graph_cluster_node_stats *stat)
176 : : {
177 : 0 : return graph_cluster_stats_cb(true, is_first, is_last, cookie, stat);
178 : : };
179 : :
180 : : static uint32_t
181 : 1 : cluster_count_nodes(const struct cluster *cluster)
182 : : {
183 : : rte_node_t *nodes = NULL;
184 : : uint32_t max_nodes = 0;
185 : :
186 [ + + ]: 2 : for (unsigned int i = 0; i < cluster->nb_graphs; i++) {
187 : : struct graph_node *graph_node;
188 : :
189 [ + + ]: 6 : STAILQ_FOREACH(graph_node, &cluster->graphs[i]->node_list, next) {
190 : : rte_node_t *new_nodes;
191 : : unsigned int n;
192 : :
193 [ + + ]: 15 : for (n = 0; n < max_nodes; n++) {
194 [ + - ]: 10 : if (nodes[n] != graph_node->node->id)
195 : : continue;
196 : : break;
197 : : }
198 [ - + ]: 5 : if (n != max_nodes)
199 : 0 : continue;
200 : :
201 : 5 : max_nodes++;
202 : 5 : new_nodes = realloc(nodes, max_nodes * sizeof(nodes[0]));
203 [ - + ]: 5 : if (new_nodes == NULL) {
204 : 0 : free(nodes);
205 : 0 : return 0;
206 : : }
207 : : nodes = new_nodes;
208 : 5 : nodes[n] = graph_node->node->id;
209 : : }
210 : : }
211 : 1 : free(nodes);
212 : :
213 : 1 : return max_nodes;
214 : : }
215 : :
216 : : static struct rte_graph_cluster_stats *
217 : 1 : stats_mem_init(struct cluster *cluster,
218 : : const struct rte_graph_cluster_stats_param *prm)
219 : : {
220 : : struct rte_graph_cluster_stats *stats;
221 : : rte_graph_cluster_stats_cb_t fn;
222 : 1 : int socket_id = prm->socket_id;
223 : : uint32_t cluster_node_size;
224 : : uint32_t max_nodes;
225 : :
226 : 1 : max_nodes = cluster_count_nodes(cluster);
227 [ + - ]: 1 : if (max_nodes == 0)
228 : : return NULL;
229 : :
230 : : /* Fix up callback */
231 : 1 : fn = prm->fn;
232 [ - + ]: 1 : if (fn == NULL) {
233 : 0 : const struct rte_graph *graph = cluster->graphs[0]->graph;
234 [ # # ]: 0 : if (graph->model == RTE_GRAPH_MODEL_MCORE_DISPATCH)
235 : : fn = graph_cluster_stats_cb_dispatch;
236 : : else
237 : : fn = graph_cluster_stats_cb_rtc;
238 : : }
239 : :
240 : : cluster_node_size = sizeof(struct cluster_node);
241 : : /* For a given cluster, max nodes will be the max number of graphs */
242 : 1 : cluster_node_size += cluster->nb_graphs * sizeof(struct rte_node *);
243 : 1 : cluster_node_size = RTE_ALIGN(cluster_node_size, RTE_CACHE_LINE_SIZE);
244 : :
245 : 1 : stats = rte_zmalloc_socket(NULL, sizeof(struct rte_graph_cluster_stats) +
246 : 1 : max_nodes * cluster_node_size, 0, socket_id);
247 [ + - ]: 1 : if (stats) {
248 : 1 : stats->fn = fn;
249 : 1 : stats->cluster_node_size = cluster_node_size;
250 : 1 : stats->max_nodes = 0;
251 : 1 : stats->socket_id = socket_id;
252 : 1 : stats->cookie = prm->cookie;
253 : : }
254 : :
255 : : return stats;
256 : : }
257 : :
258 : : static int
259 : 5 : stats_mem_populate(struct rte_graph_cluster_stats *stats,
260 : : struct rte_graph *graph, struct graph_node *graph_node)
261 : : {
262 : 5 : rte_node_t id = graph_node->node->id;
263 : : struct cluster_node *cluster;
264 : : struct rte_node *node;
265 : : rte_node_t count;
266 : : uint8_t i;
267 : :
268 : 5 : cluster = stats->clusters;
269 : :
270 : : /* Iterate over cluster node array to find node ID match */
271 [ + + ]: 15 : for (count = 0; count < stats->max_nodes; count++) {
272 : : /* Found an existing node in the reel */
273 [ - + ]: 10 : if (cluster->stat.id == id) {
274 : 0 : node = graph_node_id_to_ptr(graph, id);
275 [ # # ]: 0 : if (node == NULL)
276 : 0 : SET_ERR_JMP(
277 : : ENOENT, err,
278 : : "Failed to find node %s in graph %s",
279 : : graph_node->node->name, graph->name);
280 : :
281 : 0 : cluster->nodes[cluster->nb_nodes++] = node;
282 : 0 : return 0;
283 : : }
284 : 10 : cluster = RTE_PTR_ADD(cluster, stats->cluster_node_size);
285 : : }
286 : :
287 : 5 : memcpy(cluster->stat.name, graph_node->node->name, RTE_NODE_NAMESIZE);
288 : 5 : cluster->stat.id = graph_node->node->id;
289 : 5 : cluster->stat.hz = rte_get_timer_hz();
290 : 5 : node = graph_node_id_to_ptr(graph, id);
291 [ - + ]: 5 : if (node == NULL)
292 : 0 : SET_ERR_JMP(ENOENT, err, "Failed to find node %s in graph %s",
293 : : graph_node->node->name, graph->name);
294 : 5 : cluster->nodes[cluster->nb_nodes++] = node;
295 [ - + ]: 5 : if (graph_node->node->xstats) {
296 : 0 : cluster->stat.xstat_cntrs = graph_node->node->xstats->nb_xstats;
297 : 0 : cluster->stat.xstat_count = rte_zmalloc_socket(NULL,
298 : 0 : sizeof(uint64_t) * graph_node->node->xstats->nb_xstats,
299 : : RTE_CACHE_LINE_SIZE, stats->socket_id);
300 [ # # ]: 0 : if (cluster->stat.xstat_count == NULL)
301 : 0 : SET_ERR_JMP(ENOMEM, err, "Failed to allocate memory node %s graph %s",
302 : : graph_node->node->name, graph->name);
303 : :
304 : 0 : cluster->stat.xstat_desc = rte_zmalloc_socket(NULL,
305 : 0 : sizeof(RTE_NODE_XSTAT_DESC_SIZE) * graph_node->node->xstats->nb_xstats,
306 : : RTE_CACHE_LINE_SIZE, stats->socket_id);
307 [ # # ]: 0 : if (cluster->stat.xstat_desc == NULL) {
308 : 0 : rte_free(cluster->stat.xstat_count);
309 : 0 : SET_ERR_JMP(ENOMEM, err, "Failed to allocate memory node %s graph %s",
310 : : graph_node->node->name, graph->name);
311 : : }
312 : :
313 [ # # ]: 0 : for (i = 0; i < cluster->stat.xstat_cntrs; i++) {
314 [ # # ]: 0 : if (rte_strscpy(cluster->stat.xstat_desc[i],
315 : 0 : graph_node->node->xstats->xstat_desc[i],
316 : : RTE_NODE_XSTAT_DESC_SIZE) < 0) {
317 : 0 : rte_free(cluster->stat.xstat_count);
318 : 0 : rte_free(cluster->stat.xstat_desc);
319 : 0 : SET_ERR_JMP(E2BIG, err,
320 : : "Error description overflow node %s graph %s",
321 : : graph_node->node->name, graph->name);
322 : : }
323 : : }
324 : : }
325 : :
326 : 5 : stats->max_nodes++;
327 : :
328 : 5 : return 0;
329 : 0 : err:
330 : 0 : return -rte_errno;
331 : : }
332 : :
333 : : static void
334 : : cluster_init(struct cluster *cluster)
335 : : {
336 : : memset(cluster, 0, sizeof(*cluster));
337 : : }
338 : :
339 : : static int
340 : 1 : cluster_add(struct cluster *cluster, struct graph *graph)
341 : : {
342 : : rte_graph_t count;
343 : : size_t sz;
344 : :
345 : : /* Skip the if graph is already added to cluster */
346 [ - + ]: 1 : for (count = 0; count < cluster->nb_graphs; count++)
347 [ # # ]: 0 : if (cluster->graphs[count] == graph)
348 : : return 0;
349 : :
350 : : /* Expand the cluster if required to store graph objects */
351 [ + - ]: 1 : if (cluster->nb_graphs + 1 > cluster->size) {
352 : 1 : cluster->size = RTE_MAX(1, cluster->size * 2);
353 : 1 : sz = sizeof(struct graph *) * cluster->size;
354 : 1 : cluster->graphs = realloc(cluster->graphs, sz);
355 [ - + ]: 1 : if (cluster->graphs == NULL)
356 : 0 : SET_ERR_JMP(ENOMEM, free, "Failed to realloc");
357 : : }
358 : :
359 : : /* Add graph to cluster */
360 : 1 : cluster->graphs[cluster->nb_graphs++] = graph;
361 : 1 : return 0;
362 : :
363 : : free:
364 : 0 : return -rte_errno;
365 : : }
366 : :
367 : : static void
368 : : cluster_fini(struct cluster *cluster)
369 : : {
370 : 1 : free(cluster->graphs);
371 : 1 : }
372 : :
373 : : static int
374 : 1 : expand_pattern_to_cluster(struct cluster *cluster, const char *pattern)
375 : : {
376 : 1 : struct graph_head *graph_head = graph_list_head_get();
377 : : struct graph *graph;
378 : : bool found = false;
379 : :
380 : : /* Check for pattern match */
381 [ + + ]: 2 : STAILQ_FOREACH(graph, graph_head, next) {
382 [ + - ]: 1 : if (fnmatch(pattern, graph->name, 0) == 0) {
383 [ - + ]: 1 : if (cluster_add(cluster, graph))
384 : 0 : goto fail;
385 : : found = true;
386 : : }
387 : : }
388 [ - + ]: 1 : if (found == false)
389 : 0 : SET_ERR_JMP(EFAULT, fail, "Pattern %s graph not found",
390 : : pattern);
391 : :
392 : : return 0;
393 : 0 : fail:
394 : 0 : return -rte_errno;
395 : : }
396 : :
397 : : RTE_EXPORT_SYMBOL(rte_graph_cluster_stats_create)
398 : : struct rte_graph_cluster_stats *
399 : 1 : rte_graph_cluster_stats_create(const struct rte_graph_cluster_stats_param *prm)
400 : : {
401 : : struct rte_graph_cluster_stats *stats, *rc = NULL;
402 : : struct cluster cluster;
403 : : rte_graph_t i;
404 : :
405 : : /* Sanity checks */
406 : : if (!rte_graph_has_stats_feature())
407 : : SET_ERR_JMP(EINVAL, fail, "Stats feature is not enabled");
408 : :
409 [ - + ]: 1 : if (prm == NULL)
410 : 0 : SET_ERR_JMP(EINVAL, fail, "Invalid param");
411 : :
412 [ + - - + ]: 1 : if (prm->graph_patterns == NULL || prm->nb_graph_patterns == 0)
413 : 0 : SET_ERR_JMP(EINVAL, fail, "Invalid graph param");
414 : :
415 : : cluster_init(&cluster);
416 : :
417 : 1 : graph_spinlock_lock();
418 : : /* Expand graph pattern and add the graph to the cluster */
419 [ + + ]: 2 : for (i = 0; i < prm->nb_graph_patterns; i++) {
420 [ - + ]: 1 : if (expand_pattern_to_cluster(&cluster, prm->graph_patterns[i]))
421 : 0 : goto bad_pattern;
422 : : }
423 : :
424 : : /* Alloc the stats memory */
425 : 1 : stats = stats_mem_init(&cluster, prm);
426 [ + - ]: 1 : if (stats == NULL)
427 : 0 : SET_ERR_JMP(ENOMEM, bad_pattern, "Failed rte_malloc for stats memory");
428 : :
429 : : /* Iterate over M(Graph) x N (Nodes in graph) */
430 [ + + ]: 2 : for (i = 0; i < cluster.nb_graphs; i++) {
431 : : struct graph_node *graph_node;
432 : : struct graph *graph;
433 : :
434 : 1 : graph = cluster.graphs[i];
435 [ + + ]: 6 : STAILQ_FOREACH(graph_node, &graph->node_list, next) {
436 : 5 : struct rte_graph *graph_fp = graph->graph;
437 [ - + ]: 5 : if (stats_mem_populate(stats, graph_fp, graph_node))
438 : 0 : goto realloc_fail;
439 : : }
440 [ + - ]: 1 : if (graph->graph->model == RTE_GRAPH_MODEL_MCORE_DISPATCH)
441 : 1 : stats->dispatch = true;
442 : : }
443 : :
444 : : rc = stats;
445 : : stats = NULL;
446 : :
447 : 1 : realloc_fail:
448 [ + - ]: 1 : if (stats != NULL)
449 : 0 : rte_graph_cluster_stats_destroy(stats);
450 : 1 : bad_pattern:
451 : 1 : graph_spinlock_unlock();
452 : : cluster_fini(&cluster);
453 : 1 : fail:
454 : 1 : return rc;
455 : : }
456 : :
457 : : RTE_EXPORT_SYMBOL(rte_graph_cluster_stats_destroy)
458 : : void
459 : 1 : rte_graph_cluster_stats_destroy(struct rte_graph_cluster_stats *stat)
460 : : {
461 : : struct cluster_node *cluster;
462 : : rte_node_t count;
463 : :
464 : 1 : cluster = stat->clusters;
465 [ + + ]: 6 : for (count = 0; count < stat->max_nodes; count++) {
466 [ - + ]: 5 : if (cluster->stat.xstat_cntrs) {
467 : 0 : rte_free(cluster->stat.xstat_count);
468 : 0 : rte_free(cluster->stat.xstat_desc);
469 : : }
470 : :
471 : 5 : cluster = RTE_PTR_ADD(cluster, stat->cluster_node_size);
472 : : }
473 : 1 : return rte_free(stat);
474 : : }
475 : :
476 : : static inline void
477 : 5 : cluster_node_arregate_stats(struct cluster_node *cluster, bool dispatch)
478 : : {
479 : : uint64_t calls = 0, cycles = 0, objs = 0, realloc_count = 0;
480 : : struct rte_graph_cluster_node_stats *stat = &cluster->stat;
481 : : uint64_t sched_objs = 0, sched_fail = 0;
482 : : struct rte_node *node;
483 : : rte_node_t count;
484 : : uint64_t *xstat;
485 : : uint8_t i;
486 : :
487 [ - + ]: 5 : if (stat->xstat_cntrs != 0)
488 : 0 : memset(stat->xstat_count, 0, sizeof(uint64_t) * stat->xstat_cntrs);
489 [ + + ]: 10 : for (count = 0; count < cluster->nb_nodes; count++) {
490 : 5 : node = cluster->nodes[count];
491 : :
492 [ + - ]: 5 : if (dispatch) {
493 : 5 : sched_objs += node->dispatch.total_sched_objs;
494 : 5 : sched_fail += node->dispatch.total_sched_fail;
495 : : }
496 : :
497 : 5 : calls += node->total_calls;
498 : 5 : objs += node->total_objs;
499 : 5 : cycles += node->total_cycles;
500 : 5 : realloc_count += node->realloc_count;
501 : :
502 [ + - ]: 5 : if (node->xstat_off == 0)
503 : 5 : continue;
504 : 0 : xstat = RTE_PTR_ADD(node, node->xstat_off);
505 [ # # ]: 0 : for (i = 0; i < stat->xstat_cntrs; i++)
506 : 0 : stat->xstat_count[i] += xstat[i];
507 : : }
508 : :
509 : 5 : stat->calls = calls;
510 : 5 : stat->objs = objs;
511 : 5 : stat->cycles = cycles;
512 : :
513 [ + - ]: 5 : if (dispatch) {
514 : 5 : stat->dispatch.sched_objs = sched_objs;
515 : 5 : stat->dispatch.sched_fail = sched_fail;
516 : : }
517 : :
518 : 5 : stat->ts = rte_get_timer_cycles();
519 : 5 : stat->realloc_count = realloc_count;
520 : 5 : }
521 : :
522 : : static inline void
523 : : cluster_node_store_prev_stats(struct cluster_node *cluster)
524 : : {
525 : : struct rte_graph_cluster_node_stats *stat = &cluster->stat;
526 : :
527 : 5 : stat->prev_ts = stat->ts;
528 : 5 : stat->prev_calls = stat->calls;
529 : 5 : stat->prev_objs = stat->objs;
530 : 5 : stat->prev_cycles = stat->cycles;
531 : : }
532 : :
533 : : RTE_EXPORT_SYMBOL(rte_graph_cluster_stats_get)
534 : : void
535 : 1 : rte_graph_cluster_stats_get(struct rte_graph_cluster_stats *stat, bool skip_cb)
536 : : {
537 : : struct cluster_node *cluster;
538 : : rte_node_t count;
539 : : int rc = 0;
540 : :
541 : 1 : cluster = stat->clusters;
542 : :
543 [ + + ]: 6 : for (count = 0; count < stat->max_nodes; count++) {
544 : 5 : cluster_node_arregate_stats(cluster, stat->dispatch);
545 [ + - ]: 5 : if (!skip_cb)
546 : 5 : rc = stat->fn(!count, (count == stat->max_nodes - 1),
547 : 5 : stat->cookie, &cluster->stat);
548 : : cluster_node_store_prev_stats(cluster);
549 [ + - ]: 5 : if (rc)
550 : : break;
551 : 5 : cluster = RTE_PTR_ADD(cluster, stat->cluster_node_size);
552 : : }
553 : 1 : }
554 : :
555 : : RTE_EXPORT_SYMBOL(rte_graph_cluster_stats_reset)
556 : : void
557 : 0 : rte_graph_cluster_stats_reset(struct rte_graph_cluster_stats *stat)
558 : : {
559 : : struct cluster_node *cluster;
560 : : rte_node_t count;
561 : : uint8_t i;
562 : :
563 : 0 : cluster = stat->clusters;
564 : :
565 [ # # ]: 0 : for (count = 0; count < stat->max_nodes; count++) {
566 : : struct rte_graph_cluster_node_stats *node = &cluster->stat;
567 : :
568 : 0 : node->ts = 0;
569 : 0 : node->calls = 0;
570 : 0 : node->objs = 0;
571 : 0 : node->cycles = 0;
572 : 0 : node->prev_ts = 0;
573 : 0 : node->prev_calls = 0;
574 : 0 : node->prev_objs = 0;
575 : 0 : node->prev_cycles = 0;
576 : 0 : node->realloc_count = 0;
577 [ # # ]: 0 : for (i = 0; i < node->xstat_cntrs; i++)
578 : 0 : node->xstat_count[i] = 0;
579 : 0 : cluster = RTE_PTR_ADD(cluster, stat->cluster_node_size);
580 : : }
581 : 0 : }
|