Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to monitor CPU cache on Windows?

Tags:

windows

I want to keep my code from flushing off the L2 cache as much as possible.

How would you achieve that in C++ / C# and how would you make it accountable.

EDIT : can I collect number of L2 cache misses alternatively? Answer : Yes Can I get the L2 cache miss count of each process on the windows platform?

like image 530
Boppity Bop Avatar asked Jan 17 '13 15:01

Boppity Bop


1 Answers

It seems that people are reluctant to give away information in this area (c++ or c# doesnt matter). so I would have probably to create my own strategy which will be probably using set of approaches rather than a rigid set of rules or recipes.

To achieve max hit/miss ratio for a Windows application I would probably:

  • dedicate a physical CPU for the application making sure no other processes are using it, disable hyperthreading, work with BIOS as server manufacturers often provide specific settings for low-latency applications
  • make sure the piece of code in question has size smaller than the L2 cache on that CPU core
  • make sure the code does not have something what makes it explicitely flushed off the cache (eg memory barriers in C#)
  • monitor L2 miss count: http://stackoverflow.com/questions/5141350/can-i-get-the-l2-cache-miss-count-of-each-process-on-the-windows-platform
like image 134
Boppity Bop Avatar answered Sep 30 '22 20:09

Boppity Bop