This is a small library to use with the CPU profiler from Google perftools. Indeed, there is no way for the profiler to be flushed from the exterior of the profiled program. If you try to profile a daemon, only stopped by CTRL-C, the profile file may lack lots of data. This library catches two signals to control the profiler : * SIGUSR1 to start/stop it * SIGUSR2 to flush Start your daemon with: CPUPROFILE=tempus.prof LD_PRELOAD=./profiler_cmd.so ./my_daemon An in another console : # start the profiler killall -USR1 my_daemon # do things to profile # stop it killall -USR1 my_daemon # flush it killall -USR2 my_daemon Compilation: ------------ gcc -c profiler_cmd.c -lprofiler -fPIC -DPIC ld -shared profiler_cmd.o -o profiler_cmd.so -lprofiler