-
Notifications
You must be signed in to change notification settings - Fork 4
Profiling `y3_cluster_cpp` with Google Performance Tools
We use the Google Performance Tools (gperftools) to profile the y3_cluster_cpp. The gperftools profiler is a sampling profiler, meaning that it lets your program run normally, but stops it at regular intervals (say, every ~5ms) to check, or 'sample' the program state. At each sample, it records the call stack, i.e. the program is in the function foo called by the function bar called by main. From the aggregate of all samples, the profiler can say that a total of 45% of the time in foo; 30% of the time program was in foo called by bar, and the other 15% called by qux, etc.
If you have checked out and built the cosmosis-docker image before July 10, do the following:
$ cd /path/to/docker-cosmosis
$ git pull
$ sudo ./update-cosmosis-vm.shThis will install the google perftools libraries into your docker image.
Then, to use the profiling library in running trivial_gamma_t, do the following:
$ cd /path/to/y3_cluster_cpp
$ git fetch
$ git checkout profiler-integrationYou may wish to merge profiler-integration into your own branch. Then, in your docker image,
$ cd /cosmosis/comsosis-standard-library/y3_cluster_cpp
$ make
$ ./test/trivial_gamma_t 999999999
$ ./generate-pprof-pdf.shWhen you run trivial_gamma_t, it will run the sampling profiler, and at the end of the program it will dump the results to a file called y3_cluster_cpp/dump.txt. The generate-pprof-ppdf.sh script will take the data from that dump and generate a PDF flowchart called y3_cluster_cpp/google-dump.pdf. Find an example here.