Creating a PerfMon counter to record an average per call (C#)
问题 How can I use PerfMon counters to record the average execution time of a method in C#? So far I've only found sample code to incrememnt or decrement a PerfMon counter. 回答1: Here's some sample code I once wrote to do exactly that. First, you need to specify and install the performance counters in question. You can do this by using an Installer: public class CreditPerformanceMonitorInstaller : Installer { private PerformanceCounterInstaller counterInstaller_; public