diff --git a/WindowsMonitor/Monitor/MonitorApi.h b/WindowsMonitor/Monitor/MonitorApi.h index 0c20a385..a655eefa 100644 --- a/WindowsMonitor/Monitor/MonitorApi.h +++ b/WindowsMonitor/Monitor/MonitorApi.h @@ -299,6 +299,11 @@ class MONITOR_API UDPv4 { public: static list GetCounterList(); + static double GetDatagramsPerSecond(int idleTime); + static double GetDatagramsReceivedPerSecond(int idleTime); + static double GetDatagramsNoPortPerSecond(int idleTime); + static double GetDatagramsReceivedErrors(); + static double GetDatagramsSentPerSecond(int idleTime); }; class MONITOR_API UDPv6 diff --git a/WindowsMonitor/Monitor/UDPv4.cpp b/WindowsMonitor/Monitor/UDPv4.cpp index 1c57eee9..a3c27159 100644 --- a/WindowsMonitor/Monitor/UDPv4.cpp +++ b/WindowsMonitor/Monitor/UDPv4.cpp @@ -9,7 +9,46 @@ list UDPv4::GetCounterList() } // Datagrams/sec +double UDPv4::GetDatagramsPerSecond(int idleTime) +{ + wstring fullCounterPath(L""); + fullCounterPath+=L"\\UDPv4\\Datagrams/sec"; + double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime); + return ret; +} + // Datagrams Received/sec +double UDPv4::GetDatagramsReceivedPerSecond(int idleTime) +{ + wstring fullCounterPath(L""); + fullCounterPath+=L"\\UDPv4\\Datagrams Received/sec"; + double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime); + return ret; +} + // Datagrams No Port/sec +double UDPv4::GetDatagramsNoPortPerSecond(int idleTime) +{ + wstring fullCounterPath(L""); + fullCounterPath+=L"\\UDPv4\\Datagrams No Port/sec"; + double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime); + return ret; +} + // Datagrams Received Errors -// Datagrams Sent/sec \ No newline at end of file +double UDPv4::GetDatagramsReceivedErrors() +{ + wstring fullCounterPath(L""); + fullCounterPath+=L"\\UDPv4\\Datagrams Received Errors"; + double ret=Common::GetCounterValue(fullCounterPath.c_str()); + return ret; +} + +// Datagrams Sent/sec +double UDPv4::GetDatagramsSentPerSecond(int idleTime) +{ + wstring fullCounterPath(L""); + fullCounterPath+=L"\\UDPv4\\Datagrams Sent/sec"; + double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime); + return ret; +} diff --git a/WindowsMonitor/Monitor/UDPv4.h b/WindowsMonitor/Monitor/UDPv4.h index 43e85043..a57e5221 100644 --- a/WindowsMonitor/Monitor/UDPv4.h +++ b/WindowsMonitor/Monitor/UDPv4.h @@ -8,4 +8,9 @@ class MONITOR_API UDPv4 { public: static list GetCounterList(); + static double GetDatagramsPerSecond(int idleTime); + static double GetDatagramsReceivedPerSecond(int idleTime); + static double GetDatagramsNoPortPerSecond(int idleTime); + static double GetDatagramsReceivedErrors(); + static double GetDatagramsSentPerSecond(int idleTime); }; \ No newline at end of file diff --git a/WindowsMonitor/Native/MonitorApi.h b/WindowsMonitor/Native/MonitorApi.h index 0c20a385..a655eefa 100644 --- a/WindowsMonitor/Native/MonitorApi.h +++ b/WindowsMonitor/Native/MonitorApi.h @@ -299,6 +299,11 @@ class MONITOR_API UDPv4 { public: static list GetCounterList(); + static double GetDatagramsPerSecond(int idleTime); + static double GetDatagramsReceivedPerSecond(int idleTime); + static double GetDatagramsNoPortPerSecond(int idleTime); + static double GetDatagramsReceivedErrors(); + static double GetDatagramsSentPerSecond(int idleTime); }; class MONITOR_API UDPv6 diff --git a/WindowsMonitor/Test/MonitorApi.h b/WindowsMonitor/Test/MonitorApi.h index 0c20a385..a655eefa 100644 --- a/WindowsMonitor/Test/MonitorApi.h +++ b/WindowsMonitor/Test/MonitorApi.h @@ -299,6 +299,11 @@ class MONITOR_API UDPv4 { public: static list GetCounterList(); + static double GetDatagramsPerSecond(int idleTime); + static double GetDatagramsReceivedPerSecond(int idleTime); + static double GetDatagramsNoPortPerSecond(int idleTime); + static double GetDatagramsReceivedErrors(); + static double GetDatagramsSentPerSecond(int idleTime); }; class MONITOR_API UDPv6 diff --git a/WindowsMonitor/Test/Test.cpp b/WindowsMonitor/Test/Test.cpp index 4c75d02f..816ac339 100644 --- a/WindowsMonitor/Test/Test.cpp +++ b/WindowsMonitor/Test/Test.cpp @@ -2,7 +2,7 @@ int _tmain(int argc, _TCHAR* argv[]) { - list counterList=TCPv6::GetCounterList(); + list counterList=UDPv4::GetCounterList(); list::iterator iter; std::wcout.imbue(std::locale("chs")); for(iter=counterList.begin();iter!=counterList.end();iter++) @@ -11,7 +11,7 @@ int _tmain(int argc, _TCHAR* argv[]) } while(1) { - printf("%lf\n",TCPv6::GetSegmentsRetransmittedPerSecond(1000)); + printf("%lf\n",UDPv4::GetDatagramsSentPerSecond(1000)); } return 0; }