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

Function graph_node_count_edges

dpdk/app/test/test_graph_perf.c:284–314  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

282}
283
284static uint16_t
285graph_node_count_edges(uint32_t stage, uint16_t node, uint16_t nodes_per_stage,
286 uint8_t edge_map[][nodes_per_stage][nodes_per_stage],
287 char *ename[], struct test_node_data *node_data,
288 rte_node_t **node_map)
289{
290 uint8_t total_percent = 0;
291 uint16_t edges = 0;
292 int i;
293
294 for (i = 0; i < nodes_per_stage && edges < MAX_EDGES_PER_NODE; i++) {
295 if (edge_map[stage + 1][i][node]) {
296 ename[edges] = malloc(sizeof(char) * RTE_NODE_NAMESIZE);
297 snprintf(ename[edges], RTE_NODE_NAMESIZE, "%s",
298 rte_node_id_to_name(node_map[stage + 1][i]));
299 node_data->next_nodes[edges] = node_map[stage + 1][i];
300 node_data->next_percentage[edges] =
301 edge_map[stage + 1][i][node];
302 edges++;
303 total_percent += edge_map[stage + 1][i][node];
304 }
305 }
306
307 if (edges >= MAX_EDGES_PER_NODE || (edges && total_percent != 100)) {
308 for (i = 0; i < edges; i++)
309 free(ename[i]);
310 return RTE_EDGE_ID_INVALID;
311 }
312
313 return edges;
314}
315
316static int
317graph_init(const char *gname, uint8_t nb_srcs, uint8_t nb_sinks,

Callers 1

graph_initFunction · 0.85

Calls 4

mallocFunction · 0.85
snprintfFunction · 0.85
rte_node_id_to_nameFunction · 0.85
freeFunction · 0.50

Tested by

no test coverage detected