Commit a85f36b3 authored by Seth Howell's avatar Seth Howell Committed by Tomasz Zawadzki
Browse files

env: add a new function for printing memory layout



This is a useful utility function.

The end goal of this patch series is to create a python utility that can
be called upon to dump information about DPDK allocated memory in a
human readable way.

Change-Id: I18978732c9decbb39dce5b5151f5eff6b59f6591
Signed-off-by: default avatarSeth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/477510


Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
parent 164151c7
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -35,6 +35,8 @@
 * Encapsulated DPDK specific dependencies
 */

#include "spdk/stdinc.h"

#ifndef SPDK_ENV_DPDK_H
#define SPDK_ENV_DPDK_H

@@ -70,6 +72,13 @@ void spdk_env_dpdk_post_fini(void);
 */
bool spdk_env_dpdk_external_init(void);

/**
 * Dump the env allocated memory to the given file.
 *
 * \param file The file object to write to.
 */
void spdk_env_dpdk_dump_mem_stats(FILE *file);

#ifdef __cplusplus
}
#endif
+17 −0
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@

#include "spdk/stdinc.h"
#include "spdk/util.h"
#include "spdk/env_dpdk.h"

#include "env_internal.h"

@@ -437,3 +438,19 @@ spdk_ring_dequeue(struct spdk_ring *ring, void **objs, size_t count)
{
	return rte_ring_dequeue_burst((struct rte_ring *)ring, objs, count, NULL);
}

void
spdk_env_dpdk_dump_mem_stats(FILE *file)
{
	fprintf(file, "DPDK memory size %lu\n", rte_eal_get_physmem_size());
	fprintf(file, "DPDK memory layout\n");
	rte_dump_physmem_layout(file);
	fprintf(file, "DPDK memzones.\n");
	rte_memzone_dump(file);
	fprintf(file, "DPDK mempools.\n");
	rte_mempool_list_dump(file);
	fprintf(file, "DPDK malloc stats.\n");
	rte_malloc_dump_stats(file, NULL);
	fprintf(file, "DPDK malloc heaps.\n");
	rte_malloc_dump_heaps(file);
}