// // gcc -pg profileDEMO.c // ./a.out // gprof -b // #include void f() { } void g() { } void main() { int j; for(j=0;j<10000;j++) f(); for(j=0;j< 1000;j++) g(); } // Flat profile: // // Each sample counts as 0.01 seconds. // no time accumulated // // % cumulative self self total // time seconds seconds calls Ts/call Ts/call name // 0.00 0.00 0.00 10000 0.00 0.00 f // 0.00 0.00 0.00 1000 0.00 0.00 g // // // Call graph // // // granularity: each sample hit covers 2 byte(s) no time propagated // // index % time self children called name // 0.00 0.00 10000/10000 main [6] // [1] 0.0 0.00 0.00 10000 f [1] // ----------------------------------------------- // 0.00 0.00 1000/1000 main [6] // [2] 0.0 0.00 0.00 1000 g [2] // ----------------------------------------------- // // // Index by function name // // [1] f [2] g