#gperf not showing run time for half of the program

1 messages ยท Page 1 of 1 (latest)

hollow lindenBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.

cobalt wedge
cobalt wedge
#

gperf not showing run time for half part of the program

#

gperf not showing run time for half of the program

celest violet
#

Idk, I've never used gmon, but maybe you can try to use perf (iirc it should already come pre-installed with some Linux distributions). Also a sampling time of 0.01 seconds is way too grainy. That way you only get 100 samples per second while your CPU does billions of operations per second.

Also if you want someone to make something useful of the gmon report, then post it as text rather than a screenshot

#

You'll probably want to use perf record and perf report

cobalt wedge
hollow lindenBOT
#

<@undefined>

Please Do Not Delete Posts!

Please don't delete forum posts. They can be helpful to refer to later and other members can learn from them. In the future you can use !solved to close a post and mark a post as solved.

cobalt wedge
# celest violet Iirc you need to `sudo` it

Thanks for this. One (probably stupid) question is, is it true that we only do profiling w/o optimizations like -O1/2/2 ? Does it even make sense to profile on code w/ optimizations?

hollow lindenBOT
#

@cobalt wedge Has your question been resolved? If so, type !solved :)

celest violet
# cobalt wedge Thanks for this. One (probably stupid) question is, is it true that we only do p...

It's not a stupid question, because you've got mixed around.
It doesn't make sense to profile unoptimized code.
It does make sense to profile optimized code.

This is because when you profile your code, then you want to measure where it looses time. You will never ship the product (i.e. actually use the program) without optimizations enabled, because it just makes sense to make your code faster, so measuring time loss of the unoptimized thing is silly.

Typically the minimum optimization setting you want to have is -O2, but for your simple cases you'll most likely want to crank it to -O3

cobalt wedge
#

!solved

hollow lindenBOT
#

Thank you and let us know if you have any more questions!

This thread is now set to auto-hide after an hour of inactivity

cobalt wedge
cobalt wedge
# celest violet It's not a stupid question, because you've got mixed around. It **doesn't** make...

Would you mind an additional question? I barely exported a visualized report from the tool and it mainly gives funciton level time costs. So I wonder if, in common sense, the profiling tools (like gprof and perf) are providing anything more than function level summary? like, which code block is using more time? Or, when it comes to sub function level, we'd better manually add some "system_clock" calls to dig it by ourselves?

celest violet
cobalt wedge
#

also visualized with perf2dot for a call graph. But nothing goes beyond sub function level.

celest violet
#

I know for a fact that with perf report you can even go into assembly level

cobalt wedge
#

Since the result of perf can also be processed by perf2dot, I guess results from perf would be similar but correct me if wrong.

celest violet
#

I have no idea what perf2dot is tbh

#

huh, while reading the tutorial (it's been a time since I used perf) for assembly level you apparently should use perf annotate... Idk, I would need to read the tutorial again, but honestly I don't want to ๐Ÿ’

cobalt wedge
vital slate
#

You'll only see information where samples hit