diff --git a/WindowsMonitor/Monitor/MonitorApi.h b/WindowsMonitor/Monitor/MonitorApi.h index d585206f..92b57e33 100644 --- a/WindowsMonitor/Monitor/MonitorApi.h +++ b/WindowsMonitor/Monitor/MonitorApi.h @@ -21,6 +21,15 @@ public: static double GetInterruptsPerSecond(wchar_t * instanceName, int idleTime); static double GetDpcTimePercent(wchar_t * instanceName, int idleTime); static double GetInterruptTimePercent(wchar_t * instanceName, int idleTime); + static double GetDpcsQueuedPerSecond(wchar_t * instanceName, int idleTime); + static double GetDpcRate(wchar_t * instanceName); + static double GetIdleTimePercent(wchar_t * instanceName, int idleTime); + static double GetC1TimePercent(wchar_t * instanceName, int idleTime); + static double GetC2TimePercent(wchar_t * instanceName, int idleTime); + static double GetC3TimePercent(wchar_t * instanceName, int idleTime); + static double GetC1TransitionsPerSecond(wchar_t * instanceName, int idleTime); + static double GetC2TransitionsPerSecond(wchar_t * instanceName, int idleTime); + static double GetC3TransitionsPerSecond(wchar_t * instanceName, int idleTime); }; class MONITOR_API ProcessorInformation diff --git a/WindowsMonitor/Monitor/Processor.cpp b/WindowsMonitor/Monitor/Processor.cpp index 2451b9f7..a01a76e6 100644 --- a/WindowsMonitor/Monitor/Processor.cpp +++ b/WindowsMonitor/Monitor/Processor.cpp @@ -80,19 +80,100 @@ double Processor::GetInterruptTimePercent(wchar_t * instanceName, int idleTime) } // DPCs Queued/sec +double Processor::GetDpcsQueuedPerSecond(wchar_t * instanceName, int idleTime) +{ + wstring fullCounterPath(L""); + fullCounterPath+=L"\\Processor("; + fullCounterPath+=instanceName; + fullCounterPath+=L")\\DPCs Queued/sec"; + double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime); + return ret; +} // DPC Rate +double Processor::GetDpcRate(wchar_t * instanceName) +{ + wstring fullCounterPath(L""); + fullCounterPath+=L"\\Processor("; + fullCounterPath+=instanceName; + fullCounterPath+=L")\\DPC Rate"; + double ret=Common::GetCounterValue(fullCounterPath.c_str()); + return ret; +} // % Idle Time +double Processor::GetIdleTimePercent(wchar_t * instanceName, int idleTime) +{ + wstring fullCounterPath(L""); + fullCounterPath+=L"\\Processor("; + fullCounterPath+=instanceName; + fullCounterPath+=L")\\% Idle Time"; + double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime); + return ret; +} // % C1 Time +double Processor::GetC1TimePercent(wchar_t * instanceName, int idleTime) +{ + wstring fullCounterPath(L""); + fullCounterPath+=L"\\Processor("; + fullCounterPath+=instanceName; + fullCounterPath+=L")\\% C1 Time"; + double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime); + return ret; +} // % C2 Time +double Processor::GetC2TimePercent(wchar_t * instanceName, int idleTime) +{ + wstring fullCounterPath(L""); + fullCounterPath+=L"\\Processor("; + fullCounterPath+=instanceName; + fullCounterPath+=L")\\% C2 Time"; + double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime); + return ret; +} // % C3 Time +double Processor::GetC3TimePercent(wchar_t * instanceName, int idleTime) +{ + wstring fullCounterPath(L""); + fullCounterPath+=L"\\Processor("; + fullCounterPath+=instanceName; + fullCounterPath+=L")\\% C3 Time"; + double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime); + return ret; +} // C1 Transitions/sec +double Processor::GetC1TransitionsPerSecond(wchar_t * instanceName, int idleTime) +{ + wstring fullCounterPath(L""); + fullCounterPath+=L"\\Processor("; + fullCounterPath+=instanceName; + fullCounterPath+=L")\\C1 Transitions/sec"; + double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime); + return ret; +} // C2 Transitions/sec +double Processor::GetC2TransitionsPerSecond(wchar_t * instanceName, int idleTime) +{ + wstring fullCounterPath(L""); + fullCounterPath+=L"\\Processor("; + fullCounterPath+=instanceName; + fullCounterPath+=L")\\C2 Transitions/sec"; + double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime); + return ret; +} // C3 Transitions/sec +double Processor::GetC3TransitionsPerSecond(wchar_t * instanceName, int idleTime) +{ + wstring fullCounterPath(L""); + fullCounterPath+=L"\\Processor("; + fullCounterPath+=instanceName; + fullCounterPath+=L")\\C3 Transitions/sec"; + double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime); + return ret; +} \ No newline at end of file diff --git a/WindowsMonitor/Monitor/Processor.h b/WindowsMonitor/Monitor/Processor.h index 1df83721..2189028b 100644 --- a/WindowsMonitor/Monitor/Processor.h +++ b/WindowsMonitor/Monitor/Processor.h @@ -15,4 +15,13 @@ public: static double GetInterruptsPerSecond(wchar_t * instanceName, int idleTime); static double GetDpcTimePercent(wchar_t * instanceName, int idleTime); static double GetInterruptTimePercent(wchar_t * instanceName, int idleTime); + static double GetDpcsQueuedPerSecond(wchar_t * instanceName, int idleTime); + static double GetDpcRate(wchar_t * instanceName); + static double GetIdleTimePercent(wchar_t * instanceName, int idleTime); + static double GetC1TimePercent(wchar_t * instanceName, int idleTime); + static double GetC2TimePercent(wchar_t * instanceName, int idleTime); + static double GetC3TimePercent(wchar_t * instanceName, int idleTime); + static double GetC1TransitionsPerSecond(wchar_t * instanceName, int idleTime); + static double GetC2TransitionsPerSecond(wchar_t * instanceName, int idleTime); + static double GetC3TransitionsPerSecond(wchar_t * instanceName, int idleTime); }; diff --git a/WindowsMonitor/Native/MonitorApi.h b/WindowsMonitor/Native/MonitorApi.h index d585206f..92b57e33 100644 --- a/WindowsMonitor/Native/MonitorApi.h +++ b/WindowsMonitor/Native/MonitorApi.h @@ -21,6 +21,15 @@ public: static double GetInterruptsPerSecond(wchar_t * instanceName, int idleTime); static double GetDpcTimePercent(wchar_t * instanceName, int idleTime); static double GetInterruptTimePercent(wchar_t * instanceName, int idleTime); + static double GetDpcsQueuedPerSecond(wchar_t * instanceName, int idleTime); + static double GetDpcRate(wchar_t * instanceName); + static double GetIdleTimePercent(wchar_t * instanceName, int idleTime); + static double GetC1TimePercent(wchar_t * instanceName, int idleTime); + static double GetC2TimePercent(wchar_t * instanceName, int idleTime); + static double GetC3TimePercent(wchar_t * instanceName, int idleTime); + static double GetC1TransitionsPerSecond(wchar_t * instanceName, int idleTime); + static double GetC2TransitionsPerSecond(wchar_t * instanceName, int idleTime); + static double GetC3TransitionsPerSecond(wchar_t * instanceName, int idleTime); }; class MONITOR_API ProcessorInformation diff --git a/WindowsMonitor/Test/MonitorApi.h b/WindowsMonitor/Test/MonitorApi.h index d585206f..92b57e33 100644 --- a/WindowsMonitor/Test/MonitorApi.h +++ b/WindowsMonitor/Test/MonitorApi.h @@ -21,6 +21,15 @@ public: static double GetInterruptsPerSecond(wchar_t * instanceName, int idleTime); static double GetDpcTimePercent(wchar_t * instanceName, int idleTime); static double GetInterruptTimePercent(wchar_t * instanceName, int idleTime); + static double GetDpcsQueuedPerSecond(wchar_t * instanceName, int idleTime); + static double GetDpcRate(wchar_t * instanceName); + static double GetIdleTimePercent(wchar_t * instanceName, int idleTime); + static double GetC1TimePercent(wchar_t * instanceName, int idleTime); + static double GetC2TimePercent(wchar_t * instanceName, int idleTime); + static double GetC3TimePercent(wchar_t * instanceName, int idleTime); + static double GetC1TransitionsPerSecond(wchar_t * instanceName, int idleTime); + static double GetC2TransitionsPerSecond(wchar_t * instanceName, int idleTime); + static double GetC3TransitionsPerSecond(wchar_t * instanceName, int idleTime); }; class MONITOR_API ProcessorInformation diff --git a/WindowsMonitor/Test/Test.cpp b/WindowsMonitor/Test/Test.cpp index 7a013f24..f716b957 100644 --- a/WindowsMonitor/Test/Test.cpp +++ b/WindowsMonitor/Test/Test.cpp @@ -17,7 +17,8 @@ int _tmain(int argc, _TCHAR* argv[]) while(1) { - printf("%lf\n",Processor::GetInterruptTimePercent(L"_Total",1500)); + printf("%lf\n",Processor::GetC3TransitionsPerSecond(L"_Total",1500)); + Sleep(500); } return 0; } diff --git a/WindowsMonitor/Test/stdafx.h b/WindowsMonitor/Test/stdafx.h index aa7cd1f4..46118ac6 100644 --- a/WindowsMonitor/Test/stdafx.h +++ b/WindowsMonitor/Test/stdafx.h @@ -2,6 +2,7 @@ #pragma comment(lib,"../x64/Debug/Monitor.lib") +#include #include #include