udpv4 monitor completed.

This commit is contained in:
Zhen Tang 2013-07-09 23:12:29 +08:00
parent c7ceef609d
commit 3b07c4547b
6 changed files with 62 additions and 3 deletions

View File

@ -299,6 +299,11 @@ class MONITOR_API UDPv4
{
public:
static list<wstring> 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

View File

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

View File

@ -8,4 +8,9 @@ class MONITOR_API UDPv4
{
public:
static list<wstring> GetCounterList();
static double GetDatagramsPerSecond(int idleTime);
static double GetDatagramsReceivedPerSecond(int idleTime);
static double GetDatagramsNoPortPerSecond(int idleTime);
static double GetDatagramsReceivedErrors();
static double GetDatagramsSentPerSecond(int idleTime);
};

View File

@ -299,6 +299,11 @@ class MONITOR_API UDPv4
{
public:
static list<wstring> 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

View File

@ -299,6 +299,11 @@ class MONITOR_API UDPv4
{
public:
static list<wstring> 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

View File

@ -2,7 +2,7 @@
int _tmain(int argc, _TCHAR* argv[])
{
list<wstring> counterList=TCPv6::GetCounterList();
list<wstring> counterList=UDPv4::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",TCPv6::GetSegmentsRetransmittedPerSecond(1000));
printf("%lf\n",UDPv4::GetDatagramsSentPerSecond(1000));
}
return 0;
}