runners: A number of stack/heap measurement tweaks

- Renamed BENCH_STACK/HEAP -> BENCH_STACK/HEAP_WATERMARK

- Renamed BENCH_YES_STACK/HEAP -> BENCH_STACK/HEAP

- Tweaked stack/heap watermarks to hopefully be easier to access when
  debugging. Now also exposed as global variables
  (bench_stack/heap_watermark).

  I considered changing BENCH_STACK/HEAP_WATERMARK to be the variable
  itself, to be consistent with TEST_PLS, but decided against it:

  1. BENCH_STACK_CURRENT() is a bit magic in that it relies on
     __attribute__((noinline)) to force a new stack frame. This wouldn't
     really be possible with a variable.

  2. TEST_PLS is at least constant from the _current run_'s perspective.
     This isn't true for the stack/heap watermarks.

- Reworked internals a bit to hopefully be simpler
This commit is contained in:
Christopher Haster
2026-02-05 23:24:32 -06:00
parent a914057407
commit c1b86ac9db
7 changed files with 168 additions and 318 deletions
+4 -4
View File
@@ -104,10 +104,10 @@ CFLAGS += $(foreach d,$(filter LFS3_%,$(.VARIABLES)),-D$d=$($d))
TEST_CFLAGS += -Wno-unused-function
TEST_CFLAGS += -Wno-format-overflow
ifdef STACK
TEST_CFLAGS += -DTEST_YES_STACK
TEST_CFLAGS += -DTEST_STACK
endif
ifdef HEAP
TEST_CFLAGS += -DTEST_YES_HEAP
TEST_CFLAGS += -DTEST_HEAP
TEST_CFLAGS += -Wl,--wrap=malloc
TEST_CFLAGS += -Wl,--wrap=free
TEST_CFLAGS += -Wl,--wrap=realloc
@@ -116,10 +116,10 @@ endif
BENCH_CFLAGS += -Wno-unused-function
BENCH_CFLAGS += -Wno-format-overflow
ifndef NO_STACK
BENCH_CFLAGS += -DBENCH_YES_STACK
BENCH_CFLAGS += -DBENCH_STACK
endif
ifndef NO_HEAP
BENCH_CFLAGS += -DBENCH_YES_HEAP
BENCH_CFLAGS += -DBENCH_HEAP
BENCH_CFLAGS += -Wl,--wrap=malloc
BENCH_CFLAGS += -Wl,--wrap=free
BENCH_CFLAGS += -Wl,--wrap=realloc