Thursday, September 4, 2014

How to do performance profiling of server process on Linux?

Suppose you have a server process on Linux and you want to investigate its performance.
To do performance profiling you need to run your server with using valgrind:

valgrind --tool=callgrind --dump-instr=yes --simulate-cache=yes --collect-jumps=yes ./path_to_server arg1 arg2

After you started the server you needed to wait some time while your server processed data.
As soon as data has been processed you may stop server.
As the result valgrind should generate file(s) with names like that: callgrind.out.58575.

Now the biggest part of job has been done already.
Next step is to open generated callgrind.out.* file(s) by using kcachegrind.

If you are interested in performance profiling child processes I'll bring you good news.
You can achieve it just by adding --trace-children=yes argument to valgring command line:

valgrind --tool=callgrind --dump-instr=yes --simulate-cache=yes --collect-jumps=yes --trace-children=yes ./path_to_server arg1 arg2

Hope this post is helpful. Good luck!

No comments:

Post a Comment