Profiling CPU Cache/Memory from the OS/Application?

后端 未结 3 634
眼角桃花
眼角桃花 2020-12-09 21:45

I wish to write software which could essentially profile the CPU cache (L2,L3, possibly L1) and the memory, to analyze performance.

Am I right in thinking this is un

3条回答
  •  不知归路
    2020-12-09 22:12

    This has some examples. TAU, an open-source profiler which works using PAPI can also be used.

    If however, you want to write a code to measure the cache statistics you can write a program using PAPI. PAPI allows the user to access the hardware counters without any need to know system architecture. PMU uses Model Specific Registers, hence you must have the knwoledge of the registers to be used.

    Perf allows for measurement of L1 and LLC (which is L2), Cachegrind, on the other hand allows the user to measure L1 and LLC (which can be L2 or L3, whichever the highest level cache is). Use Cachegrind only if you have no need of faster results because Cachegrind runs the program about 10X slower.

提交回复
热议问题