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

Function stats_mem_init

dpdk/lib/graph/graph_stats.c:158–195  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

156};
157
158static struct rte_graph_cluster_stats *
159stats_mem_init(struct cluster *cluster,
160 const struct rte_graph_cluster_stats_param *prm)
161{
162 size_t sz = sizeof(struct rte_graph_cluster_stats);
163 struct rte_graph_cluster_stats *stats;
164 rte_graph_cluster_stats_cb_t fn;
165 int socket_id = prm->socket_id;
166 uint32_t cluster_node_size;
167
168 /* Fix up callback */
169 fn = prm->fn;
170 if (fn == NULL) {
171 const struct rte_graph *graph = cluster->graphs[0]->graph;
172 if (graph->model == RTE_GRAPH_MODEL_MCORE_DISPATCH)
173 fn = graph_cluster_stats_cb_dispatch;
174 else
175 fn = graph_cluster_stats_cb_rtc;
176 }
177
178 cluster_node_size = sizeof(struct cluster_node);
179 /* For a given cluster, max nodes will be the max number of graphs */
180 cluster_node_size += cluster->nb_graphs * sizeof(struct rte_node *);
181 cluster_node_size = RTE_ALIGN(cluster_node_size, RTE_CACHE_LINE_SIZE);
182
183 stats = realloc(NULL, sz);
184 if (stats) {
185 memset(stats, 0, sz);
186 stats->fn = fn;
187 stats->cluster_node_size = cluster_node_size;
188 stats->max_nodes = 0;
189 stats->socket_id = socket_id;
190 stats->cookie = prm->cookie;
191 stats->sz = sz;
192 }
193
194 return stats;
195}
196
197static int
198stats_mem_populate(struct rte_graph_cluster_stats **stats_in,

Callers 1

Calls 2

memsetFunction · 0.85
reallocFunction · 0.50

Tested by

no test coverage detected