tinylcy/vino

Enabling profiling

mutlucg opened this issue · 2 comments

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.

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

Worked like a charm. Thanks a lot.