0

Currently I am working on my project for Computer Architecture class about dynamic analysis of execution of instructions in programs, and I can't quite find any information on if time spent on executing certain instructions affects the amount of hits it receives. Also how could i possibly find out how much time one instrucion takes.

I have perf annotate output which shows me all the hits and times of all the sections as well as a program which sums up every instruction and takes in account all the branches with conditional jumps.

Krzysztof
  • 1
  • 1
  • On real CPUs with `perf record`, the instruction which gets the blame (more counts for the `cycles` event) for a cache miss is usually the one waiting for the result, not the `mov` load itself that missed in cache. See also *[Inconsistent \`perf annotate\` memory load/store time reporting](https://stackoverflow.com/q/65906312)* – Peter Cordes May 12 '23 at 17:59
  • IDK if that's what you're asking. An instruction like `div` being slow doesn't make it hit or miss more in I or D cache. (At least not directly; slow code can let hardware prefetch keep up if you're looping over an array.) Also related: [How many CPU cycles are needed for each asm instruction?](//stackoverflow.com/q/692718) - that's a meaningless thing to talk about on a superscalar out-of-order exec CPU. Instructions overlap with each other in execution time, there isn't a fixed cost you can add up across instructions. Instead you look at latency and front-end / back-end throughput cost. – Peter Cordes May 12 '23 at 17:59

0 Answers0