How to test Linux-based applications?
-
How can I properly test a program on Linux? For example, find out the maximum memory consumption, the amount of used processor time?
I do not mean just to open htop and look, but by analogy with time [application].
-
# valgrind --trace-children=yes time echo anus ==5286== Memcheck, a memory error detector ==5286== Command: time echo anus ==5286== ==5289== Memcheck, a memory error detector ==5289== Command: /bin/echo anus ==5289== anus ==5289== ==5289== HEAP SUMMARY: ==5289== in use at exit: 0 bytes in 0 blocks ==5289== total heap usage: 30 allocs, 30 frees, 1,985 bytes allocated ==5289== ==5289== All heap blocks were freed -- no leaks are possible ==5289== ==5289== For counts of detected and suppressed errors, rerun with: -v ==5289== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 13 from 8) 0.43user 0.02system 0:00.46elapsed 99%CPU (0avgtext+0avgdata 107024maxresident)k 0inputs+8outputs (0major+8687minor)pagefaults 0swaps ==5286== ==5286== HEAP SUMMARY: ==5286== in use at exit: 0 bytes in 0 blocks ==5286== total heap usage: 0 allocs, 0 frees, 0 bytes allocated ==5286== ==5286== All heap blocks were freed -- no leaks are possible ==5286== ==5286== For counts of detected and suppressed errors, rerun with: -v ==5286== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 13 from 8)
-
-
perf Profiler for GNU / Linux with performance calculation. https://perf.wiki.kernel.org/index.php/Main_Page
-
gdb GNU debugger that allows you to "spy" what is happening inside the program during its execution. https://www.gnu.org/software/gdb/
-
flame graph A graphical profiler. http://www.brendangregg.com/flamegraphs.html
-
strace Used to diagnose and debug programs under GNU / Linux https://strace.io/
-