olyc
olyc

Reputation: 29

gcc -pg creates a.out instead of gmon.out

How can I make my gcc -pg create a gmon.out file instead of an a.out? I'm trying to profile my CPU using gprof, but when I compile my .c file I get an a.out, which is not what I need.

Upvotes: 0

Views: 449

Answers (2)

Šimon Tóth
Šimon Tóth

Reputation: 36423

The profile is generated when you run the compiled program, not upon compilation.

Upvotes: 1

P.P
P.P

Reputation: 121347

$ gcc -pg yourfile.c #compile with -pg

$ ./a.out #execute it

Now, you can see the gmon.out file.

Upvotes: 0

Related Questions