-1

On Linux based systems, how can I estimate or maybe read the CPU L2 shared memory % of usage?

Dave M
  • 4,494
  • 21
  • 30
  • 30
Duloren
  • 107
  • 1
  • 3
    What is the use of unused CPU caches? You will more likely get a useful answer if you [edit] your question to include the specific *problem* you are trying to solve through estimating or measuring whatever it is you are asking for. – anx Sep 07 '21 at 00:00

1 Answers1

3

You can not because it is a metric without any sense. The result will be 100% ALL THE TIME (outside a cache flush or the computer starting).

Cache is used on a LRU (Last Recently Used) method. L2 cache will run full at computer start (when the boot loader runs) and then stay at 100% utilization.

A better metric - one that does make sense actually - would be "% of requests that trigger a load". Means, what percent of queries can be answered from the cached data (or, as I said, trigger a load from the next cache/RAM).

But unless you have a cache flush (memory barrier) - the cache will never be not fully utilized as it would make no sense to waste it. It can contain old data not used anymore, but it will be utilized.

TomTom
  • 50,857
  • 7
  • 52
  • 134