John Smith
John Smith

Reputation: 8821

How to find % time spent in GC for a .NET application?

I've been trying to find out this value out for hours now and to no avail. It's beginning to become quite frustrating.

I see this "% time spent in GC" mentioned everywhere (like https://msdn.microsoft.com/en-us/magazine/cc163528.aspx for example) but with no mention on how to retrieve it!

I've tried Visual Studio's memory profiler, ANTS (trial expired now), CLR Profiler, and PerfView. Where is this value stored so that I may read it?

Upvotes: 3

Views: 3646

Answers (1)

Jim Mischel
Jim Mischel

Reputation: 133995

It's in Performance Monitor (perfmon.exe)

  1. Start perfmon and select the process you want to monitor.
  2. Click on the big green "+" sign to add a performance counter.
  3. In the "Add Counters" dialog, select ".NET CLR Memory"
  4. Expand the counters under ".NET CLR Memory"
  5. Scroll down and select "% Time in GC"

Upvotes: 5

Related Questions