trace: add memzone tracepoints

Add the following memzone related tracepoints.

- rte_eal_trace_memzone_reserve()
- rte_eal_trace_memzone_lookup()
- rte_eal_trace_memzone_free()

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Acked-by: David Marchand <david.marchand@redhat.com>
This commit is contained in:
Jerin Jacob 2020-04-23 00:33:36 +05:30 committed by David Marchand
parent 52f409d614
commit 402321cfca
4 changed files with 52 additions and 0 deletions

View File

@ -19,6 +19,7 @@
#include <rte_errno.h>
#include <rte_string_fns.h>
#include <rte_common.h>
#include <rte_eal_trace.h>
#include "malloc_heap.h"
#include "malloc_elem.h"
@ -201,6 +202,9 @@ rte_memzone_reserve_thread_safe(const char *name, size_t len, int socket_id,
mz = memzone_reserve_aligned_thread_unsafe(
name, len, socket_id, flags, align, bound);
rte_eal_trace_memzone_reserve(name, len, socket_id, flags, align,
bound, mz);
rte_rwlock_write_unlock(&mcfg->mlock);
return mz;
@ -246,6 +250,7 @@ rte_memzone_reserve(const char *name, size_t len, int socket_id,
int
rte_memzone_free(const struct rte_memzone *mz)
{
char name[RTE_MEMZONE_NAMESIZE];
struct rte_mem_config *mcfg;
struct rte_fbarray *arr;
struct rte_memzone *found_mz;
@ -256,6 +261,7 @@ rte_memzone_free(const struct rte_memzone *mz)
if (mz == NULL)
return -EINVAL;
rte_strlcpy(name, mz->name, RTE_MEMZONE_NAMESIZE);
mcfg = rte_eal_get_configuration()->mem_config;
arr = &mcfg->memzones;
@ -280,6 +286,7 @@ rte_memzone_free(const struct rte_memzone *mz)
if (addr != NULL)
rte_free(addr);
rte_eal_trace_memzone_free(name, addr, ret);
return ret;
}
@ -300,6 +307,7 @@ rte_memzone_lookup(const char *name)
rte_rwlock_read_unlock(&mcfg->mlock);
rte_eal_trace_memzone_lookup(name, memzone);
return memzone;
}

View File

@ -31,6 +31,10 @@ RTE_TRACE_POINT_DEFINE(rte_eal_trace_mem_malloc);
RTE_TRACE_POINT_DEFINE(rte_eal_trace_mem_realloc);
RTE_TRACE_POINT_DEFINE(rte_eal_trace_mem_free);
RTE_TRACE_POINT_DEFINE(rte_eal_trace_memzone_reserve);
RTE_TRACE_POINT_DEFINE(rte_eal_trace_memzone_lookup);
RTE_TRACE_POINT_DEFINE(rte_eal_trace_memzone_free);
RTE_INIT(eal_trace_init)
{
RTE_TRACE_POINT_REGISTER(rte_eal_trace_generic_void,
@ -79,4 +83,11 @@ RTE_INIT(eal_trace_init)
lib.eal.mem.realloc);
RTE_TRACE_POINT_REGISTER(rte_eal_trace_mem_free,
lib.eal.mem.free);
RTE_TRACE_POINT_REGISTER(rte_eal_trace_memzone_reserve,
lib.eal.memzone.reserve);
RTE_TRACE_POINT_REGISTER(rte_eal_trace_memzone_lookup,
lib.eal.memzone.lookup);
RTE_TRACE_POINT_REGISTER(rte_eal_trace_memzone_free,
lib.eal.memzone.free);
}

View File

@ -175,6 +175,36 @@ RTE_TRACE_POINT(
rte_trace_point_emit_ptr(ptr);
)
/* Memzone */
RTE_TRACE_POINT(
rte_eal_trace_memzone_reserve,
RTE_TRACE_POINT_ARGS(const char *name, size_t len, int socket_id,
unsigned int flags, unsigned int align, unsigned int bound,
const void *mz),
rte_trace_point_emit_string(name);
rte_trace_point_emit_long(len);
rte_trace_point_emit_int(socket_id);
rte_trace_point_emit_u32(flags);
rte_trace_point_emit_u32(align);
rte_trace_point_emit_u32(bound);
rte_trace_point_emit_ptr(mz);
)
RTE_TRACE_POINT(
rte_eal_trace_memzone_lookup,
RTE_TRACE_POINT_ARGS(const char *name, const void *memzone),
rte_trace_point_emit_string(name);
rte_trace_point_emit_ptr(memzone);
)
RTE_TRACE_POINT(
rte_eal_trace_memzone_free,
RTE_TRACE_POINT_ARGS(const char *name, void *addr, int rc),
rte_trace_point_emit_string(name);
rte_trace_point_emit_ptr(addr);
rte_trace_point_emit_int(rc);
)
#ifdef __cplusplus
}
#endif

View File

@ -359,6 +359,9 @@ EXPERIMENTAL {
__rte_eal_trace_mem_malloc;
__rte_eal_trace_mem_realloc;
__rte_eal_trace_mem_zmalloc;
__rte_eal_trace_memzone_free;
__rte_eal_trace_memzone_lookup;
__rte_eal_trace_memzone_reserve;
__rte_trace_mem_per_thread_alloc;
__rte_trace_point_emit_field;
__rte_trace_point_register;