* Print stats on memory type. If type is NULL, info on all types is printed */
| 327 | * Print stats on memory type. If type is NULL, info on all types is printed |
| 328 | */ |
| 329 | void |
| 330 | rte_malloc_dump_stats(FILE *f, __rte_unused const char *type) |
| 331 | { |
| 332 | struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config; |
| 333 | unsigned int heap_id; |
| 334 | struct rte_malloc_socket_stats sock_stats; |
| 335 | |
| 336 | /* Iterate through all initialised heaps */ |
| 337 | for (heap_id = 0; heap_id < RTE_MAX_HEAPS; heap_id++) { |
| 338 | struct malloc_heap *heap = &mcfg->malloc_heaps[heap_id]; |
| 339 | |
| 340 | malloc_heap_get_stats(heap, &sock_stats); |
| 341 | |
| 342 | fprintf(f, "Heap id:%u\n", heap_id); |
| 343 | fprintf(f, "\tHeap name:%s\n", heap->name); |
| 344 | fprintf(f, "\tHeap_size:%zu,\n", sock_stats.heap_totalsz_bytes); |
| 345 | fprintf(f, "\tFree_size:%zu,\n", sock_stats.heap_freesz_bytes); |
| 346 | fprintf(f, "\tAlloc_size:%zu,\n", sock_stats.heap_allocsz_bytes); |
| 347 | fprintf(f, "\tGreatest_free_size:%zu,\n", |
| 348 | sock_stats.greatest_free_size); |
| 349 | fprintf(f, "\tAlloc_count:%u,\n",sock_stats.alloc_count); |
| 350 | fprintf(f, "\tFree_count:%u,\n", sock_stats.free_count); |
| 351 | } |
| 352 | return; |
| 353 | } |
| 354 | |
| 355 | /* |
| 356 | * Return the IO address of a virtual address obtained through rte_malloc |