Reputation: 973
I know that getrusage()
can provide per-thread CPU utilization, but only the time spent on the CPU. Is there any way to get the number of executed CPU instructions? Or the number of cycles spent on the cpu?
Basically, I need to find a reproducible measure of how much the thread spends on the CPU. Any suggestions to do this in C?
UPDATE (to respond to comments):
Upvotes: 2
Views: 895
Reputation: 21
Take a look at google's filament engine. They are doing exactly that. Look at their profiler. https://github.com/google/filament/blob/master/libs/utils/src/Profiler.cpp Also you can get more info from this link: https://www.youtube.com/watch?v=Lcq_fzet9Iw
Upvotes: 2