Adding custom performance counters
Published 17 December 2012
You can add custom performance counters to the list of available performance counters. To do this:
- Close ANTS Memory Profiler.
Expose your performance counter to the Windows Performance Counter API using the PerformanceCounter and PerformanceCounterCategory classes of the System.Diagnostics namespace.
For an example of how to do this, see PerformanceCounter class (MSDN).
Create a new XML file containing the following:
<Counters> <Category Name="CategoryName"> <Counter Category="CategoryName" Name="CounterName" Units="Measurement Units"> <Instanced /> </Counter> </Category> </Counters>
Ensure that CategoryName and CounterName are the same as the names used for the PerformanceCounterCategory and PerformanceCounter. Remove the
<Instanced />node if your counter collects data about the computer, not only the individual process. You can add multiple categories and counters in the same XML file.
- Save the XML file as UserCounters.xml in %LOCALAPPDATA%\Red Gate\ANTS Memory Profiler 8\
- Restart ANTS Memory Profiler.
- The counters you defined are shown in the relevant category on the Charting Options tab.