physical disk monitor completed.
This commit is contained in:
parent
3d296d0ef1
commit
945ca03701
|
@ -127,6 +127,27 @@ class MONITOR_API PhysicalDisk
|
|||
public:
|
||||
static list<wstring> GetInstances();
|
||||
static list<wstring> GetCounterList();
|
||||
static double GetCurrentDiskQueueLength(const wchar_t * instanceName);
|
||||
static double GetDiskTimePercent(const wchar_t * instanceName, int idleTime);
|
||||
static double GetAverageDiskQueueLength(const wchar_t * instanceName, int idleTime);
|
||||
static double GetDiskReadTimePercent(const wchar_t * instanceName, int idleTime);
|
||||
static double GetAverageDiskReadQueueLength(const wchar_t * instanceName, int idleTime);
|
||||
static double GetDiskWriteTimePercent(const wchar_t * instanceName, int idleTime);
|
||||
static double GetAverageDiskWriteQueueLength(const wchar_t * instanceName, int idleTime);
|
||||
static double GetAverageDiskTransferTimeInSecond(const wchar_t * instanceName, int idleTime);
|
||||
static double GetAverageDiskReadTimeInSecond(const wchar_t * instanceName, int idleTime);
|
||||
static double GetAverageDiskWriteTimeInSecond(const wchar_t * instanceName, int idleTime);
|
||||
static double GetDiskTransfersPerSecond(const wchar_t * instanceName, int idleTime);
|
||||
static double GetDiskReadsPerSecond(const wchar_t * instanceName, int idleTime);
|
||||
static double GetDiskWritesPerSecond(const wchar_t * instanceName, int idleTime);
|
||||
static double GetDiskBytesPerSecond(const wchar_t * instanceName, int idleTime);
|
||||
static double GetDiskReadBytesPerSecond(const wchar_t * instanceName, int idleTime);
|
||||
static double GetDiskWriteBytesPerSecond(const wchar_t * instanceName, int idleTime);
|
||||
static double GetAverageDiskBytesPerTransfer(const wchar_t * instanceName, int idleTime);
|
||||
static double GetAverageDiskBytesPerRead(const wchar_t * instanceName, int idleTime);
|
||||
static double GetAverageDiskBytesPerWrite(const wchar_t * instanceName, int idleTime);
|
||||
static double GetIdleTimePercent(const wchar_t * instanceName, int idleTime);
|
||||
static double GetSplitIOPerSecond(const wchar_t * instanceName, int idleTime);
|
||||
};
|
||||
|
||||
class MONITOR_API Process
|
||||
|
|
|
@ -14,23 +14,232 @@ list<wstring> PhysicalDisk::GetCounterList()
|
|||
}
|
||||
|
||||
// Current Disk Queue Length
|
||||
double PhysicalDisk::GetCurrentDiskQueueLength(const wchar_t * instanceName)
|
||||
{
|
||||
wstring fullCounterPath(L"");
|
||||
fullCounterPath+=L"\\PhysicalDisk(";
|
||||
fullCounterPath+=instanceName;
|
||||
fullCounterPath+=L")\\Current Disk Queue Length";
|
||||
double ret=Common::GetCounterValue(fullCounterPath.c_str());
|
||||
return ret;
|
||||
}
|
||||
|
||||
// % Disk Time
|
||||
double PhysicalDisk::GetDiskTimePercent(const wchar_t * instanceName, int idleTime)
|
||||
{
|
||||
wstring fullCounterPath(L"");
|
||||
fullCounterPath+=L"\\PhysicalDisk(";
|
||||
fullCounterPath+=instanceName;
|
||||
fullCounterPath+=L")\\% Disk Time";
|
||||
double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime);
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Avg. Disk Queue Length
|
||||
double PhysicalDisk::GetAverageDiskQueueLength(const wchar_t * instanceName, int idleTime)
|
||||
{
|
||||
wstring fullCounterPath(L"");
|
||||
fullCounterPath+=L"\\PhysicalDisk(";
|
||||
fullCounterPath+=instanceName;
|
||||
fullCounterPath+=L")\\Avg. Disk Queue Length";
|
||||
double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime);
|
||||
return ret;
|
||||
}
|
||||
|
||||
// % Disk Read Time
|
||||
double PhysicalDisk::GetDiskReadTimePercent(const wchar_t * instanceName, int idleTime)
|
||||
{
|
||||
wstring fullCounterPath(L"");
|
||||
fullCounterPath+=L"\\PhysicalDisk(";
|
||||
fullCounterPath+=instanceName;
|
||||
fullCounterPath+=L")\\% Disk Read Time";
|
||||
double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime);
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Avg. Disk Read Queue Length
|
||||
double PhysicalDisk::GetAverageDiskReadQueueLength(const wchar_t * instanceName, int idleTime)
|
||||
{
|
||||
wstring fullCounterPath(L"");
|
||||
fullCounterPath+=L"\\PhysicalDisk(";
|
||||
fullCounterPath+=instanceName;
|
||||
fullCounterPath+=L")\\Avg. Disk Read Queue Length";
|
||||
double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime);
|
||||
return ret;
|
||||
}
|
||||
|
||||
// % Disk Write Time
|
||||
double PhysicalDisk::GetDiskWriteTimePercent(const wchar_t * instanceName, int idleTime)
|
||||
{
|
||||
wstring fullCounterPath(L"");
|
||||
fullCounterPath+=L"\\PhysicalDisk(";
|
||||
fullCounterPath+=instanceName;
|
||||
fullCounterPath+=L")\\% Disk Write Time";
|
||||
double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime);
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Avg. Disk Write Queue Length
|
||||
double PhysicalDisk::GetAverageDiskWriteQueueLength(const wchar_t * instanceName, int idleTime)
|
||||
{
|
||||
wstring fullCounterPath(L"");
|
||||
fullCounterPath+=L"\\PhysicalDisk(";
|
||||
fullCounterPath+=instanceName;
|
||||
fullCounterPath+=L")\\Avg. Disk Write Queue Length";
|
||||
double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime);
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Avg. Disk sec/Transfer
|
||||
double PhysicalDisk::GetAverageDiskTransferTimeInSecond(const wchar_t * instanceName, int idleTime)
|
||||
{
|
||||
wstring fullCounterPath(L"");
|
||||
fullCounterPath+=L"\\PhysicalDisk(";
|
||||
fullCounterPath+=instanceName;
|
||||
fullCounterPath+=L")\\Avg. Disk sec/Transfer";
|
||||
double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime);
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Avg. Disk sec/Read
|
||||
double PhysicalDisk::GetAverageDiskReadTimeInSecond(const wchar_t * instanceName, int idleTime)
|
||||
{
|
||||
wstring fullCounterPath(L"");
|
||||
fullCounterPath+=L"\\PhysicalDisk(";
|
||||
fullCounterPath+=instanceName;
|
||||
fullCounterPath+=L")\\Avg. Disk sec/Read";
|
||||
double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime);
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Avg. Disk sec/Write
|
||||
double PhysicalDisk::GetAverageDiskWriteTimeInSecond(const wchar_t * instanceName, int idleTime)
|
||||
{
|
||||
wstring fullCounterPath(L"");
|
||||
fullCounterPath+=L"\\PhysicalDisk(";
|
||||
fullCounterPath+=instanceName;
|
||||
fullCounterPath+=L")\\Avg. Disk sec/Write";
|
||||
double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime);
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Disk Transfers/sec
|
||||
double PhysicalDisk::GetDiskTransfersPerSecond(const wchar_t * instanceName, int idleTime)
|
||||
{
|
||||
wstring fullCounterPath(L"");
|
||||
fullCounterPath+=L"\\PhysicalDisk(";
|
||||
fullCounterPath+=instanceName;
|
||||
fullCounterPath+=L")\\Disk Transfers/sec";
|
||||
double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime);
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Disk Reads/sec
|
||||
double PhysicalDisk::GetDiskReadsPerSecond(const wchar_t * instanceName, int idleTime)
|
||||
{
|
||||
wstring fullCounterPath(L"");
|
||||
fullCounterPath+=L"\\PhysicalDisk(";
|
||||
fullCounterPath+=instanceName;
|
||||
fullCounterPath+=L")\\Disk Reads/sec";
|
||||
double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime);
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Disk Writes/sec
|
||||
double PhysicalDisk::GetDiskWritesPerSecond(const wchar_t * instanceName, int idleTime)
|
||||
{
|
||||
wstring fullCounterPath(L"");
|
||||
fullCounterPath+=L"\\PhysicalDisk(";
|
||||
fullCounterPath+=instanceName;
|
||||
fullCounterPath+=L")\\Disk Writes/sec";
|
||||
double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime);
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Disk Bytes/sec
|
||||
double PhysicalDisk::GetDiskBytesPerSecond(const wchar_t * instanceName, int idleTime)
|
||||
{
|
||||
wstring fullCounterPath(L"");
|
||||
fullCounterPath+=L"\\PhysicalDisk(";
|
||||
fullCounterPath+=instanceName;
|
||||
fullCounterPath+=L")\\Disk Bytes/sec";
|
||||
double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime);
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Disk Read Bytes/sec
|
||||
double PhysicalDisk::GetDiskReadBytesPerSecond(const wchar_t * instanceName, int idleTime)
|
||||
{
|
||||
wstring fullCounterPath(L"");
|
||||
fullCounterPath+=L"\\PhysicalDisk(";
|
||||
fullCounterPath+=instanceName;
|
||||
fullCounterPath+=L")\\Disk Read Bytes/sec";
|
||||
double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime);
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Disk Write Bytes/sec
|
||||
double PhysicalDisk::GetDiskWriteBytesPerSecond(const wchar_t * instanceName, int idleTime)
|
||||
{
|
||||
wstring fullCounterPath(L"");
|
||||
fullCounterPath+=L"\\PhysicalDisk(";
|
||||
fullCounterPath+=instanceName;
|
||||
fullCounterPath+=L")\\Disk Write Bytes/sec";
|
||||
double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime);
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Avg. Disk Bytes/Transfer
|
||||
double PhysicalDisk::GetAverageDiskBytesPerTransfer(const wchar_t * instanceName, int idleTime)
|
||||
{
|
||||
wstring fullCounterPath(L"");
|
||||
fullCounterPath+=L"\\PhysicalDisk(";
|
||||
fullCounterPath+=instanceName;
|
||||
fullCounterPath+=L")\\Avg. Disk Bytes/Transfer";
|
||||
double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime);
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Avg. Disk Bytes/Read
|
||||
double PhysicalDisk::GetAverageDiskBytesPerRead(const wchar_t * instanceName, int idleTime)
|
||||
{
|
||||
wstring fullCounterPath(L"");
|
||||
fullCounterPath+=L"\\PhysicalDisk(";
|
||||
fullCounterPath+=instanceName;
|
||||
fullCounterPath+=L")\\Avg. Disk Bytes/Read";
|
||||
double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime);
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Avg. Disk Bytes/Write
|
||||
double PhysicalDisk::GetAverageDiskBytesPerWrite(const wchar_t * instanceName, int idleTime)
|
||||
{
|
||||
wstring fullCounterPath(L"");
|
||||
fullCounterPath+=L"\\PhysicalDisk(";
|
||||
fullCounterPath+=instanceName;
|
||||
fullCounterPath+=L")\\Avg. Disk Bytes/Write";
|
||||
double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime);
|
||||
return ret;
|
||||
}
|
||||
|
||||
// % Idle Time
|
||||
// Split IO/Sec
|
||||
double PhysicalDisk::GetIdleTimePercent(const wchar_t * instanceName, int idleTime)
|
||||
{
|
||||
wstring fullCounterPath(L"");
|
||||
fullCounterPath+=L"\\PhysicalDisk(";
|
||||
fullCounterPath+=instanceName;
|
||||
fullCounterPath+=L")\\% Idle Time";
|
||||
double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime);
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Split IO/Sec
|
||||
double PhysicalDisk::GetSplitIOPerSecond(const wchar_t * instanceName, int idleTime)
|
||||
{
|
||||
wstring fullCounterPath(L"");
|
||||
fullCounterPath+=L"\\PhysicalDisk(";
|
||||
fullCounterPath+=instanceName;
|
||||
fullCounterPath+=L")\\Split IO/Sec";
|
||||
double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime);
|
||||
return ret;
|
||||
}
|
|
@ -9,4 +9,25 @@ class MONITOR_API PhysicalDisk
|
|||
public:
|
||||
static list<wstring> GetInstances();
|
||||
static list<wstring> GetCounterList();
|
||||
static double GetCurrentDiskQueueLength(const wchar_t * instanceName);
|
||||
static double GetDiskTimePercent(const wchar_t * instanceName, int idleTime);
|
||||
static double GetAverageDiskQueueLength(const wchar_t * instanceName, int idleTime);
|
||||
static double GetDiskReadTimePercent(const wchar_t * instanceName, int idleTime);
|
||||
static double GetAverageDiskReadQueueLength(const wchar_t * instanceName, int idleTime);
|
||||
static double GetDiskWriteTimePercent(const wchar_t * instanceName, int idleTime);
|
||||
static double GetAverageDiskWriteQueueLength(const wchar_t * instanceName, int idleTime);
|
||||
static double GetAverageDiskTransferTimeInSecond(const wchar_t * instanceName, int idleTime);
|
||||
static double GetAverageDiskReadTimeInSecond(const wchar_t * instanceName, int idleTime);
|
||||
static double GetAverageDiskWriteTimeInSecond(const wchar_t * instanceName, int idleTime);
|
||||
static double GetDiskTransfersPerSecond(const wchar_t * instanceName, int idleTime);
|
||||
static double GetDiskReadsPerSecond(const wchar_t * instanceName, int idleTime);
|
||||
static double GetDiskWritesPerSecond(const wchar_t * instanceName, int idleTime);
|
||||
static double GetDiskBytesPerSecond(const wchar_t * instanceName, int idleTime);
|
||||
static double GetDiskReadBytesPerSecond(const wchar_t * instanceName, int idleTime);
|
||||
static double GetDiskWriteBytesPerSecond(const wchar_t * instanceName, int idleTime);
|
||||
static double GetAverageDiskBytesPerTransfer(const wchar_t * instanceName, int idleTime);
|
||||
static double GetAverageDiskBytesPerRead(const wchar_t * instanceName, int idleTime);
|
||||
static double GetAverageDiskBytesPerWrite(const wchar_t * instanceName, int idleTime);
|
||||
static double GetIdleTimePercent(const wchar_t * instanceName, int idleTime);
|
||||
static double GetSplitIOPerSecond(const wchar_t * instanceName, int idleTime);
|
||||
};
|
|
@ -127,6 +127,27 @@ class MONITOR_API PhysicalDisk
|
|||
public:
|
||||
static list<wstring> GetInstances();
|
||||
static list<wstring> GetCounterList();
|
||||
static double GetCurrentDiskQueueLength(const wchar_t * instanceName);
|
||||
static double GetDiskTimePercent(const wchar_t * instanceName, int idleTime);
|
||||
static double GetAverageDiskQueueLength(const wchar_t * instanceName, int idleTime);
|
||||
static double GetDiskReadTimePercent(const wchar_t * instanceName, int idleTime);
|
||||
static double GetAverageDiskReadQueueLength(const wchar_t * instanceName, int idleTime);
|
||||
static double GetDiskWriteTimePercent(const wchar_t * instanceName, int idleTime);
|
||||
static double GetAverageDiskWriteQueueLength(const wchar_t * instanceName, int idleTime);
|
||||
static double GetAverageDiskTransferTimeInSecond(const wchar_t * instanceName, int idleTime);
|
||||
static double GetAverageDiskReadTimeInSecond(const wchar_t * instanceName, int idleTime);
|
||||
static double GetAverageDiskWriteTimeInSecond(const wchar_t * instanceName, int idleTime);
|
||||
static double GetDiskTransfersPerSecond(const wchar_t * instanceName, int idleTime);
|
||||
static double GetDiskReadsPerSecond(const wchar_t * instanceName, int idleTime);
|
||||
static double GetDiskWritesPerSecond(const wchar_t * instanceName, int idleTime);
|
||||
static double GetDiskBytesPerSecond(const wchar_t * instanceName, int idleTime);
|
||||
static double GetDiskReadBytesPerSecond(const wchar_t * instanceName, int idleTime);
|
||||
static double GetDiskWriteBytesPerSecond(const wchar_t * instanceName, int idleTime);
|
||||
static double GetAverageDiskBytesPerTransfer(const wchar_t * instanceName, int idleTime);
|
||||
static double GetAverageDiskBytesPerRead(const wchar_t * instanceName, int idleTime);
|
||||
static double GetAverageDiskBytesPerWrite(const wchar_t * instanceName, int idleTime);
|
||||
static double GetIdleTimePercent(const wchar_t * instanceName, int idleTime);
|
||||
static double GetSplitIOPerSecond(const wchar_t * instanceName, int idleTime);
|
||||
};
|
||||
|
||||
class MONITOR_API Process
|
||||
|
|
|
@ -127,6 +127,27 @@ class MONITOR_API PhysicalDisk
|
|||
public:
|
||||
static list<wstring> GetInstances();
|
||||
static list<wstring> GetCounterList();
|
||||
static double GetCurrentDiskQueueLength(const wchar_t * instanceName);
|
||||
static double GetDiskTimePercent(const wchar_t * instanceName, int idleTime);
|
||||
static double GetAverageDiskQueueLength(const wchar_t * instanceName, int idleTime);
|
||||
static double GetDiskReadTimePercent(const wchar_t * instanceName, int idleTime);
|
||||
static double GetAverageDiskReadQueueLength(const wchar_t * instanceName, int idleTime);
|
||||
static double GetDiskWriteTimePercent(const wchar_t * instanceName, int idleTime);
|
||||
static double GetAverageDiskWriteQueueLength(const wchar_t * instanceName, int idleTime);
|
||||
static double GetAverageDiskTransferTimeInSecond(const wchar_t * instanceName, int idleTime);
|
||||
static double GetAverageDiskReadTimeInSecond(const wchar_t * instanceName, int idleTime);
|
||||
static double GetAverageDiskWriteTimeInSecond(const wchar_t * instanceName, int idleTime);
|
||||
static double GetDiskTransfersPerSecond(const wchar_t * instanceName, int idleTime);
|
||||
static double GetDiskReadsPerSecond(const wchar_t * instanceName, int idleTime);
|
||||
static double GetDiskWritesPerSecond(const wchar_t * instanceName, int idleTime);
|
||||
static double GetDiskBytesPerSecond(const wchar_t * instanceName, int idleTime);
|
||||
static double GetDiskReadBytesPerSecond(const wchar_t * instanceName, int idleTime);
|
||||
static double GetDiskWriteBytesPerSecond(const wchar_t * instanceName, int idleTime);
|
||||
static double GetAverageDiskBytesPerTransfer(const wchar_t * instanceName, int idleTime);
|
||||
static double GetAverageDiskBytesPerRead(const wchar_t * instanceName, int idleTime);
|
||||
static double GetAverageDiskBytesPerWrite(const wchar_t * instanceName, int idleTime);
|
||||
static double GetIdleTimePercent(const wchar_t * instanceName, int idleTime);
|
||||
static double GetSplitIOPerSecond(const wchar_t * instanceName, int idleTime);
|
||||
};
|
||||
|
||||
class MONITOR_API Process
|
||||
|
|
|
@ -2,23 +2,21 @@
|
|||
|
||||
int _tmain(int argc, _TCHAR* argv[])
|
||||
{
|
||||
list<wstring> counterList=UDPv6::GetCounterList();
|
||||
list<wstring> instances=NetworkInterface::GetInstances();
|
||||
list<wstring> counterList=PhysicalDisk::GetCounterList();
|
||||
list<wstring> instances=PhysicalDisk::GetInstances();
|
||||
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;
|
||||
//}
|
||||
wstring name=L"Broadcom 802.11n ÍøÂçÊÊÅäÆ÷";
|
||||
for(iter=instances.begin();iter!=instances.end();iter++)
|
||||
{
|
||||
wcout<<(*iter).c_str()<<endl;
|
||||
}
|
||||
while(1)
|
||||
{
|
||||
printf("%lf\n",NetworkInterface::GetTcpRscAveragePacketSize(name.c_str()));
|
||||
Sleep(500);
|
||||
printf("%lf\n",PhysicalDisk::GetSplitIOPerSecond(L"_Total",1000));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue