User:Ankitm/GSoC 2020/gperftools installation on mac

gperftools installation and basic usage
Broader todo task for profiling Blender on Phabricator:

Instruments.app is bundled with Xcode & provides easy CPU profiling. But it isn't available for other platform. `perf` based tools (for e.g. Hotspot, flamegraph, see see usage) will work only on Linux. This won't work on windows but at least other two platforms can reproduce consistent results. Plus highly localised functions can be tested using gperftools.

27th May
gperftools finally worked. Here's the recipe: [1]





Use  to find out the path to the library & the flag.
 * Insert this line in the platform specific file among these files on diffusion. I used platform_apple.cmake.


 * Use this in a C/C++ file around the function to profile.

PROFILE: interrupts/evictions/bytes = 3532/1448/174440
 * Build, run, execute the function. Verify that the console has similar in the output:


 * Then run this to see an svg in your web browser. For text, instead of, use.

[1]:
You can build it from source too. Download the source code from https://github.com/gperftools/gperftools/releases

OR

Then separately install graphviz. I cannot comment on that since I didn't build it.

References:

 * https://gperftools.github.io/gperftools/cpuprofile.html
 * https://github.com/google/pprof
 * http://www.graphviz.org
 * https://wiki.geany.org/howtos/profiling/gperftools
 * http://engineering.appfolio.com/appfolio-engineering/2016/6/22/using-gperftools-on-the-mri-ruby-interpreter-in-mac-os-x
 * https://developer.ridgerun.com/wiki/index.php?title=Profiling_with_GPerfTools
 * https://stackoverflow.com/questions/10874308/how-to-use-google-perf-tools