diff --git a/WindowsMonitor/Monitor/MonitorApi.h b/WindowsMonitor/Monitor/MonitorApi.h index 4a5269e9..191a0858 100644 --- a/WindowsMonitor/Monitor/MonitorApi.h +++ b/WindowsMonitor/Monitor/MonitorApi.h @@ -269,6 +269,15 @@ class MONITOR_API TCPv4 { public: static list GetCounterList(); + static double GetSegmentsPerSecond(int idleTime); + static double GetConnectionsEstablished(); + static double GetConnectionsActive(); + static double GetConnectionsPassive(); + static double GetConnectionFailures(); + static double GetConnectionsReset(); + static double GetSegmentsReceivedPerSecond(int idleTime); + static double GetSegmentsSentPerSecond(int idleTime); + static double GetSegmentsRetransmittedPerSecond(int idleTime); }; class MONITOR_API TCPv6 diff --git a/WindowsMonitor/Monitor/TCPv4.cpp b/WindowsMonitor/Monitor/TCPv4.cpp index c6edfb25..91ca2c3f 100644 --- a/WindowsMonitor/Monitor/TCPv4.cpp +++ b/WindowsMonitor/Monitor/TCPv4.cpp @@ -9,11 +9,82 @@ list TCPv4::GetCounterList() } // Segments/sec +double TCPv4::GetSegmentsPerSecond(int idleTime) +{ + wstring fullCounterPath(L""); + fullCounterPath+=L"\\TCPv4\\Segments/sec"; + double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime); + return ret; +} + // Connections Established +double TCPv4::GetConnectionsEstablished() +{ + wstring fullCounterPath(L""); + fullCounterPath+=L"\\TCPv4\\Connections Established"; + double ret=Common::GetCounterValue(fullCounterPath.c_str()); + return ret; +} + // Connections Active +double TCPv4::GetConnectionsActive() +{ + wstring fullCounterPath(L""); + fullCounterPath+=L"\\TCPv4\\Connections Active"; + double ret=Common::GetCounterValue(fullCounterPath.c_str()); + return ret; +} + // Connections Passive +double TCPv4::GetConnectionsPassive() +{ + wstring fullCounterPath(L""); + fullCounterPath+=L"\\TCPv4\\Connections Passive"; + double ret=Common::GetCounterValue(fullCounterPath.c_str()); + return ret; +} + // Connection Failures +double TCPv4::GetConnectionFailures() +{ + wstring fullCounterPath(L""); + fullCounterPath+=L"\\TCPv4\\Connection Failures"; + double ret=Common::GetCounterValue(fullCounterPath.c_str()); + return ret; +} + // Connections Reset +double TCPv4::GetConnectionsReset() +{ + wstring fullCounterPath(L""); + fullCounterPath+=L"\\TCPv4\\Connections Reset"; + double ret=Common::GetCounterValue(fullCounterPath.c_str()); + return ret; +} + // Segments Received/sec +double TCPv4::GetSegmentsReceivedPerSecond(int idleTime) +{ + wstring fullCounterPath(L""); + fullCounterPath+=L"\\TCPv4\\Segments Received/sec"; + double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime); + return ret; +} + // Segments Sent/sec -// Segments Retransmitted/sec \ No newline at end of file +double TCPv4::GetSegmentsSentPerSecond(int idleTime) +{ + wstring fullCounterPath(L""); + fullCounterPath+=L"\\TCPv4\\Segments Sent/sec"; + double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime); + return ret; +} + +// Segments Retransmitted/sec +double TCPv4::GetSegmentsRetransmittedPerSecond(int idleTime) +{ + wstring fullCounterPath(L""); + fullCounterPath+=L"\\TCPv4\\Segments Retransmitted/sec"; + double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime); + return ret; +} \ No newline at end of file diff --git a/WindowsMonitor/Monitor/TCPv4.h b/WindowsMonitor/Monitor/TCPv4.h index 67816c39..680b6919 100644 --- a/WindowsMonitor/Monitor/TCPv4.h +++ b/WindowsMonitor/Monitor/TCPv4.h @@ -8,4 +8,13 @@ class MONITOR_API TCPv4 { public: static list GetCounterList(); + static double GetSegmentsPerSecond(int idleTime); + static double GetConnectionsEstablished(); + static double GetConnectionsActive(); + static double GetConnectionsPassive(); + static double GetConnectionFailures(); + static double GetConnectionsReset(); + static double GetSegmentsReceivedPerSecond(int idleTime); + static double GetSegmentsSentPerSecond(int idleTime); + static double GetSegmentsRetransmittedPerSecond(int idleTime); }; \ No newline at end of file diff --git a/WindowsMonitor/Native/MonitorApi.h b/WindowsMonitor/Native/MonitorApi.h index 4a5269e9..191a0858 100644 --- a/WindowsMonitor/Native/MonitorApi.h +++ b/WindowsMonitor/Native/MonitorApi.h @@ -269,6 +269,15 @@ class MONITOR_API TCPv4 { public: static list GetCounterList(); + static double GetSegmentsPerSecond(int idleTime); + static double GetConnectionsEstablished(); + static double GetConnectionsActive(); + static double GetConnectionsPassive(); + static double GetConnectionFailures(); + static double GetConnectionsReset(); + static double GetSegmentsReceivedPerSecond(int idleTime); + static double GetSegmentsSentPerSecond(int idleTime); + static double GetSegmentsRetransmittedPerSecond(int idleTime); }; class MONITOR_API TCPv6 diff --git a/WindowsMonitor/Test/MonitorApi.h b/WindowsMonitor/Test/MonitorApi.h index 4a5269e9..191a0858 100644 --- a/WindowsMonitor/Test/MonitorApi.h +++ b/WindowsMonitor/Test/MonitorApi.h @@ -269,6 +269,15 @@ class MONITOR_API TCPv4 { public: static list GetCounterList(); + static double GetSegmentsPerSecond(int idleTime); + static double GetConnectionsEstablished(); + static double GetConnectionsActive(); + static double GetConnectionsPassive(); + static double GetConnectionFailures(); + static double GetConnectionsReset(); + static double GetSegmentsReceivedPerSecond(int idleTime); + static double GetSegmentsSentPerSecond(int idleTime); + static double GetSegmentsRetransmittedPerSecond(int idleTime); }; class MONITOR_API TCPv6 diff --git a/WindowsMonitor/Test/Test.cpp b/WindowsMonitor/Test/Test.cpp index f34cec5e..5febe814 100644 --- a/WindowsMonitor/Test/Test.cpp +++ b/WindowsMonitor/Test/Test.cpp @@ -2,7 +2,7 @@ int _tmain(int argc, _TCHAR* argv[]) { - list counterList=System::GetCounterList(); + list counterList=TCPv4::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",System::GetRegistryQuotaInUsePercent()); + printf("%lf\n",TCPv4::GetSegmentsRetransmittedPerSecond(1000)); } return 0; }