It is easy to display the current % in GC in a .NET app, but how can you show the average time in GC or event total time in GC so you can go through a complete scenario and measure if you really improved things??
% time in GC is defined as:
“% Time in GC
Displays the percentage of elapsed time that was spent performing a garbage collection since the last garbage collection cycle. This counter usually indicates the work done by the garbage collector to collect and compact memory on behalf of the application. This counter is updated only at the end of every garbage collection. This counter is not an average; its value reflects the last observed value.”
If you’re interested in measuring the elapsed time spent in GC, that data is available via ETW. PerfMonitor will collect and display that data for you – check out this MSDN Magazine article for an introduction: http://msdn.microsoft.com/en-us/magazine/gg490356.aspx.