wiki:InstallGooglePerformanceTools

On a comlab machine, you should be able to do

sudo yum install google-perftools-devel

Download the RPMs ( google-perftools-0.8-1.i386.rpm and google-perftools-devel-0.8-1.i386.rpm ) from http://code.google.com/p/google-perftools/

Install it as root:

rpm -i google-perftools-0.8-1.i386.rpm google-perftools-devel-0.8-1.i386.rpm

Install graphviz rpm as root:

yum install graphviz

Test it:

[chaste@userpc58 ~]$ cat a_prog.c
#include <math.h>
#define N 10000000L
double a[N];
fill(int i){
    a[i]=i;
}
calc(int i){
    a[i]=sqrt(a[i]);
}

int main(int argc, char *argv[])
{
    int i;
    for (i=0;i<N;i++){
        fill(i);
    }
    for (i=0;i<N;i++){
        calc(i);
    }

}
[chaste@userpc58 ~]$ gcc -o a_prog a_prog.c -lm -lprofiler
[chaste@userpc58 ~]$ export CPUPROFILE=chaste.prof
[chaste@userpc58 ~]$ ./a_prog
PROFILE: interrupts/evictions/bytes = 33/6/280
[chaste@userpc58 ~]$ pprof -pdf a_prog chaste.prof > temp.pdf
[chaste@userpc58 ~]$ evince temp.pdf


evince is just a PDF viewer. We could also do gif:

[chaste@userpc58 ~]$ pprof -gif a_prog chaste.prof > temp.gif
[chaste@userpc58 ~]$ display temp.gif
Last modified 10 years ago Last modified on Sep 15, 2010, 11:41:16 AM