Add simple stack measure for jerry-test (#3717)

This change introduces simple stack measuring by coloring the stack
before doing the actual JS work.

The dynamic linking should be avoided as it will use the stack during
the symbol resolving.

At this moment the `JERRY_STACK_MEASURE` compile time define will enable
the measurement for the jerry-test binary.

A usable build configuration:

```
./tools/build.py --jerry-cmdline-test=on --compile-flag=-DJERRY_STACK_MEASURE=1 --compile-flag=-static
```

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
This commit is contained in:
Péter Gál
2020-07-02 11:54:52 +02:00
committed by GitHub
parent cd1e067671
commit eb77f96d20
2 changed files with 134 additions and 22 deletions
+3
View File
@@ -17,9 +17,11 @@ project (jerry-main C)
# Optional build settings
set(ENABLE_LINK_MAP OFF CACHE BOOL "Enable generating a link map file?")
set(JERRY_TEST_STACK_MEASURE OFF CACHE BOOL "Enable stack measurement for the jerry-test binary?")
# Status messages
message(STATUS "ENABLE_LINK_MAP " ${ENABLE_LINK_MAP})
message(STATUS "JERRY_TEST_STACK_MEASURE " ${JERRY_TEST_STACK_MEASURE})
# Generate map file
if(ENABLE_LINK_MAP)
@@ -69,6 +71,7 @@ endif()
if(JERRY_CMDLINE_TEST)
jerry_create_executable("jerry-test" "main-unix-test.c" "benchmarking.c")
target_link_libraries("jerry-test" jerry-port-default-minimal)
target_compile_definitions("jerry-test" PRIVATE -DJERRY_TEST_STACK_MEASURE=1)
endif()
if(JERRY_CMDLINE_SNAPSHOT)