Document your code
Also if you want to do GPU profiling, then gprof is not the command to use. This link should hopefully help you. – Some programmer dude Apr 26 '18 at 7:38.
Every project on GitHub comes with a version-controlled wiki to give your documentation the high level of care it deserves. It’s easy to create well-maintained, Markdown or rich text documentation alongside your code.
Sign up for free See pricing for teams and enterprises As an alternative to profiling with gprof, you can use google-perftools as follows:
- Install google-perftools. Either grab it from http://code.google.com/p/gperftools/ or in Ubuntu:
$ sudo apt-get install google-perftools libgoogle-perftools-dev
- Run the tool you want to profile with a couple of extra environment variables:
- LD_PRELOAD should contain /usr/lib/libprofiler.so for CPU profiling and /usr/lib/libtcmalloc.so for heap profiling.
- CPUPROFILE should contain the name of the file to write CPU profiling data to if you want to do CPU profiling.
- HEAPPROFILE should contain the name of the file to write heap profiling data to if you want to do heap profiling.
So for example:$ LD_PRELOAD=/usr/lib/libprofiler.so CPUPROFILE=cpu_profile ./cbmc my_test_program.c
or$ LD_PRELOAD=/usr/lib/libtcmalloc.so HEAPPROFILE=heap_profile ./cbmc my_test_program.c
- Visualize your profile using
pprof
, as described at http://google-perftools.googlecode.com/svn/trunk/doc/cpuprofile.html:
$ google-pprof --gv cpu_profile cbmc