MCPcopy Create free account
hub / github.com/F-Stack/f-stack / rte_graph_cluster_stats_create

Function rte_graph_cluster_stats_create

dpdk/lib/graph/graph_stats.c:325–386  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

323}
324
325struct rte_graph_cluster_stats *
326rte_graph_cluster_stats_create(const struct rte_graph_cluster_stats_param *prm)
327{
328 struct rte_graph_cluster_stats *stats, *rc = NULL;
329 struct graph_node *graph_node;
330 struct cluster cluster;
331 struct graph *graph;
332 const char *pattern;
333 rte_graph_t i;
334
335 /* Sanity checks */
336 if (!rte_graph_has_stats_feature())
337 SET_ERR_JMP(EINVAL, fail, "Stats feature is not enabled");
338
339 if (prm == NULL)
340 SET_ERR_JMP(EINVAL, fail, "Invalid param");
341
342 if (prm->graph_patterns == NULL || prm->nb_graph_patterns == 0)
343 SET_ERR_JMP(EINVAL, fail, "Invalid graph param");
344
345 cluster_init(&cluster);
346
347 graph_spinlock_lock();
348 /* Expand graph pattern and add the graph to the cluster */
349 for (i = 0; i < prm->nb_graph_patterns; i++) {
350 pattern = prm->graph_patterns[i];
351 if (expand_pattern_to_cluster(&cluster, pattern))
352 goto bad_pattern;
353 }
354
355 /* Alloc the stats memory */
356 stats = stats_mem_init(&cluster, prm);
357 if (stats == NULL)
358 SET_ERR_JMP(ENOMEM, bad_pattern, "Failed alloc stats memory");
359
360 /* Iterate over M(Graph) x N (Nodes in graph) */
361 for (i = 0; i < cluster.nb_graphs; i++) {
362 graph = cluster.graphs[i];
363 STAILQ_FOREACH(graph_node, &graph->node_list, next) {
364 struct rte_graph *graph_fp = graph->graph;
365 if (stats_mem_populate(&stats, graph_fp, graph_node))
366 goto realloc_fail;
367 }
368 if (graph->graph->model == RTE_GRAPH_MODEL_MCORE_DISPATCH)
369 stats->dispatch = true;
370 }
371
372 /* Finally copy to hugepage memory to avoid pressure on rte_realloc */
373 rc = rte_malloc_socket(NULL, stats->sz, 0, stats->socket_id);
374 if (rc)
375 rte_memcpy(rc, stats, stats->sz);
376 else
377 SET_ERR_JMP(ENOMEM, realloc_fail, "rte_malloc failed");
378
379realloc_fail:
380 stats_mem_fini(stats);
381bad_pattern:
382 graph_spinlock_unlock();

Callers 5

measure_perf_getFunction · 0.85
test_print_statsFunction · 0.85
graph_stats_printFunction · 0.85
print_statsFunction · 0.85

Calls 11

graph_spinlock_lockFunction · 0.85
stats_mem_initFunction · 0.85
stats_mem_populateFunction · 0.85
rte_malloc_socketFunction · 0.85
stats_mem_finiFunction · 0.85
graph_spinlock_unlockFunction · 0.85
cluster_finiFunction · 0.85
cluster_initFunction · 0.70
rte_memcpyFunction · 0.50

Tested by 2

measure_perf_getFunction · 0.68
test_print_statsFunction · 0.68