system monitor completed.

This commit is contained in:
Zhen Tang 2013-07-08 23:59:28 +08:00
parent 5f60afd253
commit b2852333ef
6 changed files with 189 additions and 24 deletions

View File

@ -246,6 +246,23 @@ class MONITOR_API System
{
public:
static list<wstring> GetCounterList();
static double GetFileReadOperationsPerSecond(int idleTime);
static double GetFileWriteOperationsPerSecond(int idleTime);
static double GetFileControlOperationsPerSecond(int idleTime);
static double GetFileReadBytesPerSecond(int idleTime);
static double GetFileWriteBytesPerSecond(int idleTime);
static double GetFileControlBytesPerSecond(int idleTime);
static double GetContextSwitchesPerSecond(int idleTime);
static double GetSystemCallsPerSecond(int idleTime);
static double GetFileDataOperationsPerSecond(int idleTime);
static double GetSystemUpTime();
static double GetProcessorQueueLength();
static double GetProcessesCount();
static double GetThreadsCount();
static double GetAlignmentFixupsPerSecond(int idleTime);
static double GetExceptionDispatchesPerSecond(int idleTime);
static double GetFloatingEmulationsPerSecond(int idleTime);
static double GetRegistryQuotaInUsePercent();
};
class MONITOR_API TCPv4

View File

@ -9,52 +9,154 @@ list<wstring> System::GetCounterList()
}
// File Read Operations/sec
double System::GetFileReadOperationsPerSecond(int idleTime)
{
wstring fullCounterPath(L"");
fullCounterPath+=L"\\System\\File Read Operations/sec";
double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime);
return ret;
}
// File Write Operations/sec
double System::GetFileWriteOperationsPerSecond(int idleTime)
{
wstring fullCounterPath(L"");
fullCounterPath+=L"\\System\\File Write Operations/sec";
double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime);
return ret;
}
// File Control Operations/sec
double System::GetFileControlOperationsPerSecond(int idleTime)
{
wstring fullCounterPath(L"");
fullCounterPath+=L"\\System\\File Control Operations/sec";
double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime);
return ret;
}
// File Read Bytes/sec
double System::GetFileReadBytesPerSecond(int idleTime)
{
wstring fullCounterPath(L"");
fullCounterPath+=L"\\System\\File Read Bytes/sec";
double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime);
return ret;
}
// File Write Bytes/sec
double System::GetFileWriteBytesPerSecond(int idleTime)
{
wstring fullCounterPath(L"");
fullCounterPath+=L"\\System\\File Write Bytes/sec";
double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime);
return ret;
}
// File Control Bytes/sec
double System::GetFileControlBytesPerSecond(int idleTime)
{
wstring fullCounterPath(L"");
fullCounterPath+=L"\\System\\File Control Bytes/sec";
double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime);
return ret;
}
// Context Switches/sec
double System::GetContextSwitchesPerSecond(int idleTime)
{
wstring fullCounterPath(L"");
fullCounterPath+=L"\\System\\Context Switches/sec";
double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime);
return ret;
}
// System Calls/sec
double System::GetSystemCallsPerSecond(int idleTime)
{
wstring fullCounterPath(L"");
fullCounterPath+=L"\\System\\System Calls/sec";
double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime);
return ret;
}
// File Data Operations/sec
double System::GetFileDataOperationsPerSecond(int idleTime)
{
wstring fullCounterPath(L"");
fullCounterPath+=L"\\System\\File Data Operations/sec";
double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime);
return ret;
}
// System Up Time
double System::GetSystemUpTime()
{
wstring fullCounterPath(L"");
fullCounterPath+=L"\\System\\System Up Time";
double ret=Common::GetCounterValue(fullCounterPath.c_str());
return ret;
}
// Processor Queue Length
double System::GetProcessorQueueLength()
{
wstring fullCounterPath(L"");
fullCounterPath+=L"\\System\\Processor Queue Length";
double ret=Common::GetCounterValue(fullCounterPath.c_str());
return ret;
}
// Processes
double System::GetProcessesCount()
{
wstring fullCounterPath(L"");
fullCounterPath+=L"\\System\\Processes";
double ret=Common::GetCounterValue(fullCounterPath.c_str());
return ret;
}
// Threads
double System::GetThreadsCount()
{
wstring fullCounterPath(L"");
fullCounterPath+=L"\\System\\Threads";
double ret=Common::GetCounterValue(fullCounterPath.c_str());
return ret;
}
// Alignment Fixups/sec
double System::GetAlignmentFixupsPerSecond(int idleTime)
{
wstring fullCounterPath(L"");
fullCounterPath+=L"\\System\\Alignment Fixups/sec";
double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime);
return ret;
}
// Exception Dispatches/sec
double System::GetExceptionDispatchesPerSecond(int idleTime)
{
wstring fullCounterPath(L"");
fullCounterPath+=L"\\System\\Exception Dispatches/sec";
double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime);
return ret;
}
// Floating Emulations/sec
double System::GetFloatingEmulationsPerSecond(int idleTime)
{
wstring fullCounterPath(L"");
fullCounterPath+=L"\\System\\Floating Emulations/sec";
double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime);
return ret;
}
// % Registry Quota In Use
double System::GetRegistryQuotaInUsePercent()
{
wstring fullCounterPath(L"");
fullCounterPath+=L"\\System\\% Registry Quota In Use";
double ret=Common::GetCounterValue(fullCounterPath.c_str());
return ret;
}

View File

@ -8,4 +8,21 @@ class MONITOR_API System
{
public:
static list<wstring> GetCounterList();
static double GetFileReadOperationsPerSecond(int idleTime);
static double GetFileWriteOperationsPerSecond(int idleTime);
static double GetFileControlOperationsPerSecond(int idleTime);
static double GetFileReadBytesPerSecond(int idleTime);
static double GetFileWriteBytesPerSecond(int idleTime);
static double GetFileControlBytesPerSecond(int idleTime);
static double GetContextSwitchesPerSecond(int idleTime);
static double GetSystemCallsPerSecond(int idleTime);
static double GetFileDataOperationsPerSecond(int idleTime);
static double GetSystemUpTime();
static double GetProcessorQueueLength();
static double GetProcessesCount();
static double GetThreadsCount();
static double GetAlignmentFixupsPerSecond(int idleTime);
static double GetExceptionDispatchesPerSecond(int idleTime);
static double GetFloatingEmulationsPerSecond(int idleTime);
static double GetRegistryQuotaInUsePercent();
};

View File

@ -246,6 +246,23 @@ class MONITOR_API System
{
public:
static list<wstring> GetCounterList();
static double GetFileReadOperationsPerSecond(int idleTime);
static double GetFileWriteOperationsPerSecond(int idleTime);
static double GetFileControlOperationsPerSecond(int idleTime);
static double GetFileReadBytesPerSecond(int idleTime);
static double GetFileWriteBytesPerSecond(int idleTime);
static double GetFileControlBytesPerSecond(int idleTime);
static double GetContextSwitchesPerSecond(int idleTime);
static double GetSystemCallsPerSecond(int idleTime);
static double GetFileDataOperationsPerSecond(int idleTime);
static double GetSystemUpTime();
static double GetProcessorQueueLength();
static double GetProcessesCount();
static double GetThreadsCount();
static double GetAlignmentFixupsPerSecond(int idleTime);
static double GetExceptionDispatchesPerSecond(int idleTime);
static double GetFloatingEmulationsPerSecond(int idleTime);
static double GetRegistryQuotaInUsePercent();
};
class MONITOR_API TCPv4

View File

@ -246,6 +246,23 @@ class MONITOR_API System
{
public:
static list<wstring> GetCounterList();
static double GetFileReadOperationsPerSecond(int idleTime);
static double GetFileWriteOperationsPerSecond(int idleTime);
static double GetFileControlOperationsPerSecond(int idleTime);
static double GetFileReadBytesPerSecond(int idleTime);
static double GetFileWriteBytesPerSecond(int idleTime);
static double GetFileControlBytesPerSecond(int idleTime);
static double GetContextSwitchesPerSecond(int idleTime);
static double GetSystemCallsPerSecond(int idleTime);
static double GetFileDataOperationsPerSecond(int idleTime);
static double GetSystemUpTime();
static double GetProcessorQueueLength();
static double GetProcessesCount();
static double GetThreadsCount();
static double GetAlignmentFixupsPerSecond(int idleTime);
static double GetExceptionDispatchesPerSecond(int idleTime);
static double GetFloatingEmulationsPerSecond(int idleTime);
static double GetRegistryQuotaInUsePercent();
};
class MONITOR_API TCPv4

View File

@ -2,21 +2,16 @@
int _tmain(int argc, _TCHAR* argv[])
{
list<wstring> counterList=Process::GetCounterList();
list<wstring> instances=Process::GetInstances();
list<wstring> counterList=System::GetCounterList();
list<wstring>::iterator iter;
std::wcout.imbue(std::locale("chs"));
for(iter=counterList.begin();iter!=counterList.end();iter++)
{
wcout<<(*iter).c_str()<<endl;
}
for(iter=instances.begin();iter!=instances.end();iter++)
{
wcout<<(*iter).c_str()<<endl;
}
while(1)
{
printf("%lf\n",Process::GetPrivateWorkingSet(L"_Total"));
printf("%lf\n",System::GetRegistryQuotaInUsePercent());
}
return 0;
}