Class PerformanceDataSet allows easy access to performance counter values. More...
Class PerformanceDataSet allows easy access to performance counter values.
This file was originally retrieved from MSDN (q194655) as rkLeak.h/cpp and adjusted for test purposes.
The code assumes the existence of PDH.DLL on the system. If not available define NO_PDH_DLL to suppress this part of code.
Usage:
.// Define counters to check .// (assuming Windows XP with German language pack, and a computer named SIRIUS) std::vector<std::string> counterNames; counterNames.push_back("\\\\SIRIUS\\Prozessor(0)\\Prozessorzeit (%)"); counterNames.push_back("\\\\SIRIUS\\Prozess(notepad)\\Threadanzahl"); counterNames.push_back("\\\\SIRIUS\\Prozess(TestPerformanceDataSet)\\Private Bytes"); .// Prepare access to counter names (may fail in case of invalid names) TTB::PerformanceDataSet perfDataSet; perfDataSet.InitPerfCounters (m_counterNames); .// Access current counter values std::vector<double> counterValues =perfDataSet.GetCurrentCounterValues();