1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

add debug statements to memory functions

This commit is contained in:
Steffen Vogel 2016-10-19 01:34:27 -04:00
parent 8e88493fb8
commit 6e13d5a895
2 changed files with 7 additions and 9 deletions

View file

@ -38,6 +38,7 @@ enum debug_facilities {
DBG_CONFIG = (1 << 10),
DBG_HOOK = (1 << 11),
DBG_PATH = (1 << 12),
DBG_MEM = (1 << 13),
/* Node-types */
DBG_SOCKET = (1 << 16),

View file

@ -19,23 +19,20 @@
void * memory_alloc(const struct memtype *m, size_t len)
{
debug(DBG_MEM | 2, "Allocating %zu byte of %s memory", len, m->name);
return m->alloc(len);
}
void * memory_alloc_aligned(const struct memtype *m, size_t len, size_t alignment)
{
warn("memory_alloc_aligned: not implemented yet!");
return memory_alloc(m, len);
}
void * memory_aligned_alloc(const struct memtype *m, size_t len, size_t align)
{
warn("memory_aligned_alloc: not implemented yet. Falling back to unaligned version.");
debug(DBG_MEM | 2, "Allocating %zu byte of %zu-byte-aligned %s memory", len, alignment, m->name);
warn("%s: not implemented yet!", __FUNCTION__);
return memory_alloc(m, len);
}
int memory_free(const struct memtype *m, void *ptr, size_t len)
{
debug(DBG_MEM | 2, "Releasing %zu bytes of %s memory", len, m->name);
return m->free(ptr, len);
}
@ -85,7 +82,7 @@ const struct memtype memtype_hugepage = {
.flags = MEMORY_MMAP | MEMORY_HUGEPAGE,
.alloc = memory_hugepage_alloc,
.free = memory_hugepage_free,
.alignment = 1 << 21 /* 2 MiB hugepage */
.alignment = 21 /* 2 MiB hugepage */
};
/** @todo */
@ -93,5 +90,5 @@ const struct memtype memtype_dma = {
.name = "dma",
.flags = MEMORY_DMA | MEMORY_MMAP,
.alloc = NULL, .free = NULL,
.alignment = 1 << 12
.alignment = 12
};