From ae463b4b5831c44a7d2a6d72ce7c6049320da4fb Mon Sep 17 00:00:00 2001 From: Zhen Tang Date: Sun, 7 Jul 2013 14:50:22 +0800 Subject: [PATCH] logical disk monitor completed. --- WindowsMonitor/Monitor/Common.h | 2 +- WindowsMonitor/Monitor/LogicalDisk.cpp | 235 +++++++++++++++++++++++- WindowsMonitor/Monitor/LogicalDisk.h | 23 +++ WindowsMonitor/Monitor/MonitorApi.h | 102 ++++++---- WindowsMonitor/Monitor/PhysicalDisk.cpp | 1 + WindowsMonitor/Native/MonitorApi.h | 102 ++++++---- WindowsMonitor/Test/MonitorApi.h | 102 ++++++---- WindowsMonitor/Test/Test.cpp | 17 +- 8 files changed, 475 insertions(+), 109 deletions(-) diff --git a/WindowsMonitor/Monitor/Common.h b/WindowsMonitor/Monitor/Common.h index b4bb288e..c2ffbadb 100644 --- a/WindowsMonitor/Monitor/Common.h +++ b/WindowsMonitor/Monitor/Common.h @@ -1,6 +1,6 @@ #pragma once -class Common +class MONITOR_API Common { public: static double GetCounterValue(const wchar_t * fullCounterPath); diff --git a/WindowsMonitor/Monitor/LogicalDisk.cpp b/WindowsMonitor/Monitor/LogicalDisk.cpp index fed6d0a0..c694157f 100644 --- a/WindowsMonitor/Monitor/LogicalDisk.cpp +++ b/WindowsMonitor/Monitor/LogicalDisk.cpp @@ -13,22 +13,255 @@ list LogicalDisk::GetCounterList() return Common::GetCounterList(L"LogicalDisk"); } +// % Free Space +double LogicalDisk::GetFreeSpacePercent(wchar_t * instanceName) +{ + wstring fullCounterPath(L""); + fullCounterPath+=L"\\LogicalDisk("; + fullCounterPath+=instanceName; + fullCounterPath+=L")\\% Free Space"; + double ret=Common::GetCounterValue(fullCounterPath.c_str()); + return ret; +} + +// Free Megabytes +double LogicalDisk::GetFreeMegabytes(wchar_t * instanceName) +{ + wstring fullCounterPath(L""); + fullCounterPath+=L"\\LogicalDisk("; + fullCounterPath+=instanceName; + fullCounterPath+=L")\\Free Megabytes"; + double ret=Common::GetCounterValue(fullCounterPath.c_str()); + return ret; +} + +// Current Disk Queue Length +double LogicalDisk::GetCurrentDiskQueueLength(wchar_t * instanceName) +{ + wstring fullCounterPath(L""); + fullCounterPath+=L"\\LogicalDisk("; + fullCounterPath+=instanceName; + fullCounterPath+=L")\\Current Disk Queue Length"; + double ret=Common::GetCounterValue(fullCounterPath.c_str()); + return ret; +} + +// % Disk Time +double LogicalDisk::GetDiskTimePercent(wchar_t * instanceName, int idleTime) +{ + wstring fullCounterPath(L""); + fullCounterPath+=L"\\LogicalDisk("; + fullCounterPath+=instanceName; + fullCounterPath+=L")\\% Disk Time"; + double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime); + return ret; +} + // Avg. Disk Queue Length +double LogicalDisk::GetAverageDiskQueueLength(wchar_t * instanceName, int idleTime) +{ + wstring fullCounterPath(L""); + fullCounterPath+=L"\\LogicalDisk("; + fullCounterPath+=instanceName; + fullCounterPath+=L")\\Avg. Disk Queue Length"; + double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime); + return ret; +} + // % Disk Read Time +double LogicalDisk::GetDiskReadTimePercent(wchar_t * instanceName, int idleTime) +{ + wstring fullCounterPath(L""); + fullCounterPath+=L"\\LogicalDisk("; + fullCounterPath+=instanceName; + fullCounterPath+=L")\\% Disk Read Time"; + double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime); + return ret; +} + // Avg. Disk Read Queue Length +double LogicalDisk::GetAverageDiskReadQueueLength(wchar_t * instanceName, int idleTime) +{ + wstring fullCounterPath(L""); + fullCounterPath+=L"\\LogicalDisk("; + fullCounterPath+=instanceName; + fullCounterPath+=L")\\Avg. Disk Read Queue Length"; + double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime); + return ret; +} + // % Disk Write Time +double LogicalDisk::GetDiskWriteTimePercent(wchar_t * instanceName, int idleTime) +{ + wstring fullCounterPath(L""); + fullCounterPath+=L"\\LogicalDisk("; + fullCounterPath+=instanceName; + fullCounterPath+=L")\\% Disk Write Time"; + double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime); + return ret; +} + // Avg. Disk Write Queue Length +double LogicalDisk::GetAverageDiskWriteQueueLength(wchar_t * instanceName, int idleTime) +{ + wstring fullCounterPath(L""); + fullCounterPath+=L"\\LogicalDisk("; + fullCounterPath+=instanceName; + fullCounterPath+=L")\\Avg. Disk Write Queue Length"; + double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime); + return ret; +} + // Avg. Disk sec/Transfer +double LogicalDisk::GetAverageDiskTransferTimeInSecond(wchar_t * instanceName, int idleTime) +{ + wstring fullCounterPath(L""); + fullCounterPath+=L"\\LogicalDisk("; + fullCounterPath+=instanceName; + fullCounterPath+=L")\\Avg. Disk sec/Transfer"; + double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime); + return ret; +} + // Avg. Disk sec/Read +double LogicalDisk::GetAverageDiskReadTimeInSecond(wchar_t * instanceName, int idleTime) +{ + wstring fullCounterPath(L""); + fullCounterPath+=L"\\LogicalDisk("; + fullCounterPath+=instanceName; + fullCounterPath+=L")\\Avg. Disk sec/Read"; + double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime); + return ret; +} + // Avg. Disk sec/Write +double LogicalDisk::GetAverageDiskWriteTimeInSecond(wchar_t * instanceName, int idleTime) +{ + wstring fullCounterPath(L""); + fullCounterPath+=L"\\LogicalDisk("; + fullCounterPath+=instanceName; + fullCounterPath+=L")\\Avg. Disk sec/Write"; + double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime); + return ret; +} + // Disk Transfers/sec +double LogicalDisk::GetDiskTransfersPerSecond(wchar_t * instanceName, int idleTime) +{ + wstring fullCounterPath(L""); + fullCounterPath+=L"\\LogicalDisk("; + fullCounterPath+=instanceName; + fullCounterPath+=L")\\Disk Transfers/sec"; + double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime); + return ret; +} + // Disk Reads/sec +double LogicalDisk::GetDiskReadsPerSecond(wchar_t * instanceName, int idleTime) +{ + wstring fullCounterPath(L""); + fullCounterPath+=L"\\LogicalDisk("; + fullCounterPath+=instanceName; + fullCounterPath+=L")\\Disk Reads/sec"; + double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime); + return ret; +} + // Disk Writes/sec +double LogicalDisk::GetDiskWritesPerSecond(wchar_t * instanceName, int idleTime) +{ + wstring fullCounterPath(L""); + fullCounterPath+=L"\\LogicalDisk("; + fullCounterPath+=instanceName; + fullCounterPath+=L")\\Disk Writes/sec"; + double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime); + return ret; +} + // Disk Bytes/sec +double LogicalDisk::GetDiskBytesPerSecond(wchar_t * instanceName, int idleTime) +{ + wstring fullCounterPath(L""); + fullCounterPath+=L"\\LogicalDisk("; + fullCounterPath+=instanceName; + fullCounterPath+=L")\\Disk Bytes/sec"; + double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime); + return ret; +} + // Disk Read Bytes/sec +double LogicalDisk::GetDiskReadBytesPerSecond(wchar_t * instanceName, int idleTime) +{ + wstring fullCounterPath(L""); + fullCounterPath+=L"\\LogicalDisk("; + fullCounterPath+=instanceName; + fullCounterPath+=L")\\Disk Read Bytes/sec"; + double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime); + return ret; +} + // Disk Write Bytes/sec +double LogicalDisk::GetDiskWriteBytesPerSecond(wchar_t * instanceName, int idleTime) +{ + wstring fullCounterPath(L""); + fullCounterPath+=L"\\LogicalDisk("; + fullCounterPath+=instanceName; + fullCounterPath+=L")\\Disk Write Bytes/sec"; + double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime); + return ret; +} + // Avg. Disk Bytes/Transfer +double LogicalDisk::GetAverageDiskBytesPerTransfer(wchar_t * instanceName, int idleTime) +{ + wstring fullCounterPath(L""); + fullCounterPath+=L"\\LogicalDisk("; + fullCounterPath+=instanceName; + fullCounterPath+=L")\\Avg. Disk Bytes/Transfer"; + double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime); + return ret; +} + // Avg. Disk Bytes/Read +double LogicalDisk::GetAverageDiskBytesPerRead(wchar_t * instanceName, int idleTime) +{ + wstring fullCounterPath(L""); + fullCounterPath+=L"\\LogicalDisk("; + fullCounterPath+=instanceName; + fullCounterPath+=L")\\Avg. Disk Bytes/Read"; + double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime); + return ret; +} + // Avg. Disk Bytes/Write +double LogicalDisk::GetAverageDiskBytesPerWrite(wchar_t * instanceName, int idleTime) +{ + wstring fullCounterPath(L""); + fullCounterPath+=L"\\LogicalDisk("; + fullCounterPath+=instanceName; + fullCounterPath+=L")\\Avg. Disk Bytes/Write"; + double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime); + return ret; +} + // % Idle Time -// Split IO/Sec \ No newline at end of file +double LogicalDisk::GetIdleTimePercent(wchar_t * instanceName, int idleTime) +{ + wstring fullCounterPath(L""); + fullCounterPath+=L"\\LogicalDisk("; + fullCounterPath+=instanceName; + fullCounterPath+=L")\\% Idle Time"; + double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime); + return ret; +} + +// Split IO/Sec +double LogicalDisk::GetSplitIOPerSecond(wchar_t * instanceName, int idleTime) +{ + wstring fullCounterPath(L""); + fullCounterPath+=L"\\LogicalDisk("; + fullCounterPath+=instanceName; + fullCounterPath+=L")\\Split IO/Sec"; + double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime); + return ret; +} \ No newline at end of file diff --git a/WindowsMonitor/Monitor/LogicalDisk.h b/WindowsMonitor/Monitor/LogicalDisk.h index 1855c492..88cfcdb5 100644 --- a/WindowsMonitor/Monitor/LogicalDisk.h +++ b/WindowsMonitor/Monitor/LogicalDisk.h @@ -9,4 +9,27 @@ class MONITOR_API LogicalDisk public: static list GetInstances(); static list GetCounterList(); + static double GetFreeSpacePercent(wchar_t * instanceName); + static double GetFreeMegabytes(wchar_t * instanceName); + static double GetCurrentDiskQueueLength(wchar_t * instanceName); + static double GetDiskTimePercent(wchar_t * instanceName, int idleTime); + static double GetAverageDiskQueueLength(wchar_t * instanceName, int idleTime); + static double GetDiskReadTimePercent(wchar_t * instanceName, int idleTime); + static double GetAverageDiskReadQueueLength(wchar_t * instanceName, int idleTime); + static double GetDiskWriteTimePercent(wchar_t * instanceName, int idleTime); + static double GetAverageDiskWriteQueueLength(wchar_t * instanceName, int idleTime); + static double GetAverageDiskTransferTimeInSecond(wchar_t * instanceName, int idleTime); + static double GetAverageDiskReadTimeInSecond(wchar_t * instanceName, int idleTime); + static double GetAverageDiskWriteTimeInSecond(wchar_t * instanceName, int idleTime); + static double GetDiskTransfersPerSecond(wchar_t * instanceName, int idleTime); + static double GetDiskReadsPerSecond(wchar_t * instanceName, int idleTime); + static double GetDiskWritesPerSecond(wchar_t * instanceName, int idleTime); + static double GetDiskBytesPerSecond(wchar_t * instanceName, int idleTime); + static double GetDiskReadBytesPerSecond(wchar_t * instanceName, int idleTime); + static double GetDiskWriteBytesPerSecond(wchar_t * instanceName, int idleTime); + static double GetAverageDiskBytesPerTransfer(wchar_t * instanceName, int idleTime); + static double GetAverageDiskBytesPerRead(wchar_t * instanceName, int idleTime); + static double GetAverageDiskBytesPerWrite(wchar_t * instanceName, int idleTime); + static double GetIdleTimePercent(wchar_t * instanceName, int idleTime); + static double GetSplitIOPerSecond(wchar_t * instanceName, int idleTime); }; \ No newline at end of file diff --git a/WindowsMonitor/Monitor/MonitorApi.h b/WindowsMonitor/Monitor/MonitorApi.h index 40ae84da..dbba90c7 100644 --- a/WindowsMonitor/Monitor/MonitorApi.h +++ b/WindowsMonitor/Monitor/MonitorApi.h @@ -10,6 +10,73 @@ #include using namespace std; +class MONITOR_API Common +{ +public: + static double GetCounterValue(const wchar_t * fullCounterPath); + static double GetCounterValueWithIdle(const wchar_t * fullCounterPath,int idleTime); + static list GetInstanceName(const wchar_t * objectName); + static list GetCounterList(const wchar_t * objectName); +}; + +class MONITOR_API LogicalDisk +{ +public: + static list GetInstances(); + static list GetCounterList(); + static double GetFreeSpacePercent(wchar_t * instanceName); + static double GetFreeMegabytes(wchar_t * instanceName); + static double GetCurrentDiskQueueLength(wchar_t * instanceName); + static double GetDiskTimePercent(wchar_t * instanceName, int idleTime); + static double GetAverageDiskQueueLength(wchar_t * instanceName, int idleTime); + static double GetDiskReadTimePercent(wchar_t * instanceName, int idleTime); + static double GetAverageDiskReadQueueLength(wchar_t * instanceName, int idleTime); + static double GetDiskWriteTimePercent(wchar_t * instanceName, int idleTime); + static double GetAverageDiskWriteQueueLength(wchar_t * instanceName, int idleTime); + static double GetAverageDiskTransferTimeInSecond(wchar_t * instanceName, int idleTime); + static double GetAverageDiskReadTimeInSecond(wchar_t * instanceName, int idleTime); + static double GetAverageDiskWriteTimeInSecond(wchar_t * instanceName, int idleTime); + static double GetDiskTransfersPerSecond(wchar_t * instanceName, int idleTime); + static double GetDiskReadsPerSecond(wchar_t * instanceName, int idleTime); + static double GetDiskWritesPerSecond(wchar_t * instanceName, int idleTime); + static double GetDiskBytesPerSecond(wchar_t * instanceName, int idleTime); + static double GetDiskReadBytesPerSecond(wchar_t * instanceName, int idleTime); + static double GetDiskWriteBytesPerSecond(wchar_t * instanceName, int idleTime); + static double GetAverageDiskBytesPerTransfer(wchar_t * instanceName, int idleTime); + static double GetAverageDiskBytesPerRead(wchar_t * instanceName, int idleTime); + static double GetAverageDiskBytesPerWrite(wchar_t * instanceName, int idleTime); + static double GetIdleTimePercent(wchar_t * instanceName, int idleTime); + static double GetSplitIOPerSecond(wchar_t * instanceName, int idleTime); +}; + +class MONITOR_API Memory +{ +public: + static list GetCounterList(); +}; + +class MONITOR_API NetworkInterface +{ +public: + static list GetInstances(); + static list GetCounterList(); +}; + +class MONITOR_API PhysicalDisk +{ +public: + static list GetInstances(); + static list GetCounterList(); +}; + +class MONITOR_API Process +{ +public: + static list GetInstances(); + static list GetCounterList(); + static double Process::GetProcessId(wchar_t * instanceName); +}; + class MONITOR_API Processor { public: @@ -73,13 +140,6 @@ public: static list GetCounterList(); }; -class MONITOR_API NetworkInterface -{ -public: - static list GetInstances(); - static list GetCounterList(); -}; - class MONITOR_API Tcp { public: @@ -93,31 +153,3 @@ public: static list GetCounterListForV4(); static list GetCounterListForV6(); }; - -class MONITOR_API PhysicalDisk -{ -public: - static list GetInstances(); - static list GetCounterList(); -}; - -class MONITOR_API Memory -{ -public: - static list GetCounterList(); -}; - -class MONITOR_API LogicalDisk -{ -public: - static list GetInstances(); - static list GetCounterList(); -}; - -class MONITOR_API Process -{ -public: - static list GetInstances(); - static list GetCounterList(); - static double Process::GetProcessId(wchar_t * instanceName); -}; \ No newline at end of file diff --git a/WindowsMonitor/Monitor/PhysicalDisk.cpp b/WindowsMonitor/Monitor/PhysicalDisk.cpp index b123dca5..5bbde559 100644 --- a/WindowsMonitor/Monitor/PhysicalDisk.cpp +++ b/WindowsMonitor/Monitor/PhysicalDisk.cpp @@ -13,6 +13,7 @@ list PhysicalDisk::GetCounterList() return Common::GetCounterList(L"PhysicalDisk"); } +// Current Disk Queue Length // % Disk Time // Avg. Disk Queue Length // % Disk Read Time diff --git a/WindowsMonitor/Native/MonitorApi.h b/WindowsMonitor/Native/MonitorApi.h index 40ae84da..dbba90c7 100644 --- a/WindowsMonitor/Native/MonitorApi.h +++ b/WindowsMonitor/Native/MonitorApi.h @@ -10,6 +10,73 @@ #include using namespace std; +class MONITOR_API Common +{ +public: + static double GetCounterValue(const wchar_t * fullCounterPath); + static double GetCounterValueWithIdle(const wchar_t * fullCounterPath,int idleTime); + static list GetInstanceName(const wchar_t * objectName); + static list GetCounterList(const wchar_t * objectName); +}; + +class MONITOR_API LogicalDisk +{ +public: + static list GetInstances(); + static list GetCounterList(); + static double GetFreeSpacePercent(wchar_t * instanceName); + static double GetFreeMegabytes(wchar_t * instanceName); + static double GetCurrentDiskQueueLength(wchar_t * instanceName); + static double GetDiskTimePercent(wchar_t * instanceName, int idleTime); + static double GetAverageDiskQueueLength(wchar_t * instanceName, int idleTime); + static double GetDiskReadTimePercent(wchar_t * instanceName, int idleTime); + static double GetAverageDiskReadQueueLength(wchar_t * instanceName, int idleTime); + static double GetDiskWriteTimePercent(wchar_t * instanceName, int idleTime); + static double GetAverageDiskWriteQueueLength(wchar_t * instanceName, int idleTime); + static double GetAverageDiskTransferTimeInSecond(wchar_t * instanceName, int idleTime); + static double GetAverageDiskReadTimeInSecond(wchar_t * instanceName, int idleTime); + static double GetAverageDiskWriteTimeInSecond(wchar_t * instanceName, int idleTime); + static double GetDiskTransfersPerSecond(wchar_t * instanceName, int idleTime); + static double GetDiskReadsPerSecond(wchar_t * instanceName, int idleTime); + static double GetDiskWritesPerSecond(wchar_t * instanceName, int idleTime); + static double GetDiskBytesPerSecond(wchar_t * instanceName, int idleTime); + static double GetDiskReadBytesPerSecond(wchar_t * instanceName, int idleTime); + static double GetDiskWriteBytesPerSecond(wchar_t * instanceName, int idleTime); + static double GetAverageDiskBytesPerTransfer(wchar_t * instanceName, int idleTime); + static double GetAverageDiskBytesPerRead(wchar_t * instanceName, int idleTime); + static double GetAverageDiskBytesPerWrite(wchar_t * instanceName, int idleTime); + static double GetIdleTimePercent(wchar_t * instanceName, int idleTime); + static double GetSplitIOPerSecond(wchar_t * instanceName, int idleTime); +}; + +class MONITOR_API Memory +{ +public: + static list GetCounterList(); +}; + +class MONITOR_API NetworkInterface +{ +public: + static list GetInstances(); + static list GetCounterList(); +}; + +class MONITOR_API PhysicalDisk +{ +public: + static list GetInstances(); + static list GetCounterList(); +}; + +class MONITOR_API Process +{ +public: + static list GetInstances(); + static list GetCounterList(); + static double Process::GetProcessId(wchar_t * instanceName); +}; + class MONITOR_API Processor { public: @@ -73,13 +140,6 @@ public: static list GetCounterList(); }; -class MONITOR_API NetworkInterface -{ -public: - static list GetInstances(); - static list GetCounterList(); -}; - class MONITOR_API Tcp { public: @@ -93,31 +153,3 @@ public: static list GetCounterListForV4(); static list GetCounterListForV6(); }; - -class MONITOR_API PhysicalDisk -{ -public: - static list GetInstances(); - static list GetCounterList(); -}; - -class MONITOR_API Memory -{ -public: - static list GetCounterList(); -}; - -class MONITOR_API LogicalDisk -{ -public: - static list GetInstances(); - static list GetCounterList(); -}; - -class MONITOR_API Process -{ -public: - static list GetInstances(); - static list GetCounterList(); - static double Process::GetProcessId(wchar_t * instanceName); -}; \ No newline at end of file diff --git a/WindowsMonitor/Test/MonitorApi.h b/WindowsMonitor/Test/MonitorApi.h index 40ae84da..dbba90c7 100644 --- a/WindowsMonitor/Test/MonitorApi.h +++ b/WindowsMonitor/Test/MonitorApi.h @@ -10,6 +10,73 @@ #include using namespace std; +class MONITOR_API Common +{ +public: + static double GetCounterValue(const wchar_t * fullCounterPath); + static double GetCounterValueWithIdle(const wchar_t * fullCounterPath,int idleTime); + static list GetInstanceName(const wchar_t * objectName); + static list GetCounterList(const wchar_t * objectName); +}; + +class MONITOR_API LogicalDisk +{ +public: + static list GetInstances(); + static list GetCounterList(); + static double GetFreeSpacePercent(wchar_t * instanceName); + static double GetFreeMegabytes(wchar_t * instanceName); + static double GetCurrentDiskQueueLength(wchar_t * instanceName); + static double GetDiskTimePercent(wchar_t * instanceName, int idleTime); + static double GetAverageDiskQueueLength(wchar_t * instanceName, int idleTime); + static double GetDiskReadTimePercent(wchar_t * instanceName, int idleTime); + static double GetAverageDiskReadQueueLength(wchar_t * instanceName, int idleTime); + static double GetDiskWriteTimePercent(wchar_t * instanceName, int idleTime); + static double GetAverageDiskWriteQueueLength(wchar_t * instanceName, int idleTime); + static double GetAverageDiskTransferTimeInSecond(wchar_t * instanceName, int idleTime); + static double GetAverageDiskReadTimeInSecond(wchar_t * instanceName, int idleTime); + static double GetAverageDiskWriteTimeInSecond(wchar_t * instanceName, int idleTime); + static double GetDiskTransfersPerSecond(wchar_t * instanceName, int idleTime); + static double GetDiskReadsPerSecond(wchar_t * instanceName, int idleTime); + static double GetDiskWritesPerSecond(wchar_t * instanceName, int idleTime); + static double GetDiskBytesPerSecond(wchar_t * instanceName, int idleTime); + static double GetDiskReadBytesPerSecond(wchar_t * instanceName, int idleTime); + static double GetDiskWriteBytesPerSecond(wchar_t * instanceName, int idleTime); + static double GetAverageDiskBytesPerTransfer(wchar_t * instanceName, int idleTime); + static double GetAverageDiskBytesPerRead(wchar_t * instanceName, int idleTime); + static double GetAverageDiskBytesPerWrite(wchar_t * instanceName, int idleTime); + static double GetIdleTimePercent(wchar_t * instanceName, int idleTime); + static double GetSplitIOPerSecond(wchar_t * instanceName, int idleTime); +}; + +class MONITOR_API Memory +{ +public: + static list GetCounterList(); +}; + +class MONITOR_API NetworkInterface +{ +public: + static list GetInstances(); + static list GetCounterList(); +}; + +class MONITOR_API PhysicalDisk +{ +public: + static list GetInstances(); + static list GetCounterList(); +}; + +class MONITOR_API Process +{ +public: + static list GetInstances(); + static list GetCounterList(); + static double Process::GetProcessId(wchar_t * instanceName); +}; + class MONITOR_API Processor { public: @@ -73,13 +140,6 @@ public: static list GetCounterList(); }; -class MONITOR_API NetworkInterface -{ -public: - static list GetInstances(); - static list GetCounterList(); -}; - class MONITOR_API Tcp { public: @@ -93,31 +153,3 @@ public: static list GetCounterListForV4(); static list GetCounterListForV6(); }; - -class MONITOR_API PhysicalDisk -{ -public: - static list GetInstances(); - static list GetCounterList(); -}; - -class MONITOR_API Memory -{ -public: - static list GetCounterList(); -}; - -class MONITOR_API LogicalDisk -{ -public: - static list GetInstances(); - static list GetCounterList(); -}; - -class MONITOR_API Process -{ -public: - static list GetInstances(); - static list GetCounterList(); - static double Process::GetProcessId(wchar_t * instanceName); -}; \ No newline at end of file diff --git a/WindowsMonitor/Test/Test.cpp b/WindowsMonitor/Test/Test.cpp index d41f8f72..8c77887d 100644 --- a/WindowsMonitor/Test/Test.cpp +++ b/WindowsMonitor/Test/Test.cpp @@ -1,10 +1,23 @@ #include "stdafx.h" int _tmain(int argc, _TCHAR* argv[]) -{ +{ + //list counterList=PhysicalDisk::GetCounterList(); + //list instances=Process::GetInstances(); + //list::iterator iter; + //std::wcout.imbue(std::locale("chs")); + //for(iter=counterList.begin();iter!=counterList.end();iter++) + //{ + // wcout<<(*iter).c_str()<