Enabling profiling
mutlucg opened this issue · 2 comments
mutlucg commented
Hi,
I want to enable profiling while I'm compiling the program. I know that I need to use "-pg" flag for single file C programs while using GCC. What modifications should I make in makefile (or somewhere different) so that I can enable profiling for vino here.
Thank you in advance.
tinylcy commented
Hi @mutlucg ,
Because gmon.out file will not be generated if the program is terminated abnormally, therefore I have written a signal handler for SIGUSR1 to terminate the program normally.
You should use cmake with -DCMAKE_C_FLAGS=-pg
.
mkdir build && cd build
cmake -DCMAKE_C_FLAGS=-pg ..
make
./vino
...
kill -USR1 <VINO PID>
gprof ./vino -b gmon.out
mutlucg commented
Worked like a charm. Thanks a lot.