//$gcc –p tmp.c //$./a.out //$gprof ./a.out > Profile.txt //$ gcc -fprofile-arcs -ftest-coverage tmp.c //$./a.out //$gcov tmp.c //$gcc -pg -o Valgrindtest tmp.c //$valgrind --tool=callgrind ./Valgrindtest //$kcachegrind `ls -tr callgrind.out.* | tail -1` #include void FunA() { int i=0,g=0; while(i++<100000) { g+=i; } } void FunB() { int i=0,g=0; while(i++<400000) { g+=i; } } int main(){ int iter=5000; while(iter--) { FunA(); FunB(); } return 0; }