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

Function dump_socket_mem

dpdk/app/test-flow-perf/main.c:999–1052  ·  view source on GitHub ↗

Dump the socket memory statistics on console */

Source from the content-addressed store, hash-verified

997
998/* Dump the socket memory statistics on console */
999static size_t
1000dump_socket_mem(FILE *f)
1001{
1002 struct rte_malloc_socket_stats socket_stats;
1003 unsigned int i = 0;
1004 size_t total = 0;
1005 size_t alloc = 0;
1006 size_t free = 0;
1007 unsigned int n_alloc = 0;
1008 unsigned int n_free = 0;
1009 bool active_nodes = false;
1010
1011
1012 for (i = 0; i < RTE_MAX_NUMA_NODES; i++) {
1013 if (rte_malloc_get_socket_stats(i, &socket_stats) ||
1014 !socket_stats.heap_totalsz_bytes)
1015 continue;
1016 active_nodes = true;
1017 total += socket_stats.heap_totalsz_bytes;
1018 alloc += socket_stats.heap_allocsz_bytes;
1019 free += socket_stats.heap_freesz_bytes;
1020 n_alloc += socket_stats.alloc_count;
1021 n_free += socket_stats.free_count;
1022 if (dump_socket_mem_flag) {
1023 fprintf(f, "::::::::::::::::::::::::::::::::::::::::");
1024 fprintf(f,
1025 "\nSocket %u:\nsize(M) total: %.6lf\nalloc:"
1026 " %.6lf(%.3lf%%)\nfree: %.6lf"
1027 "\nmax: %.6lf"
1028 "\ncount alloc: %u\nfree: %u\n",
1029 i,
1030 socket_stats.heap_totalsz_bytes / 1.0e6,
1031 socket_stats.heap_allocsz_bytes / 1.0e6,
1032 (double)socket_stats.heap_allocsz_bytes * 100 /
1033 (double)socket_stats.heap_totalsz_bytes,
1034 socket_stats.heap_freesz_bytes / 1.0e6,
1035 socket_stats.greatest_free_size / 1.0e6,
1036 socket_stats.alloc_count,
1037 socket_stats.free_count);
1038 fprintf(f, "::::::::::::::::::::::::::::::::::::::::");
1039 }
1040 }
1041 if (dump_socket_mem_flag && active_nodes) {
1042 fprintf(f,
1043 "\nTotal: size(M)\ntotal: %.6lf"
1044 "\nalloc: %.6lf(%.3lf%%)\nfree: %.6lf"
1045 "\ncount alloc: %u\nfree: %u\n",
1046 total / 1.0e6, alloc / 1.0e6,
1047 (double)alloc * 100 / (double)total, free / 1.0e6,
1048 n_alloc, n_free);
1049 fprintf(f, "::::::::::::::::::::::::::::::::::::::::\n");
1050 }
1051 return alloc;
1052}
1053
1054static void
1055print_flow_error(struct rte_flow_error error)

Callers 1

flows_handlerFunction · 0.70

Calls 1

Tested by

no test coverage detected