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:
@@ -10,12 +10,8 @@
|
||||
// this writes a 1 block file 2*block_count times to get it into a good
|
||||
// state for benchmarking
|
||||
int bench_helpers_warmup(lfs3_t *lfs3) {
|
||||
#ifdef BENCH_YES_STACK
|
||||
BENCH_STACK_PAUSE();
|
||||
#endif
|
||||
#ifdef BENCH_YES_HEAP
|
||||
BENCH_HEAP_PAUSE();
|
||||
#endif
|
||||
|
||||
uint8_t *wbuf = malloc(BLOCK_SIZE);
|
||||
memset(wbuf, '1', BLOCK_SIZE);
|
||||
@@ -34,24 +30,16 @@ int bench_helpers_warmup(lfs3_t *lfs3) {
|
||||
|
||||
free(wbuf);
|
||||
|
||||
#ifdef BENCH_YES_HEAP
|
||||
BENCH_HEAP_RESUME();
|
||||
#endif
|
||||
#ifdef BENCH_YES_STACK
|
||||
BENCH_STACK_RESUME();
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// find tight disk usage
|
||||
uintmax_t bench_helpers_usage(lfs3_t *lfs3) {
|
||||
#ifdef BENCH_YES_STACK
|
||||
BENCH_STACK_PAUSE();
|
||||
#endif
|
||||
#ifdef BENCH_YES_HEAP
|
||||
BENCH_HEAP_PAUSE();
|
||||
#endif
|
||||
|
||||
// measure disk usage
|
||||
//
|
||||
@@ -83,12 +71,8 @@ uintmax_t bench_helpers_usage(lfs3_t *lfs3) {
|
||||
|
||||
free(usage_bmap);
|
||||
|
||||
#ifdef BENCH_YES_HEAP
|
||||
BENCH_HEAP_RESUME();
|
||||
#endif
|
||||
#ifdef BENCH_YES_STACK
|
||||
BENCH_STACK_RESUME();
|
||||
#endif
|
||||
return (uintmax_t)usage * (uintmax_t)BLOCK_SIZE;
|
||||
}
|
||||
|
||||
|
||||
+16
-16
@@ -83,11 +83,11 @@ code = '''
|
||||
BENCH_STOP("write", written);
|
||||
|
||||
// report the total stack/heap usage after the benchmark
|
||||
#ifdef BENCH_YES_STACK
|
||||
BENCH_RESULT("stack", written, BENCH_STACK());
|
||||
#ifdef BENCH_STACK
|
||||
BENCH_RESULT("stack", written, BENCH_STACK_WATERMARK());
|
||||
#endif
|
||||
#ifdef BENCH_YES_HEAP
|
||||
BENCH_RESULT("heap", written, BENCH_HEAP());
|
||||
#ifdef BENCH_HEAP
|
||||
BENCH_RESULT("heap", written, BENCH_HEAP_WATERMARK());
|
||||
#endif
|
||||
|
||||
// find the total disk usage after the benchmark
|
||||
@@ -144,11 +144,11 @@ code = '''
|
||||
BENCH_STOP("write", written);
|
||||
|
||||
// report the total stack/heap usage after the benchmark
|
||||
#ifdef BENCH_YES_STACK
|
||||
BENCH_RESULT("stack", written, BENCH_STACK());
|
||||
#ifdef BENCH_STACK
|
||||
BENCH_RESULT("stack", written, BENCH_STACK_WATERMARK());
|
||||
#endif
|
||||
#ifdef BENCH_YES_HEAP
|
||||
BENCH_RESULT("heap", written, BENCH_HEAP());
|
||||
#ifdef BENCH_HEAP
|
||||
BENCH_RESULT("heap", written, BENCH_HEAP_WATERMARK());
|
||||
#endif
|
||||
|
||||
// find the total disk usage after the benchmark
|
||||
@@ -223,11 +223,11 @@ code = '''
|
||||
BENCH_STOP("write", written);
|
||||
|
||||
// report the total stack/heap usage after the benchmark
|
||||
#ifdef BENCH_YES_STACK
|
||||
BENCH_RESULT("stack", written, BENCH_STACK());
|
||||
#ifdef BENCH_STACK
|
||||
BENCH_RESULT("stack", written, BENCH_STACK_WATERMARK());
|
||||
#endif
|
||||
#ifdef BENCH_YES_HEAP
|
||||
BENCH_RESULT("heap", written, BENCH_HEAP());
|
||||
#ifdef BENCH_HEAP
|
||||
BENCH_RESULT("heap", written, BENCH_HEAP_WATERMARK());
|
||||
#endif
|
||||
|
||||
// find the total disk usage after the benchmark
|
||||
@@ -292,11 +292,11 @@ code = '''
|
||||
BENCH_STOP("write", written);
|
||||
|
||||
// report the total stack/heap usage after the benchmark
|
||||
#ifdef BENCH_YES_STACK
|
||||
BENCH_RESULT("stack", written, BENCH_STACK());
|
||||
#ifdef BENCH_STACK
|
||||
BENCH_RESULT("stack", written, BENCH_STACK_WATERMARK());
|
||||
#endif
|
||||
#ifdef BENCH_YES_HEAP
|
||||
BENCH_RESULT("heap", written, BENCH_HEAP());
|
||||
#ifdef BENCH_HEAP
|
||||
BENCH_RESULT("heap", written, BENCH_HEAP_WATERMARK());
|
||||
#endif
|
||||
|
||||
// find the total disk usage after the benchmark
|
||||
|
||||
Reference in New Issue
Block a user