tcpv4 monitor completed.

This commit is contained in:
Zhen Tang 2013-07-09 00:18:41 +08:00
parent b2852333ef
commit 9d36ca60b4
6 changed files with 110 additions and 3 deletions

View File

@ -269,6 +269,15 @@ class MONITOR_API TCPv4
{
public:
static list<wstring> 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

View File

@ -9,11 +9,82 @@ list<wstring> 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
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;
}

View File

@ -8,4 +8,13 @@ class MONITOR_API TCPv4
{
public:
static list<wstring> 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);
};

View File

@ -269,6 +269,15 @@ class MONITOR_API TCPv4
{
public:
static list<wstring> 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

View File

@ -269,6 +269,15 @@ class MONITOR_API TCPv4
{
public:
static list<wstring> 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

View File

@ -2,7 +2,7 @@
int _tmain(int argc, _TCHAR* argv[])
{
list<wstring> counterList=System::GetCounterList();
list<wstring> counterList=TCPv4::GetCounterList();
list<wstring>::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;
}