Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Zortrium

macrumors 6502
Original poster
Jun 23, 2003
461
0
I'm trying to get gprof working and am having absolutely no luck in getting a gmon.out file to be generated - I compile my program with the -pg flag, then execute it, but nothing gets generated. The flag is doing SOMETHING, since the size of the binary increases very slightly when I compile with -pg versus without, but it's definitely not creating any file - I've made sure permissions are set correctly, looked around in all possible directories. The exact same series of steps correctly creates the gmon.out file on a FreeBSD machine I tried it on, so I have absolutely no idea why it seems to do nothing on my Mac. Any ideas?

EDIT: I tried it on another Mac (almost the exact same system as mine, both C2D iMacs with Leopard) and it works...which is even weirder. I've tried both gcc 4.0 and 4.2 on my machine and neither works.
 

szymczyk

macrumors regular
Mar 5, 2006
187
17
gprof doesn't work on Intel Macs. Your alternatives are to use Shark, Instruments, or Saturn. If you use Saturn you have to build your program using the compiler flag -finstrument-functions and the linker flag -lSaturn.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.