简体   繁体   中英

How to make gcc generate information for gprof?

I know that I should use -pg switch and run compiled program but it is not working. I am playing with cpuminer source code to learn something about Intel intrinsics and vectorization rather than for coins. What to know where cpuminer spends most of run time. I added -pg switch to CFLAGS before I ran configure. I can see that gcc uses it during compilation eg:

    gcc -std=gnu99 -DHAVE_CONFIG_H -I. -pthread -maes -Wall -O0 -g -pg -MT crypto/minerd-c_blake256.o -MD -MP -MF crypto/.deps/minerd-c_blake256.Tpo -c -o crypto/minerd-c_blake256.o `test -f 'crypto/c_blake256.c' || echo './'`crypto/c_blake256.c

But when I run exec no gmon.out file appears.

Could you prompt me where should I check/look?

Just read somewhere that gmon.out is written when the program stops running. But mine never stops. I am killing it with ^C - maybe it prevents gmon.out from being written? Is there a better way to stop the program in such a way gmon.out will be written?

Here is the answer: Saving gmon.out before killing a process

Works perfectly for me as well. Thanks everyone.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM