I work on a language that compiles to C99 with no mallocs, no recursion, and no loops. All memory is pre-allocated, and all functions terminate (unless there's an exception like division by zero).
The entry point of my module is always the same: a function void step(void)
.
Is there a tool that, under such circumstances, will calculate the max memory usage and max execution time of my code?
valgrind --tool=massif --stacks=yes --pages-as-heap=yes
The above should profile all of the memory use.
Alternatively, while your executable is running you can use
pmap -x PID
(or look at /proc/PID/maps).For the execution time, I would just use
/usr/bin/time -p exe_name