mem logs added

pull/378/head
adroitx 2 years ago
parent d0c781a307
commit 7f5e56dbe4

@ -57,7 +57,7 @@ CFLAGS += -DLOG_TO_FILE
# Various Informational Logs for Debugging
# CFLAGS += -DLOG_ADMISSIONS_CONTROL
# CFLAGS += -DLOG_CONTEXT_SWITCHES
CFLAGS += -DLOG_CONTEXT_SWITCHES
# CFLAGS += -DLOG_HTTP_PARSER
CFLAGS += -DLOG_TENANT_LOADING
# CFLAGS += -DLOG_PREEMPTION
@ -73,7 +73,7 @@ CFLAGS += -DLOG_STATE_CHANGES
# This dumps per module *.csv files containing the cycle a sandbox has been in RUNNING when each
# page is allocated. This helps understand the relationship to memory allocation and execution time.
CFLAGS += -DLOG_SANDBOX_MEMORY_PROFILE
# CFLAGS += -DLOG_SANDBOX_MEMORY_PROFILE
# This flag enables runtime-level metrics from procfs
CFLAGS += -DPROC_STAT_METRICS

@ -8,6 +8,7 @@
#include "admissions_control.h"
#include "admissions_info.h"
#include "current_wasm_module_instance.h"
#include "debuglog.h"
#include "panic.h"
#include "pool.h"
#include "sledge_abi_symbols.h"
@ -211,6 +212,7 @@ module_allocate_linear_memory(struct module *module)
static inline void
module_free_linear_memory(struct module *module, struct wasm_memory *memory)
{
debuglog("Sandbox freeing %d memory\n", (int32_t)memory->size);
wasm_memory_reinit(memory, module->abi.starting_pages * WASM_PAGE_SIZE);
wasm_memory_pool_add_nolock(&module->pools[worker_thread_idx].memory, memory);
}

@ -37,7 +37,8 @@ sandbox_allocate_linear_memory(struct sandbox *sandbox)
assert(sandbox != NULL);
sandbox->memory = module_allocate_linear_memory(sandbox->module);
if (unlikely(sandbox->memory == NULL)) return -1;
debuglog("Sandbox %lu: of %s %s\n", sandbox->id, sandbox->tenant->name, sandbox->route->route);
debuglog("Sandbox initialized with memory %d\n", (int32_t)sandbox->memory->size);
return 0;
}

Loading…
Cancel
Save