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