Where are .NET 4.0 MemoryCache performance counters?

Allan Xu picture Allan Xu · Nov 18, 2013 · Viewed 7.3k times · Source

Where are .NET 4.0 MemoryCache performance counters?

I am looking for their name and I can't find any.

Thank you,

Answer

Hans Passant picture Hans Passant · Nov 19, 2013

That's a loaded question with a very long answer. I doubt it is going to be helpful, let's talk about the real problem you are trying to solve. Those performance counters have to be registered first before you can see them.

Start an elevated console prompt (right-click the shortcut and use Run as Administrator) and type these commands:

cd C:\Windows\Microsoft.NET\Framework\v4.0.30319
lodctr netmemorycache.ini

That adds the required registry entries so the MemoryCache can create these counters at runtime. Start your program so an instance of MemoryCache is created. Run Perfmon.exe, right-click the graph, Add Counters and pick from the added ".NET Memory Cache 4.0" category. Also select the instance of your program.