jni stubs added.

This commit is contained in:
Zhen Tang 2013-07-07 19:02:56 +08:00
parent 17f142f3fd
commit acfa2ea624
64 changed files with 954 additions and 496 deletions

View File

@ -1,6 +1,53 @@
#include "stdafx.h" #include "stdafx.h"
#include "Common.h" #include "Common.h"
string Common::WideStringToString(const wstring & str)
{
int length = WideCharToMultiByte(CP_ACP, 0, str.c_str(), -1, NULL, 0, NULL, NULL);
if (length<= 0)
{
return string("");
}
char* dest = new char[length];
if (NULL == dest)
{
return string("");
}
WideCharToMultiByte(CP_ACP, 0, str.c_str(), -1, dest, length, NULL, NULL);
dest[length -1] = 0;
string ret(dest);
delete [] dest;
return ret;
}
wstring Common::StringToWideString(const string & str)
{
int count=(int)str.size();
int length = MultiByteToWideChar(CP_ACP, 0, str.c_str(), count, 0, 0);
if(length <= 0)
{
return NULL;
}
wchar_t * dest = new wchar_t[length+1];
if( NULL == dest)
{
return wstring(L"");
}
MultiByteToWideChar(CP_ACP, 0,str.c_str(), count, dest, length);
dest[length] = 0;
if( dest[0] == 0xFEFF)
{
int i=0;
for(i = 0; i < length; i ++)
{
dest[i] = dest[i+1];
}
}
wstring ret(dest);
delete [] dest;
return ret;
}
double Common::GetCounterValue(const wchar_t * fullCounterPath) double Common::GetCounterValue(const wchar_t * fullCounterPath)
{ {
HQUERY hquery; HQUERY hquery;

View File

@ -1,9 +1,13 @@
#pragma once #pragma once
#include "Monitor.h" #include "Monitor.h"
#include <string>
using namespace std;
class MONITOR_API Common class MONITOR_API Common
{ {
public: public:
static string WideStringToString(const wstring & str);
static wstring StringToWideString(const string & str);
static double GetCounterValue(const wchar_t * fullCounterPath); static double GetCounterValue(const wchar_t * fullCounterPath);
static double GetCounterValueWithIdle(const wchar_t * fullCounterPath,int idleTime); static double GetCounterValueWithIdle(const wchar_t * fullCounterPath,int idleTime);
static list<wstring> GetInstanceName(const wchar_t * objectName); static list<wstring> GetInstanceName(const wchar_t * objectName);

View File

@ -14,7 +14,7 @@ list<wstring> LogicalDisk::GetCounterList()
} }
// % Free Space // % Free Space
double LogicalDisk::GetFreeSpacePercent(wchar_t * instanceName) double LogicalDisk::GetFreeSpacePercent(const wchar_t * instanceName)
{ {
wstring fullCounterPath(L""); wstring fullCounterPath(L"");
fullCounterPath+=L"\\LogicalDisk("; fullCounterPath+=L"\\LogicalDisk(";
@ -25,7 +25,7 @@ double LogicalDisk::GetFreeSpacePercent(wchar_t * instanceName)
} }
// Free Megabytes // Free Megabytes
double LogicalDisk::GetFreeMegabytes(wchar_t * instanceName) double LogicalDisk::GetFreeMegabytes(const wchar_t * instanceName)
{ {
wstring fullCounterPath(L""); wstring fullCounterPath(L"");
fullCounterPath+=L"\\LogicalDisk("; fullCounterPath+=L"\\LogicalDisk(";
@ -36,7 +36,7 @@ double LogicalDisk::GetFreeMegabytes(wchar_t * instanceName)
} }
// Current Disk Queue Length // Current Disk Queue Length
double LogicalDisk::GetCurrentDiskQueueLength(wchar_t * instanceName) double LogicalDisk::GetCurrentDiskQueueLength(const wchar_t * instanceName)
{ {
wstring fullCounterPath(L""); wstring fullCounterPath(L"");
fullCounterPath+=L"\\LogicalDisk("; fullCounterPath+=L"\\LogicalDisk(";
@ -47,7 +47,7 @@ double LogicalDisk::GetCurrentDiskQueueLength(wchar_t * instanceName)
} }
// % Disk Time // % Disk Time
double LogicalDisk::GetDiskTimePercent(wchar_t * instanceName, int idleTime) double LogicalDisk::GetDiskTimePercent(const wchar_t * instanceName, int idleTime)
{ {
wstring fullCounterPath(L""); wstring fullCounterPath(L"");
fullCounterPath+=L"\\LogicalDisk("; fullCounterPath+=L"\\LogicalDisk(";
@ -58,7 +58,7 @@ double LogicalDisk::GetDiskTimePercent(wchar_t * instanceName, int idleTime)
} }
// Avg. Disk Queue Length // Avg. Disk Queue Length
double LogicalDisk::GetAverageDiskQueueLength(wchar_t * instanceName, int idleTime) double LogicalDisk::GetAverageDiskQueueLength(const wchar_t * instanceName, int idleTime)
{ {
wstring fullCounterPath(L""); wstring fullCounterPath(L"");
fullCounterPath+=L"\\LogicalDisk("; fullCounterPath+=L"\\LogicalDisk(";
@ -69,7 +69,7 @@ double LogicalDisk::GetAverageDiskQueueLength(wchar_t * instanceName, int idleTi
} }
// % Disk Read Time // % Disk Read Time
double LogicalDisk::GetDiskReadTimePercent(wchar_t * instanceName, int idleTime) double LogicalDisk::GetDiskReadTimePercent(const wchar_t * instanceName, int idleTime)
{ {
wstring fullCounterPath(L""); wstring fullCounterPath(L"");
fullCounterPath+=L"\\LogicalDisk("; fullCounterPath+=L"\\LogicalDisk(";
@ -80,7 +80,7 @@ double LogicalDisk::GetDiskReadTimePercent(wchar_t * instanceName, int idleTime)
} }
// Avg. Disk Read Queue Length // Avg. Disk Read Queue Length
double LogicalDisk::GetAverageDiskReadQueueLength(wchar_t * instanceName, int idleTime) double LogicalDisk::GetAverageDiskReadQueueLength(const wchar_t * instanceName, int idleTime)
{ {
wstring fullCounterPath(L""); wstring fullCounterPath(L"");
fullCounterPath+=L"\\LogicalDisk("; fullCounterPath+=L"\\LogicalDisk(";
@ -91,7 +91,7 @@ double LogicalDisk::GetAverageDiskReadQueueLength(wchar_t * instanceName, int id
} }
// % Disk Write Time // % Disk Write Time
double LogicalDisk::GetDiskWriteTimePercent(wchar_t * instanceName, int idleTime) double LogicalDisk::GetDiskWriteTimePercent(const wchar_t * instanceName, int idleTime)
{ {
wstring fullCounterPath(L""); wstring fullCounterPath(L"");
fullCounterPath+=L"\\LogicalDisk("; fullCounterPath+=L"\\LogicalDisk(";
@ -102,7 +102,7 @@ double LogicalDisk::GetDiskWriteTimePercent(wchar_t * instanceName, int idleTime
} }
// Avg. Disk Write Queue Length // Avg. Disk Write Queue Length
double LogicalDisk::GetAverageDiskWriteQueueLength(wchar_t * instanceName, int idleTime) double LogicalDisk::GetAverageDiskWriteQueueLength(const wchar_t * instanceName, int idleTime)
{ {
wstring fullCounterPath(L""); wstring fullCounterPath(L"");
fullCounterPath+=L"\\LogicalDisk("; fullCounterPath+=L"\\LogicalDisk(";
@ -113,7 +113,7 @@ double LogicalDisk::GetAverageDiskWriteQueueLength(wchar_t * instanceName, int i
} }
// Avg. Disk sec/Transfer // Avg. Disk sec/Transfer
double LogicalDisk::GetAverageDiskTransferTimeInSecond(wchar_t * instanceName, int idleTime) double LogicalDisk::GetAverageDiskTransferTimeInSecond(const wchar_t * instanceName, int idleTime)
{ {
wstring fullCounterPath(L""); wstring fullCounterPath(L"");
fullCounterPath+=L"\\LogicalDisk("; fullCounterPath+=L"\\LogicalDisk(";
@ -124,7 +124,7 @@ double LogicalDisk::GetAverageDiskTransferTimeInSecond(wchar_t * instanceName, i
} }
// Avg. Disk sec/Read // Avg. Disk sec/Read
double LogicalDisk::GetAverageDiskReadTimeInSecond(wchar_t * instanceName, int idleTime) double LogicalDisk::GetAverageDiskReadTimeInSecond(const wchar_t * instanceName, int idleTime)
{ {
wstring fullCounterPath(L""); wstring fullCounterPath(L"");
fullCounterPath+=L"\\LogicalDisk("; fullCounterPath+=L"\\LogicalDisk(";
@ -135,7 +135,7 @@ double LogicalDisk::GetAverageDiskReadTimeInSecond(wchar_t * instanceName, int i
} }
// Avg. Disk sec/Write // Avg. Disk sec/Write
double LogicalDisk::GetAverageDiskWriteTimeInSecond(wchar_t * instanceName, int idleTime) double LogicalDisk::GetAverageDiskWriteTimeInSecond(const wchar_t * instanceName, int idleTime)
{ {
wstring fullCounterPath(L""); wstring fullCounterPath(L"");
fullCounterPath+=L"\\LogicalDisk("; fullCounterPath+=L"\\LogicalDisk(";
@ -146,7 +146,7 @@ double LogicalDisk::GetAverageDiskWriteTimeInSecond(wchar_t * instanceName, int
} }
// Disk Transfers/sec // Disk Transfers/sec
double LogicalDisk::GetDiskTransfersPerSecond(wchar_t * instanceName, int idleTime) double LogicalDisk::GetDiskTransfersPerSecond(const wchar_t * instanceName, int idleTime)
{ {
wstring fullCounterPath(L""); wstring fullCounterPath(L"");
fullCounterPath+=L"\\LogicalDisk("; fullCounterPath+=L"\\LogicalDisk(";
@ -157,7 +157,7 @@ double LogicalDisk::GetDiskTransfersPerSecond(wchar_t * instanceName, int idleTi
} }
// Disk Reads/sec // Disk Reads/sec
double LogicalDisk::GetDiskReadsPerSecond(wchar_t * instanceName, int idleTime) double LogicalDisk::GetDiskReadsPerSecond(const wchar_t * instanceName, int idleTime)
{ {
wstring fullCounterPath(L""); wstring fullCounterPath(L"");
fullCounterPath+=L"\\LogicalDisk("; fullCounterPath+=L"\\LogicalDisk(";
@ -168,7 +168,7 @@ double LogicalDisk::GetDiskReadsPerSecond(wchar_t * instanceName, int idleTime)
} }
// Disk Writes/sec // Disk Writes/sec
double LogicalDisk::GetDiskWritesPerSecond(wchar_t * instanceName, int idleTime) double LogicalDisk::GetDiskWritesPerSecond(const wchar_t * instanceName, int idleTime)
{ {
wstring fullCounterPath(L""); wstring fullCounterPath(L"");
fullCounterPath+=L"\\LogicalDisk("; fullCounterPath+=L"\\LogicalDisk(";
@ -179,7 +179,7 @@ double LogicalDisk::GetDiskWritesPerSecond(wchar_t * instanceName, int idleTime)
} }
// Disk Bytes/sec // Disk Bytes/sec
double LogicalDisk::GetDiskBytesPerSecond(wchar_t * instanceName, int idleTime) double LogicalDisk::GetDiskBytesPerSecond(const wchar_t * instanceName, int idleTime)
{ {
wstring fullCounterPath(L""); wstring fullCounterPath(L"");
fullCounterPath+=L"\\LogicalDisk("; fullCounterPath+=L"\\LogicalDisk(";
@ -190,7 +190,7 @@ double LogicalDisk::GetDiskBytesPerSecond(wchar_t * instanceName, int idleTime)
} }
// Disk Read Bytes/sec // Disk Read Bytes/sec
double LogicalDisk::GetDiskReadBytesPerSecond(wchar_t * instanceName, int idleTime) double LogicalDisk::GetDiskReadBytesPerSecond(const wchar_t * instanceName, int idleTime)
{ {
wstring fullCounterPath(L""); wstring fullCounterPath(L"");
fullCounterPath+=L"\\LogicalDisk("; fullCounterPath+=L"\\LogicalDisk(";
@ -201,7 +201,7 @@ double LogicalDisk::GetDiskReadBytesPerSecond(wchar_t * instanceName, int idleTi
} }
// Disk Write Bytes/sec // Disk Write Bytes/sec
double LogicalDisk::GetDiskWriteBytesPerSecond(wchar_t * instanceName, int idleTime) double LogicalDisk::GetDiskWriteBytesPerSecond(const wchar_t * instanceName, int idleTime)
{ {
wstring fullCounterPath(L""); wstring fullCounterPath(L"");
fullCounterPath+=L"\\LogicalDisk("; fullCounterPath+=L"\\LogicalDisk(";
@ -212,7 +212,7 @@ double LogicalDisk::GetDiskWriteBytesPerSecond(wchar_t * instanceName, int idleT
} }
// Avg. Disk Bytes/Transfer // Avg. Disk Bytes/Transfer
double LogicalDisk::GetAverageDiskBytesPerTransfer(wchar_t * instanceName, int idleTime) double LogicalDisk::GetAverageDiskBytesPerTransfer(const wchar_t * instanceName, int idleTime)
{ {
wstring fullCounterPath(L""); wstring fullCounterPath(L"");
fullCounterPath+=L"\\LogicalDisk("; fullCounterPath+=L"\\LogicalDisk(";
@ -223,7 +223,7 @@ double LogicalDisk::GetAverageDiskBytesPerTransfer(wchar_t * instanceName, int i
} }
// Avg. Disk Bytes/Read // Avg. Disk Bytes/Read
double LogicalDisk::GetAverageDiskBytesPerRead(wchar_t * instanceName, int idleTime) double LogicalDisk::GetAverageDiskBytesPerRead(const wchar_t * instanceName, int idleTime)
{ {
wstring fullCounterPath(L""); wstring fullCounterPath(L"");
fullCounterPath+=L"\\LogicalDisk("; fullCounterPath+=L"\\LogicalDisk(";
@ -234,7 +234,7 @@ double LogicalDisk::GetAverageDiskBytesPerRead(wchar_t * instanceName, int idleT
} }
// Avg. Disk Bytes/Write // Avg. Disk Bytes/Write
double LogicalDisk::GetAverageDiskBytesPerWrite(wchar_t * instanceName, int idleTime) double LogicalDisk::GetAverageDiskBytesPerWrite(const wchar_t * instanceName, int idleTime)
{ {
wstring fullCounterPath(L""); wstring fullCounterPath(L"");
fullCounterPath+=L"\\LogicalDisk("; fullCounterPath+=L"\\LogicalDisk(";
@ -245,7 +245,7 @@ double LogicalDisk::GetAverageDiskBytesPerWrite(wchar_t * instanceName, int idle
} }
// % Idle Time // % Idle Time
double LogicalDisk::GetIdleTimePercent(wchar_t * instanceName, int idleTime) double LogicalDisk::GetIdleTimePercent(const wchar_t * instanceName, int idleTime)
{ {
wstring fullCounterPath(L""); wstring fullCounterPath(L"");
fullCounterPath+=L"\\LogicalDisk("; fullCounterPath+=L"\\LogicalDisk(";
@ -256,7 +256,7 @@ double LogicalDisk::GetIdleTimePercent(wchar_t * instanceName, int idleTime)
} }
// Split IO/Sec // Split IO/Sec
double LogicalDisk::GetSplitIOPerSecond(wchar_t * instanceName, int idleTime) double LogicalDisk::GetSplitIOPerSecond(const wchar_t * instanceName, int idleTime)
{ {
wstring fullCounterPath(L""); wstring fullCounterPath(L"");
fullCounterPath+=L"\\LogicalDisk("; fullCounterPath+=L"\\LogicalDisk(";

View File

@ -9,27 +9,27 @@ class MONITOR_API LogicalDisk
public: public:
static list<wstring> GetInstances(); static list<wstring> GetInstances();
static list<wstring> GetCounterList(); static list<wstring> GetCounterList();
static double GetFreeSpacePercent(wchar_t * instanceName); static double GetFreeSpacePercent(const wchar_t * instanceName);
static double GetFreeMegabytes(wchar_t * instanceName); static double GetFreeMegabytes(const wchar_t * instanceName);
static double GetCurrentDiskQueueLength(wchar_t * instanceName); static double GetCurrentDiskQueueLength(const wchar_t * instanceName);
static double GetDiskTimePercent(wchar_t * instanceName, int idleTime); static double GetDiskTimePercent(const wchar_t * instanceName, int idleTime);
static double GetAverageDiskQueueLength(wchar_t * instanceName, int idleTime); static double GetAverageDiskQueueLength(const wchar_t * instanceName, int idleTime);
static double GetDiskReadTimePercent(wchar_t * instanceName, int idleTime); static double GetDiskReadTimePercent(const wchar_t * instanceName, int idleTime);
static double GetAverageDiskReadQueueLength(wchar_t * instanceName, int idleTime); static double GetAverageDiskReadQueueLength(const wchar_t * instanceName, int idleTime);
static double GetDiskWriteTimePercent(wchar_t * instanceName, int idleTime); static double GetDiskWriteTimePercent(const wchar_t * instanceName, int idleTime);
static double GetAverageDiskWriteQueueLength(wchar_t * instanceName, int idleTime); static double GetAverageDiskWriteQueueLength(const wchar_t * instanceName, int idleTime);
static double GetAverageDiskTransferTimeInSecond(wchar_t * instanceName, int idleTime); static double GetAverageDiskTransferTimeInSecond(const wchar_t * instanceName, int idleTime);
static double GetAverageDiskReadTimeInSecond(wchar_t * instanceName, int idleTime); static double GetAverageDiskReadTimeInSecond(const wchar_t * instanceName, int idleTime);
static double GetAverageDiskWriteTimeInSecond(wchar_t * instanceName, int idleTime); static double GetAverageDiskWriteTimeInSecond(const wchar_t * instanceName, int idleTime);
static double GetDiskTransfersPerSecond(wchar_t * instanceName, int idleTime); static double GetDiskTransfersPerSecond(const wchar_t * instanceName, int idleTime);
static double GetDiskReadsPerSecond(wchar_t * instanceName, int idleTime); static double GetDiskReadsPerSecond(const wchar_t * instanceName, int idleTime);
static double GetDiskWritesPerSecond(wchar_t * instanceName, int idleTime); static double GetDiskWritesPerSecond(const wchar_t * instanceName, int idleTime);
static double GetDiskBytesPerSecond(wchar_t * instanceName, int idleTime); static double GetDiskBytesPerSecond(const wchar_t * instanceName, int idleTime);
static double GetDiskReadBytesPerSecond(wchar_t * instanceName, int idleTime); static double GetDiskReadBytesPerSecond(const wchar_t * instanceName, int idleTime);
static double GetDiskWriteBytesPerSecond(wchar_t * instanceName, int idleTime); static double GetDiskWriteBytesPerSecond(const wchar_t * instanceName, int idleTime);
static double GetAverageDiskBytesPerTransfer(wchar_t * instanceName, int idleTime); static double GetAverageDiskBytesPerTransfer(const wchar_t * instanceName, int idleTime);
static double GetAverageDiskBytesPerRead(wchar_t * instanceName, int idleTime); static double GetAverageDiskBytesPerRead(const wchar_t * instanceName, int idleTime);
static double GetAverageDiskBytesPerWrite(wchar_t * instanceName, int idleTime); static double GetAverageDiskBytesPerWrite(const wchar_t * instanceName, int idleTime);
static double GetIdleTimePercent(wchar_t * instanceName, int idleTime); static double GetIdleTimePercent(const wchar_t * instanceName, int idleTime);
static double GetSplitIOPerSecond(wchar_t * instanceName, int idleTime); static double GetSplitIOPerSecond(const wchar_t * instanceName, int idleTime);
}; };

View File

@ -13,6 +13,8 @@ using namespace std;
class MONITOR_API Common class MONITOR_API Common
{ {
public: public:
static string WideStringToString(const wstring & str);
static wstring StringToWideString(const string & str);
static double GetCounterValue(const wchar_t * fullCounterPath); static double GetCounterValue(const wchar_t * fullCounterPath);
static double GetCounterValueWithIdle(const wchar_t * fullCounterPath,int idleTime); static double GetCounterValueWithIdle(const wchar_t * fullCounterPath,int idleTime);
static list<wstring> GetInstanceName(const wchar_t * objectName); static list<wstring> GetInstanceName(const wchar_t * objectName);
@ -24,29 +26,29 @@ class MONITOR_API LogicalDisk
public: public:
static list<wstring> GetInstances(); static list<wstring> GetInstances();
static list<wstring> GetCounterList(); static list<wstring> GetCounterList();
static double GetFreeSpacePercent(wchar_t * instanceName); static double GetFreeSpacePercent(const wchar_t * instanceName);
static double GetFreeMegabytes(wchar_t * instanceName); static double GetFreeMegabytes(const wchar_t * instanceName);
static double GetCurrentDiskQueueLength(wchar_t * instanceName); static double GetCurrentDiskQueueLength(const wchar_t * instanceName);
static double GetDiskTimePercent(wchar_t * instanceName, int idleTime); static double GetDiskTimePercent(const wchar_t * instanceName, int idleTime);
static double GetAverageDiskQueueLength(wchar_t * instanceName, int idleTime); static double GetAverageDiskQueueLength(const wchar_t * instanceName, int idleTime);
static double GetDiskReadTimePercent(wchar_t * instanceName, int idleTime); static double GetDiskReadTimePercent(const wchar_t * instanceName, int idleTime);
static double GetAverageDiskReadQueueLength(wchar_t * instanceName, int idleTime); static double GetAverageDiskReadQueueLength(const wchar_t * instanceName, int idleTime);
static double GetDiskWriteTimePercent(wchar_t * instanceName, int idleTime); static double GetDiskWriteTimePercent(const wchar_t * instanceName, int idleTime);
static double GetAverageDiskWriteQueueLength(wchar_t * instanceName, int idleTime); static double GetAverageDiskWriteQueueLength(const wchar_t * instanceName, int idleTime);
static double GetAverageDiskTransferTimeInSecond(wchar_t * instanceName, int idleTime); static double GetAverageDiskTransferTimeInSecond(const wchar_t * instanceName, int idleTime);
static double GetAverageDiskReadTimeInSecond(wchar_t * instanceName, int idleTime); static double GetAverageDiskReadTimeInSecond(const wchar_t * instanceName, int idleTime);
static double GetAverageDiskWriteTimeInSecond(wchar_t * instanceName, int idleTime); static double GetAverageDiskWriteTimeInSecond(const wchar_t * instanceName, int idleTime);
static double GetDiskTransfersPerSecond(wchar_t * instanceName, int idleTime); static double GetDiskTransfersPerSecond(const wchar_t * instanceName, int idleTime);
static double GetDiskReadsPerSecond(wchar_t * instanceName, int idleTime); static double GetDiskReadsPerSecond(const wchar_t * instanceName, int idleTime);
static double GetDiskWritesPerSecond(wchar_t * instanceName, int idleTime); static double GetDiskWritesPerSecond(const wchar_t * instanceName, int idleTime);
static double GetDiskBytesPerSecond(wchar_t * instanceName, int idleTime); static double GetDiskBytesPerSecond(const wchar_t * instanceName, int idleTime);
static double GetDiskReadBytesPerSecond(wchar_t * instanceName, int idleTime); static double GetDiskReadBytesPerSecond(const wchar_t * instanceName, int idleTime);
static double GetDiskWriteBytesPerSecond(wchar_t * instanceName, int idleTime); static double GetDiskWriteBytesPerSecond(const wchar_t * instanceName, int idleTime);
static double GetAverageDiskBytesPerTransfer(wchar_t * instanceName, int idleTime); static double GetAverageDiskBytesPerTransfer(const wchar_t * instanceName, int idleTime);
static double GetAverageDiskBytesPerRead(wchar_t * instanceName, int idleTime); static double GetAverageDiskBytesPerRead(const wchar_t * instanceName, int idleTime);
static double GetAverageDiskBytesPerWrite(wchar_t * instanceName, int idleTime); static double GetAverageDiskBytesPerWrite(const wchar_t * instanceName, int idleTime);
static double GetIdleTimePercent(wchar_t * instanceName, int idleTime); static double GetIdleTimePercent(const wchar_t * instanceName, int idleTime);
static double GetSplitIOPerSecond(wchar_t * instanceName, int idleTime); static double GetSplitIOPerSecond(const wchar_t * instanceName, int idleTime);
}; };
class MONITOR_API Memory class MONITOR_API Memory
@ -110,7 +112,7 @@ class MONITOR_API Process
public: public:
static list<wstring> GetInstances(); static list<wstring> GetInstances();
static list<wstring> GetCounterList(); static list<wstring> GetCounterList();
static double Process::GetProcessId(wchar_t * instanceName); static double Process::GetProcessId(const wchar_t * instanceName);
}; };
class MONITOR_API Processor class MONITOR_API Processor
@ -118,21 +120,21 @@ class MONITOR_API Processor
public: public:
static list<wstring> GetInstances(); static list<wstring> GetInstances();
static list<wstring> GetCounterList(); static list<wstring> GetCounterList();
static double GetProcessorTimePercent(wchar_t * instanceName, int idleTime); static double GetProcessorTimePercent(const wchar_t * instanceName, int idleTime);
static double GetUserTimePercent(wchar_t * instanceName, int idleTime); static double GetUserTimePercent(const wchar_t * instanceName, int idleTime);
static double GetPrivilegedTimePercent(wchar_t * instanceName, int idleTime); static double GetPrivilegedTimePercent(const wchar_t * instanceName, int idleTime);
static double GetInterruptsPerSecond(wchar_t * instanceName, int idleTime); static double GetInterruptsPerSecond(const wchar_t * instanceName, int idleTime);
static double GetDpcTimePercent(wchar_t * instanceName, int idleTime); static double GetDpcTimePercent(const wchar_t * instanceName, int idleTime);
static double GetInterruptTimePercent(wchar_t * instanceName, int idleTime); static double GetInterruptTimePercent(const wchar_t * instanceName, int idleTime);
static double GetDpcsQueuedPerSecond(wchar_t * instanceName, int idleTime); static double GetDpcsQueuedPerSecond(const wchar_t * instanceName, int idleTime);
static double GetDpcRate(wchar_t * instanceName); static double GetDpcRate(const wchar_t * instanceName);
static double GetIdleTimePercent(wchar_t * instanceName, int idleTime); static double GetIdleTimePercent(const wchar_t * instanceName, int idleTime);
static double GetC1TimePercent(wchar_t * instanceName, int idleTime); static double GetC1TimePercent(const wchar_t * instanceName, int idleTime);
static double GetC2TimePercent(wchar_t * instanceName, int idleTime); static double GetC2TimePercent(const wchar_t * instanceName, int idleTime);
static double GetC3TimePercent(wchar_t * instanceName, int idleTime); static double GetC3TimePercent(const wchar_t * instanceName, int idleTime);
static double GetC1TransitionsPerSecond(wchar_t * instanceName, int idleTime); static double GetC1TransitionsPerSecond(const wchar_t * instanceName, int idleTime);
static double GetC2TransitionsPerSecond(wchar_t * instanceName, int idleTime); static double GetC2TransitionsPerSecond(const wchar_t * instanceName, int idleTime);
static double GetC3TransitionsPerSecond(wchar_t * instanceName, int idleTime); static double GetC3TransitionsPerSecond(const wchar_t * instanceName, int idleTime);
}; };
class MONITOR_API ProcessorInformation class MONITOR_API ProcessorInformation
@ -140,34 +142,34 @@ class MONITOR_API ProcessorInformation
public: public:
static list<wstring> GetInstances(); static list<wstring> GetInstances();
static list<wstring> GetCounterList(); static list<wstring> GetCounterList();
static double GetPerformanceLimitFlags(wchar_t * instanceName); static double GetPerformanceLimitFlags(const wchar_t * instanceName);
static double GetPerformanceLimitPercent(wchar_t * instanceName); static double GetPerformanceLimitPercent(const wchar_t * instanceName);
static double GetPrivilegedUtilityPercent(wchar_t * instanceName, int idleTime); static double GetPrivilegedUtilityPercent(const wchar_t * instanceName, int idleTime);
static double GetProcessorUtilityPercent(wchar_t * instanceName, int idleTime); static double GetProcessorUtilityPercent(const wchar_t * instanceName, int idleTime);
static double GetProcessorPerformancePercent(wchar_t * instanceName, int idleTime); static double GetProcessorPerformancePercent(const wchar_t * instanceName, int idleTime);
static double GetIdleBreakEventsPerSecond(wchar_t * instanceName, int idleTime); static double GetIdleBreakEventsPerSecond(const wchar_t * instanceName, int idleTime);
static double GetAverageIdleTime(wchar_t * instanceName, int idleTime); static double GetAverageIdleTime(const wchar_t * instanceName, int idleTime);
static double GetClockInterruptsPerSecond(wchar_t * instanceName, int idleTime); static double GetClockInterruptsPerSecond(const wchar_t * instanceName, int idleTime);
static double GetProcessorStateFlags(wchar_t * instanceName); static double GetProcessorStateFlags(const wchar_t * instanceName);
static double GetPercentageOfMaximumFrequency(wchar_t * instanceName); static double GetPercentageOfMaximumFrequency(const wchar_t * instanceName);
static double GetProcessorFrequency(wchar_t * instanceName); static double GetProcessorFrequency(const wchar_t * instanceName);
static double GetParkingStatus(wchar_t * instanceName); static double GetParkingStatus(const wchar_t * instanceName);
static double GetPriorityTimePercent(wchar_t * instanceName, int idleTime); static double GetPriorityTimePercent(const wchar_t * instanceName, int idleTime);
static double GetC3TransitionsPerSecond(wchar_t * instanceName, int idleTime); static double GetC3TransitionsPerSecond(const wchar_t * instanceName, int idleTime);
static double GetC2TransitionsPerSecond(wchar_t * instanceName, int idleTime); static double GetC2TransitionsPerSecond(const wchar_t * instanceName, int idleTime);
static double GetC1TransitionsPerSecond(wchar_t * instanceName, int idleTime); static double GetC1TransitionsPerSecond(const wchar_t * instanceName, int idleTime);
static double GetC3TimePercent(wchar_t * instanceName, int idleTime); static double GetC3TimePercent(const wchar_t * instanceName, int idleTime);
static double GetC2TimePercent(wchar_t * instanceName, int idleTime); static double GetC2TimePercent(const wchar_t * instanceName, int idleTime);
static double GetC1TimePercent(wchar_t * instanceName, int idleTime); static double GetC1TimePercent(const wchar_t * instanceName, int idleTime);
static double GetIdleTimePercent(wchar_t * instanceName, int idleTime); static double GetIdleTimePercent(const wchar_t * instanceName, int idleTime);
static double GetDpcRate(wchar_t * instanceName); static double GetDpcRate(const wchar_t * instanceName);
static double GetDpcsQueuedPerSecond(wchar_t * instanceName, int idleTime); static double GetDpcsQueuedPerSecond(const wchar_t * instanceName, int idleTime);
static double GetInterruptTimePercent(wchar_t * instanceName, int idleTime); static double GetInterruptTimePercent(const wchar_t * instanceName, int idleTime);
static double GetDpcTimePercent(wchar_t * instanceName, int idleTime); static double GetDpcTimePercent(const wchar_t * instanceName, int idleTime);
static double GetInterruptsPerSecond(wchar_t * instanceName, int idleTime); static double GetInterruptsPerSecond(const wchar_t * instanceName, int idleTime);
static double GetPrivilegedTimePercent(wchar_t * instanceName, int idleTime); static double GetPrivilegedTimePercent(const wchar_t * instanceName, int idleTime);
static double GetUserTimePercent(wchar_t * instanceName, int idleTime); static double GetUserTimePercent(const wchar_t * instanceName, int idleTime);
static double GetProcessorTimePercent(wchar_t * instanceName, int idleTime); static double GetProcessorTimePercent(const wchar_t * instanceName, int idleTime);
}; };
class MONITOR_API System class MONITOR_API System

View File

@ -28,7 +28,7 @@ list<wstring> Process::GetCounterList()
// Priority Base // Priority Base
// Elapsed Time // Elapsed Time
// ID Process // ID Process
double Process::GetProcessId(wchar_t * instanceName) double Process::GetProcessId(const wchar_t * instanceName)
{ {
wstring fullCounterPath(L""); wstring fullCounterPath(L"");
fullCounterPath+=L"\\Process("; fullCounterPath+=L"\\Process(";

View File

@ -9,5 +9,5 @@ class MONITOR_API Process
public: public:
static list<wstring> GetInstances(); static list<wstring> GetInstances();
static list<wstring> GetCounterList(); static list<wstring> GetCounterList();
static double Process::GetProcessId(wchar_t * instanceName); static double Process::GetProcessId(const wchar_t * instanceName);
}; };

View File

@ -14,7 +14,7 @@ list<wstring> Processor::GetCounterList()
} }
// % Processor Time // % Processor Time
double Processor::GetProcessorTimePercent(wchar_t * instanceName, int idleTime) double Processor::GetProcessorTimePercent(const wchar_t * instanceName, int idleTime)
{ {
wstring fullCounterPath(L""); wstring fullCounterPath(L"");
fullCounterPath+=L"\\Processor("; fullCounterPath+=L"\\Processor(";
@ -25,7 +25,7 @@ double Processor::GetProcessorTimePercent(wchar_t * instanceName, int idleTime)
} }
// % User Time // % User Time
double Processor::GetUserTimePercent(wchar_t * instanceName, int idleTime) double Processor::GetUserTimePercent(const wchar_t * instanceName, int idleTime)
{ {
wstring fullCounterPath(L""); wstring fullCounterPath(L"");
fullCounterPath+=L"\\Processor("; fullCounterPath+=L"\\Processor(";
@ -36,7 +36,7 @@ double Processor::GetUserTimePercent(wchar_t * instanceName, int idleTime)
} }
// % Privileged Time // % Privileged Time
double Processor::GetPrivilegedTimePercent(wchar_t * instanceName, int idleTime) double Processor::GetPrivilegedTimePercent(const wchar_t * instanceName, int idleTime)
{ {
wstring fullCounterPath(L""); wstring fullCounterPath(L"");
fullCounterPath+=L"\\Processor("; fullCounterPath+=L"\\Processor(";
@ -47,7 +47,7 @@ double Processor::GetPrivilegedTimePercent(wchar_t * instanceName, int idleTime)
} }
// Interrupts/sec // Interrupts/sec
double Processor::GetInterruptsPerSecond(wchar_t * instanceName, int idleTime) double Processor::GetInterruptsPerSecond(const wchar_t * instanceName, int idleTime)
{ {
wstring fullCounterPath(L""); wstring fullCounterPath(L"");
fullCounterPath+=L"\\Processor("; fullCounterPath+=L"\\Processor(";
@ -58,7 +58,7 @@ double Processor::GetInterruptsPerSecond(wchar_t * instanceName, int idleTime)
} }
// % DPC Time // % DPC Time
double Processor::GetDpcTimePercent(wchar_t * instanceName, int idleTime) double Processor::GetDpcTimePercent(const wchar_t * instanceName, int idleTime)
{ {
wstring fullCounterPath(L""); wstring fullCounterPath(L"");
fullCounterPath+=L"\\Processor("; fullCounterPath+=L"\\Processor(";
@ -69,7 +69,7 @@ double Processor::GetDpcTimePercent(wchar_t * instanceName, int idleTime)
} }
// % Interrupt Time // % Interrupt Time
double Processor::GetInterruptTimePercent(wchar_t * instanceName, int idleTime) double Processor::GetInterruptTimePercent(const wchar_t * instanceName, int idleTime)
{ {
wstring fullCounterPath(L""); wstring fullCounterPath(L"");
fullCounterPath+=L"\\Processor("; fullCounterPath+=L"\\Processor(";
@ -80,7 +80,7 @@ double Processor::GetInterruptTimePercent(wchar_t * instanceName, int idleTime)
} }
// DPCs Queued/sec // DPCs Queued/sec
double Processor::GetDpcsQueuedPerSecond(wchar_t * instanceName, int idleTime) double Processor::GetDpcsQueuedPerSecond(const wchar_t * instanceName, int idleTime)
{ {
wstring fullCounterPath(L""); wstring fullCounterPath(L"");
fullCounterPath+=L"\\Processor("; fullCounterPath+=L"\\Processor(";
@ -91,7 +91,7 @@ double Processor::GetDpcsQueuedPerSecond(wchar_t * instanceName, int idleTime)
} }
// DPC Rate // DPC Rate
double Processor::GetDpcRate(wchar_t * instanceName) double Processor::GetDpcRate(const wchar_t * instanceName)
{ {
wstring fullCounterPath(L""); wstring fullCounterPath(L"");
fullCounterPath+=L"\\Processor("; fullCounterPath+=L"\\Processor(";
@ -102,7 +102,7 @@ double Processor::GetDpcRate(wchar_t * instanceName)
} }
// % Idle Time // % Idle Time
double Processor::GetIdleTimePercent(wchar_t * instanceName, int idleTime) double Processor::GetIdleTimePercent(const wchar_t * instanceName, int idleTime)
{ {
wstring fullCounterPath(L""); wstring fullCounterPath(L"");
fullCounterPath+=L"\\Processor("; fullCounterPath+=L"\\Processor(";
@ -113,7 +113,7 @@ double Processor::GetIdleTimePercent(wchar_t * instanceName, int idleTime)
} }
// % C1 Time // % C1 Time
double Processor::GetC1TimePercent(wchar_t * instanceName, int idleTime) double Processor::GetC1TimePercent(const wchar_t * instanceName, int idleTime)
{ {
wstring fullCounterPath(L""); wstring fullCounterPath(L"");
fullCounterPath+=L"\\Processor("; fullCounterPath+=L"\\Processor(";
@ -124,7 +124,7 @@ double Processor::GetC1TimePercent(wchar_t * instanceName, int idleTime)
} }
// % C2 Time // % C2 Time
double Processor::GetC2TimePercent(wchar_t * instanceName, int idleTime) double Processor::GetC2TimePercent(const wchar_t * instanceName, int idleTime)
{ {
wstring fullCounterPath(L""); wstring fullCounterPath(L"");
fullCounterPath+=L"\\Processor("; fullCounterPath+=L"\\Processor(";
@ -135,7 +135,7 @@ double Processor::GetC2TimePercent(wchar_t * instanceName, int idleTime)
} }
// % C3 Time // % C3 Time
double Processor::GetC3TimePercent(wchar_t * instanceName, int idleTime) double Processor::GetC3TimePercent(const wchar_t * instanceName, int idleTime)
{ {
wstring fullCounterPath(L""); wstring fullCounterPath(L"");
fullCounterPath+=L"\\Processor("; fullCounterPath+=L"\\Processor(";
@ -146,7 +146,7 @@ double Processor::GetC3TimePercent(wchar_t * instanceName, int idleTime)
} }
// C1 Transitions/sec // C1 Transitions/sec
double Processor::GetC1TransitionsPerSecond(wchar_t * instanceName, int idleTime) double Processor::GetC1TransitionsPerSecond(const wchar_t * instanceName, int idleTime)
{ {
wstring fullCounterPath(L""); wstring fullCounterPath(L"");
fullCounterPath+=L"\\Processor("; fullCounterPath+=L"\\Processor(";
@ -157,7 +157,7 @@ double Processor::GetC1TransitionsPerSecond(wchar_t * instanceName, int idleTime
} }
// C2 Transitions/sec // C2 Transitions/sec
double Processor::GetC2TransitionsPerSecond(wchar_t * instanceName, int idleTime) double Processor::GetC2TransitionsPerSecond(const wchar_t * instanceName, int idleTime)
{ {
wstring fullCounterPath(L""); wstring fullCounterPath(L"");
fullCounterPath+=L"\\Processor("; fullCounterPath+=L"\\Processor(";
@ -168,7 +168,7 @@ double Processor::GetC2TransitionsPerSecond(wchar_t * instanceName, int idleTime
} }
// C3 Transitions/sec // C3 Transitions/sec
double Processor::GetC3TransitionsPerSecond(wchar_t * instanceName, int idleTime) double Processor::GetC3TransitionsPerSecond(const wchar_t * instanceName, int idleTime)
{ {
wstring fullCounterPath(L""); wstring fullCounterPath(L"");
fullCounterPath+=L"\\Processor("; fullCounterPath+=L"\\Processor(";

View File

@ -9,19 +9,19 @@ class MONITOR_API Processor
public: public:
static list<wstring> GetInstances(); static list<wstring> GetInstances();
static list<wstring> GetCounterList(); static list<wstring> GetCounterList();
static double GetProcessorTimePercent(wchar_t * instanceName, int idleTime); static double GetProcessorTimePercent(const wchar_t * instanceName, int idleTime);
static double GetUserTimePercent(wchar_t * instanceName, int idleTime); static double GetUserTimePercent(const wchar_t * instanceName, int idleTime);
static double GetPrivilegedTimePercent(wchar_t * instanceName, int idleTime); static double GetPrivilegedTimePercent(const wchar_t * instanceName, int idleTime);
static double GetInterruptsPerSecond(wchar_t * instanceName, int idleTime); static double GetInterruptsPerSecond(const wchar_t * instanceName, int idleTime);
static double GetDpcTimePercent(wchar_t * instanceName, int idleTime); static double GetDpcTimePercent(const wchar_t * instanceName, int idleTime);
static double GetInterruptTimePercent(wchar_t * instanceName, int idleTime); static double GetInterruptTimePercent(const wchar_t * instanceName, int idleTime);
static double GetDpcsQueuedPerSecond(wchar_t * instanceName, int idleTime); static double GetDpcsQueuedPerSecond(const wchar_t * instanceName, int idleTime);
static double GetDpcRate(wchar_t * instanceName); static double GetDpcRate(const wchar_t * instanceName);
static double GetIdleTimePercent(wchar_t * instanceName, int idleTime); static double GetIdleTimePercent(const wchar_t * instanceName, int idleTime);
static double GetC1TimePercent(wchar_t * instanceName, int idleTime); static double GetC1TimePercent(const wchar_t * instanceName, int idleTime);
static double GetC2TimePercent(wchar_t * instanceName, int idleTime); static double GetC2TimePercent(const wchar_t * instanceName, int idleTime);
static double GetC3TimePercent(wchar_t * instanceName, int idleTime); static double GetC3TimePercent(const wchar_t * instanceName, int idleTime);
static double GetC1TransitionsPerSecond(wchar_t * instanceName, int idleTime); static double GetC1TransitionsPerSecond(const wchar_t * instanceName, int idleTime);
static double GetC2TransitionsPerSecond(wchar_t * instanceName, int idleTime); static double GetC2TransitionsPerSecond(const wchar_t * instanceName, int idleTime);
static double GetC3TransitionsPerSecond(wchar_t * instanceName, int idleTime); static double GetC3TransitionsPerSecond(const wchar_t * instanceName, int idleTime);
}; };

View File

@ -14,7 +14,7 @@ list<wstring> ProcessorInformation::GetCounterList()
} }
// Performance Limit Flags // Performance Limit Flags
double ProcessorInformation::GetPerformanceLimitFlags(wchar_t * instanceName) double ProcessorInformation::GetPerformanceLimitFlags(const wchar_t * instanceName)
{ {
wstring fullCounterPath(L""); wstring fullCounterPath(L"");
fullCounterPath+=L"\\Processor Information("; fullCounterPath+=L"\\Processor Information(";
@ -25,7 +25,7 @@ double ProcessorInformation::GetPerformanceLimitFlags(wchar_t * instanceName)
} }
// % Performance Limit // % Performance Limit
double ProcessorInformation::GetPerformanceLimitPercent(wchar_t * instanceName) double ProcessorInformation::GetPerformanceLimitPercent(const wchar_t * instanceName)
{ {
wstring fullCounterPath(L""); wstring fullCounterPath(L"");
fullCounterPath+=L"\\Processor Information("; fullCounterPath+=L"\\Processor Information(";
@ -36,7 +36,7 @@ double ProcessorInformation::GetPerformanceLimitPercent(wchar_t * instanceName)
} }
// % Privileged Utility // % Privileged Utility
double ProcessorInformation::GetPrivilegedUtilityPercent(wchar_t * instanceName, int idleTime) double ProcessorInformation::GetPrivilegedUtilityPercent(const wchar_t * instanceName, int idleTime)
{ {
wstring fullCounterPath(L""); wstring fullCounterPath(L"");
fullCounterPath+=L"\\Processor Information("; fullCounterPath+=L"\\Processor Information(";
@ -47,7 +47,7 @@ double ProcessorInformation::GetPrivilegedUtilityPercent(wchar_t * instanceName,
} }
// % Processor Utility // % Processor Utility
double ProcessorInformation::GetProcessorUtilityPercent(wchar_t * instanceName, int idleTime) double ProcessorInformation::GetProcessorUtilityPercent(const wchar_t * instanceName, int idleTime)
{ {
wstring fullCounterPath(L""); wstring fullCounterPath(L"");
fullCounterPath+=L"\\Processor Information("; fullCounterPath+=L"\\Processor Information(";
@ -58,7 +58,7 @@ double ProcessorInformation::GetProcessorUtilityPercent(wchar_t * instanceName,
} }
// % Processor Performance // % Processor Performance
double ProcessorInformation::GetProcessorPerformancePercent(wchar_t * instanceName, int idleTime) double ProcessorInformation::GetProcessorPerformancePercent(const wchar_t * instanceName, int idleTime)
{ {
wstring fullCounterPath(L""); wstring fullCounterPath(L"");
fullCounterPath+=L"\\Processor Information("; fullCounterPath+=L"\\Processor Information(";
@ -69,7 +69,7 @@ double ProcessorInformation::GetProcessorPerformancePercent(wchar_t * instanceNa
} }
// Idle Break Events/sec // Idle Break Events/sec
double ProcessorInformation::GetIdleBreakEventsPerSecond(wchar_t * instanceName, int idleTime) double ProcessorInformation::GetIdleBreakEventsPerSecond(const wchar_t * instanceName, int idleTime)
{ {
wstring fullCounterPath(L""); wstring fullCounterPath(L"");
fullCounterPath+=L"\\Processor Information("; fullCounterPath+=L"\\Processor Information(";
@ -80,7 +80,7 @@ double ProcessorInformation::GetIdleBreakEventsPerSecond(wchar_t * instanceName,
} }
// Average Idle Time // Average Idle Time
double ProcessorInformation::GetAverageIdleTime(wchar_t * instanceName, int idleTime) double ProcessorInformation::GetAverageIdleTime(const wchar_t * instanceName, int idleTime)
{ {
wstring fullCounterPath(L""); wstring fullCounterPath(L"");
fullCounterPath+=L"\\Processor Information("; fullCounterPath+=L"\\Processor Information(";
@ -91,7 +91,7 @@ double ProcessorInformation::GetAverageIdleTime(wchar_t * instanceName, int idle
} }
// Clock Interrupts/sec // Clock Interrupts/sec
double ProcessorInformation::GetClockInterruptsPerSecond(wchar_t * instanceName, int idleTime) double ProcessorInformation::GetClockInterruptsPerSecond(const wchar_t * instanceName, int idleTime)
{ {
wstring fullCounterPath(L""); wstring fullCounterPath(L"");
fullCounterPath+=L"\\Processor Information("; fullCounterPath+=L"\\Processor Information(";
@ -102,7 +102,7 @@ double ProcessorInformation::GetClockInterruptsPerSecond(wchar_t * instanceName,
} }
// Processor State Flags // Processor State Flags
double ProcessorInformation::GetProcessorStateFlags(wchar_t * instanceName) double ProcessorInformation::GetProcessorStateFlags(const wchar_t * instanceName)
{ {
wstring fullCounterPath(L""); wstring fullCounterPath(L"");
fullCounterPath+=L"\\Processor Information("; fullCounterPath+=L"\\Processor Information(";
@ -113,7 +113,7 @@ double ProcessorInformation::GetProcessorStateFlags(wchar_t * instanceName)
} }
// % of Maximum Frequency // % of Maximum Frequency
double ProcessorInformation::GetPercentageOfMaximumFrequency(wchar_t * instanceName) double ProcessorInformation::GetPercentageOfMaximumFrequency(const wchar_t * instanceName)
{ {
wstring fullCounterPath(L""); wstring fullCounterPath(L"");
fullCounterPath+=L"\\Processor Information("; fullCounterPath+=L"\\Processor Information(";
@ -124,7 +124,7 @@ double ProcessorInformation::GetPercentageOfMaximumFrequency(wchar_t * instanceN
} }
// Processor Frequency // Processor Frequency
double ProcessorInformation::GetProcessorFrequency(wchar_t * instanceName) double ProcessorInformation::GetProcessorFrequency(const wchar_t * instanceName)
{ {
wstring fullCounterPath(L""); wstring fullCounterPath(L"");
fullCounterPath+=L"\\Processor Information("; fullCounterPath+=L"\\Processor Information(";
@ -135,7 +135,7 @@ double ProcessorInformation::GetProcessorFrequency(wchar_t * instanceName)
} }
// Parking Status // Parking Status
double ProcessorInformation::GetParkingStatus(wchar_t * instanceName) double ProcessorInformation::GetParkingStatus(const wchar_t * instanceName)
{ {
wstring fullCounterPath(L""); wstring fullCounterPath(L"");
fullCounterPath+=L"\\Processor Information("; fullCounterPath+=L"\\Processor Information(";
@ -146,7 +146,7 @@ double ProcessorInformation::GetParkingStatus(wchar_t * instanceName)
} }
// % Priority Time // % Priority Time
double ProcessorInformation::GetPriorityTimePercent(wchar_t * instanceName, int idleTime) double ProcessorInformation::GetPriorityTimePercent(const wchar_t * instanceName, int idleTime)
{ {
wstring fullCounterPath(L""); wstring fullCounterPath(L"");
fullCounterPath+=L"\\Processor Information("; fullCounterPath+=L"\\Processor Information(";
@ -157,7 +157,7 @@ double ProcessorInformation::GetPriorityTimePercent(wchar_t * instanceName, int
} }
// C3 Transitions/sec // C3 Transitions/sec
double ProcessorInformation::GetC3TransitionsPerSecond(wchar_t * instanceName, int idleTime) double ProcessorInformation::GetC3TransitionsPerSecond(const wchar_t * instanceName, int idleTime)
{ {
wstring fullCounterPath(L""); wstring fullCounterPath(L"");
fullCounterPath+=L"\\Processor Information("; fullCounterPath+=L"\\Processor Information(";
@ -168,7 +168,7 @@ double ProcessorInformation::GetC3TransitionsPerSecond(wchar_t * instanceName, i
} }
// C2 Transitions/sec // C2 Transitions/sec
double ProcessorInformation::GetC2TransitionsPerSecond(wchar_t * instanceName, int idleTime) double ProcessorInformation::GetC2TransitionsPerSecond(const wchar_t * instanceName, int idleTime)
{ {
wstring fullCounterPath(L""); wstring fullCounterPath(L"");
fullCounterPath+=L"\\Processor Information("; fullCounterPath+=L"\\Processor Information(";
@ -179,7 +179,7 @@ double ProcessorInformation::GetC2TransitionsPerSecond(wchar_t * instanceName, i
} }
// C1 Transitions/sec // C1 Transitions/sec
double ProcessorInformation::GetC1TransitionsPerSecond(wchar_t * instanceName, int idleTime) double ProcessorInformation::GetC1TransitionsPerSecond(const wchar_t * instanceName, int idleTime)
{ {
wstring fullCounterPath(L""); wstring fullCounterPath(L"");
fullCounterPath+=L"\\Processor Information("; fullCounterPath+=L"\\Processor Information(";
@ -190,7 +190,7 @@ double ProcessorInformation::GetC1TransitionsPerSecond(wchar_t * instanceName, i
} }
// % C3 Time // % C3 Time
double ProcessorInformation::GetC3TimePercent(wchar_t * instanceName, int idleTime) double ProcessorInformation::GetC3TimePercent(const wchar_t * instanceName, int idleTime)
{ {
wstring fullCounterPath(L""); wstring fullCounterPath(L"");
fullCounterPath+=L"\\Processor Information("; fullCounterPath+=L"\\Processor Information(";
@ -201,7 +201,7 @@ double ProcessorInformation::GetC3TimePercent(wchar_t * instanceName, int idleTi
} }
// % C2 Time // % C2 Time
double ProcessorInformation::GetC2TimePercent(wchar_t * instanceName, int idleTime) double ProcessorInformation::GetC2TimePercent(const wchar_t * instanceName, int idleTime)
{ {
wstring fullCounterPath(L""); wstring fullCounterPath(L"");
fullCounterPath+=L"\\Processor Information("; fullCounterPath+=L"\\Processor Information(";
@ -212,7 +212,7 @@ double ProcessorInformation::GetC2TimePercent(wchar_t * instanceName, int idleTi
} }
// % C1 Time // % C1 Time
double ProcessorInformation::GetC1TimePercent(wchar_t * instanceName, int idleTime) double ProcessorInformation::GetC1TimePercent(const wchar_t * instanceName, int idleTime)
{ {
wstring fullCounterPath(L""); wstring fullCounterPath(L"");
fullCounterPath+=L"\\Processor Information("; fullCounterPath+=L"\\Processor Information(";
@ -223,7 +223,7 @@ double ProcessorInformation::GetC1TimePercent(wchar_t * instanceName, int idleTi
} }
// % Idle Time // % Idle Time
double ProcessorInformation::GetIdleTimePercent(wchar_t * instanceName, int idleTime) double ProcessorInformation::GetIdleTimePercent(const wchar_t * instanceName, int idleTime)
{ {
wstring fullCounterPath(L""); wstring fullCounterPath(L"");
fullCounterPath+=L"\\Processor Information("; fullCounterPath+=L"\\Processor Information(";
@ -234,7 +234,7 @@ double ProcessorInformation::GetIdleTimePercent(wchar_t * instanceName, int idle
} }
// DPC Rate // DPC Rate
double ProcessorInformation::GetDpcRate(wchar_t * instanceName) double ProcessorInformation::GetDpcRate(const wchar_t * instanceName)
{ {
wstring fullCounterPath(L""); wstring fullCounterPath(L"");
fullCounterPath+=L"\\Processor Information("; fullCounterPath+=L"\\Processor Information(";
@ -245,7 +245,7 @@ double ProcessorInformation::GetDpcRate(wchar_t * instanceName)
} }
// DPCs Queued/sec // DPCs Queued/sec
double ProcessorInformation::GetDpcsQueuedPerSecond(wchar_t * instanceName, int idleTime) double ProcessorInformation::GetDpcsQueuedPerSecond(const wchar_t * instanceName, int idleTime)
{ {
wstring fullCounterPath(L""); wstring fullCounterPath(L"");
fullCounterPath+=L"\\Processor Information("; fullCounterPath+=L"\\Processor Information(";
@ -256,7 +256,7 @@ double ProcessorInformation::GetDpcsQueuedPerSecond(wchar_t * instanceName, int
} }
// % Interrupt Time // % Interrupt Time
double ProcessorInformation::GetInterruptTimePercent(wchar_t * instanceName, int idleTime) double ProcessorInformation::GetInterruptTimePercent(const wchar_t * instanceName, int idleTime)
{ {
wstring fullCounterPath(L""); wstring fullCounterPath(L"");
fullCounterPath+=L"\\Processor Information("; fullCounterPath+=L"\\Processor Information(";
@ -267,7 +267,7 @@ double ProcessorInformation::GetInterruptTimePercent(wchar_t * instanceName, int
} }
// % DPC Time // % DPC Time
double ProcessorInformation::GetDpcTimePercent(wchar_t * instanceName, int idleTime) double ProcessorInformation::GetDpcTimePercent(const wchar_t * instanceName, int idleTime)
{ {
wstring fullCounterPath(L""); wstring fullCounterPath(L"");
fullCounterPath+=L"\\Processor Information("; fullCounterPath+=L"\\Processor Information(";
@ -278,7 +278,7 @@ double ProcessorInformation::GetDpcTimePercent(wchar_t * instanceName, int idleT
} }
// Interrupts/sec // Interrupts/sec
double ProcessorInformation::GetInterruptsPerSecond(wchar_t * instanceName, int idleTime) double ProcessorInformation::GetInterruptsPerSecond(const wchar_t * instanceName, int idleTime)
{ {
wstring fullCounterPath(L""); wstring fullCounterPath(L"");
fullCounterPath+=L"\\Processor Information("; fullCounterPath+=L"\\Processor Information(";
@ -289,7 +289,7 @@ double ProcessorInformation::GetInterruptsPerSecond(wchar_t * instanceName, int
} }
// % Privileged Time // % Privileged Time
double ProcessorInformation::GetPrivilegedTimePercent(wchar_t * instanceName, int idleTime) double ProcessorInformation::GetPrivilegedTimePercent(const wchar_t * instanceName, int idleTime)
{ {
wstring fullCounterPath(L""); wstring fullCounterPath(L"");
fullCounterPath+=L"\\Processor Information("; fullCounterPath+=L"\\Processor Information(";
@ -300,7 +300,7 @@ double ProcessorInformation::GetPrivilegedTimePercent(wchar_t * instanceName, in
} }
// % User Time // % User Time
double ProcessorInformation::GetUserTimePercent(wchar_t * instanceName, int idleTime) double ProcessorInformation::GetUserTimePercent(const wchar_t * instanceName, int idleTime)
{ {
wstring fullCounterPath(L""); wstring fullCounterPath(L"");
fullCounterPath+=L"\\Processor Information("; fullCounterPath+=L"\\Processor Information(";
@ -311,7 +311,7 @@ double ProcessorInformation::GetUserTimePercent(wchar_t * instanceName, int idle
} }
// % Processor Time // % Processor Time
double ProcessorInformation::GetProcessorTimePercent(wchar_t * instanceName, int idleTime) double ProcessorInformation::GetProcessorTimePercent(const wchar_t * instanceName, int idleTime)
{ {
wstring fullCounterPath(L""); wstring fullCounterPath(L"");
fullCounterPath+=L"\\Processor Information("; fullCounterPath+=L"\\Processor Information(";

View File

@ -9,32 +9,32 @@ class MONITOR_API ProcessorInformation
public: public:
static list<wstring> GetInstances(); static list<wstring> GetInstances();
static list<wstring> GetCounterList(); static list<wstring> GetCounterList();
static double GetPerformanceLimitFlags(wchar_t * instanceName); static double GetPerformanceLimitFlags(const wchar_t * instanceName);
static double GetPerformanceLimitPercent(wchar_t * instanceName); static double GetPerformanceLimitPercent(const wchar_t * instanceName);
static double GetPrivilegedUtilityPercent(wchar_t * instanceName, int idleTime); static double GetPrivilegedUtilityPercent(const wchar_t * instanceName, int idleTime);
static double GetProcessorUtilityPercent(wchar_t * instanceName, int idleTime); static double GetProcessorUtilityPercent(const wchar_t * instanceName, int idleTime);
static double GetProcessorPerformancePercent(wchar_t * instanceName, int idleTime); static double GetProcessorPerformancePercent(const wchar_t * instanceName, int idleTime);
static double GetIdleBreakEventsPerSecond(wchar_t * instanceName, int idleTime); static double GetIdleBreakEventsPerSecond(const wchar_t * instanceName, int idleTime);
static double GetAverageIdleTime(wchar_t * instanceName, int idleTime); static double GetAverageIdleTime(const wchar_t * instanceName, int idleTime);
static double GetClockInterruptsPerSecond(wchar_t * instanceName, int idleTime); static double GetClockInterruptsPerSecond(const wchar_t * instanceName, int idleTime);
static double GetProcessorStateFlags(wchar_t * instanceName); static double GetProcessorStateFlags(const wchar_t * instanceName);
static double GetPercentageOfMaximumFrequency(wchar_t * instanceName); static double GetPercentageOfMaximumFrequency(const wchar_t * instanceName);
static double GetProcessorFrequency(wchar_t * instanceName); static double GetProcessorFrequency(const wchar_t * instanceName);
static double GetParkingStatus(wchar_t * instanceName); static double GetParkingStatus(const wchar_t * instanceName);
static double GetPriorityTimePercent(wchar_t * instanceName, int idleTime); static double GetPriorityTimePercent(const wchar_t * instanceName, int idleTime);
static double GetC3TransitionsPerSecond(wchar_t * instanceName, int idleTime); static double GetC3TransitionsPerSecond(const wchar_t * instanceName, int idleTime);
static double GetC2TransitionsPerSecond(wchar_t * instanceName, int idleTime); static double GetC2TransitionsPerSecond(const wchar_t * instanceName, int idleTime);
static double GetC1TransitionsPerSecond(wchar_t * instanceName, int idleTime); static double GetC1TransitionsPerSecond(const wchar_t * instanceName, int idleTime);
static double GetC3TimePercent(wchar_t * instanceName, int idleTime); static double GetC3TimePercent(const wchar_t * instanceName, int idleTime);
static double GetC2TimePercent(wchar_t * instanceName, int idleTime); static double GetC2TimePercent(const wchar_t * instanceName, int idleTime);
static double GetC1TimePercent(wchar_t * instanceName, int idleTime); static double GetC1TimePercent(const wchar_t * instanceName, int idleTime);
static double GetIdleTimePercent(wchar_t * instanceName, int idleTime); static double GetIdleTimePercent(const wchar_t * instanceName, int idleTime);
static double GetDpcRate(wchar_t * instanceName); static double GetDpcRate(const wchar_t * instanceName);
static double GetDpcsQueuedPerSecond(wchar_t * instanceName, int idleTime); static double GetDpcsQueuedPerSecond(const wchar_t * instanceName, int idleTime);
static double GetInterruptTimePercent(wchar_t * instanceName, int idleTime); static double GetInterruptTimePercent(const wchar_t * instanceName, int idleTime);
static double GetDpcTimePercent(wchar_t * instanceName, int idleTime); static double GetDpcTimePercent(const wchar_t * instanceName, int idleTime);
static double GetInterruptsPerSecond(wchar_t * instanceName, int idleTime); static double GetInterruptsPerSecond(const wchar_t * instanceName, int idleTime);
static double GetPrivilegedTimePercent(wchar_t * instanceName, int idleTime); static double GetPrivilegedTimePercent(const wchar_t * instanceName, int idleTime);
static double GetUserTimePercent(wchar_t * instanceName, int idleTime); static double GetUserTimePercent(const wchar_t * instanceName, int idleTime);
static double GetProcessorTimePercent(wchar_t * instanceName, int idleTime); static double GetProcessorTimePercent(const wchar_t * instanceName, int idleTime);
}; };

View File

@ -0,0 +1,179 @@
#include "stdafx.h"
#include "LogicalDiskMonitor.h"
#include <iostream>
using namespace std;
JNIEXPORT jobjectArray JNICALL Java_org_bench4q_monitor_performance_windows_LogicalDiskMonitor_getInstances
(JNIEnv * environment, jobject object)
{
list<wstring> instances=LogicalDisk::GetInstances();
list<wstring>::iterator iter;
long count=(long)instances.size();
jobjectArray array=environment->NewObjectArray(
count,environment->FindClass("java/lang/String"),environment->NewStringUTF(""));
int i=0;
for(iter=instances.begin();iter!=instances.end();iter++)
{
environment->SetObjectArrayElement(array,i
,environment->NewStringUTF(Common::WideStringToString(*iter).c_str()));
i++;
}
return array;
}
JNIEXPORT jobjectArray JNICALL Java_org_bench4q_monitor_performance_windows_LogicalDiskMonitor_getCounterList
(JNIEnv * environment, jobject object)
{
list<wstring> counterList=LogicalDisk::GetCounterList();
list<wstring>::iterator iter;
long count=(long)counterList.size();
jobjectArray array=environment->NewObjectArray(
count,environment->FindClass("java/lang/String"),environment->NewStringUTF(""));
int i=0;
for(iter=counterList.begin();iter!=counterList.end();iter++)
{
environment->SetObjectArrayElement(array,i
,environment->NewStringUTF(Common::WideStringToString(*iter).c_str()));
i++;
}
return array;
}
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_LogicalDiskMonitor_getFreeSpacePercent
(JNIEnv * environment, jobject object, jstring instanceName)
{
return LogicalDisk::GetFreeSpacePercent(
Common::StringToWideString(string(environment->GetStringUTFChars(instanceName,false))).c_str());
}
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_LogicalDiskMonitor_getFreeMegabytes
(JNIEnv *, jobject, jstring)
{
return -1;
}
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_LogicalDiskMonitor_getCurrentDiskQueueLength
(JNIEnv *, jobject, jstring)
{
return -1;
}
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_LogicalDiskMonitor_getDiskTimePercent
(JNIEnv *, jobject, jstring, jint)
{
return -1;
}
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_LogicalDiskMonitor_getAverageDiskQueueLength
(JNIEnv *, jobject, jstring, jint)
{
return -1;
}
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_LogicalDiskMonitor_getDiskReadTimePercent
(JNIEnv *, jobject, jstring, jint)
{
return -1;
}
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_LogicalDiskMonitor_getAverageDiskReadQueueLength
(JNIEnv *, jobject, jstring, jint)
{
return -1;
}
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_LogicalDiskMonitor_getDiskWriteTimePercent
(JNIEnv *, jobject, jstring, jint)
{
return -1;
}
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_LogicalDiskMonitor_getAverageDiskWriteQueueLength
(JNIEnv *, jobject, jstring, jint)
{
return -1;
}
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_LogicalDiskMonitor_getAverageDiskTransferTimeInSecond
(JNIEnv *, jobject, jstring, jint)
{
return -1;
}
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_LogicalDiskMonitor_getAverageDiskReadTimeInSecond
(JNIEnv *, jobject, jstring, jint)
{
return -1;
}
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_LogicalDiskMonitor_getAverageDiskWriteTimeInSecond
(JNIEnv *, jobject, jstring, jint)
{
return -1;
}
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_LogicalDiskMonitor_getDiskTransfersPerSecond
(JNIEnv *, jobject, jstring, jint)
{
return -1;
}
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_LogicalDiskMonitor_getDiskReadsPerSecond
(JNIEnv *, jobject, jstring, jint)
{
return -1;
}
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_LogicalDiskMonitor_getDiskWritesPerSecond
(JNIEnv *, jobject, jstring, jint)
{
return -1;
}
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_LogicalDiskMonitor_getDiskBytesPerSecond
(JNIEnv *, jobject, jstring, jint)
{
return -1;
}
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_LogicalDiskMonitor_getDiskReadBytesPerSecond
(JNIEnv *, jobject, jstring, jint)
{
return -1;
}
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_LogicalDiskMonitor_getDiskWriteBytesPerSecond
(JNIEnv *, jobject, jstring, jint)
{
return -1;
}
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_LogicalDiskMonitor_getAverageDiskBytesPerTransfer
(JNIEnv *, jobject, jstring, jint)
{
return -1;
}
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_LogicalDiskMonitor_getAverageDiskBytesPerRead
(JNIEnv *, jobject, jstring, jint)
{
return -1;
}
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_LogicalDiskMonitor_getAverageDiskBytesPerWrite
(JNIEnv *, jobject, jstring, jint)
{
return -1;
}
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_LogicalDiskMonitor_getIdleTimePercent
(JNIEnv *, jobject, jstring, jint)
{
return -1;
}
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_LogicalDiskMonitor_getSplitIOPerSecond
(JNIEnv *, jobject, jstring, jint)
{
return -1;
}

View File

@ -0,0 +1,213 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_bench4q_monitor_performance_windows_LogicalDiskMonitor */
#ifndef _Included_org_bench4q_monitor_performance_windows_LogicalDiskMonitor
#define _Included_org_bench4q_monitor_performance_windows_LogicalDiskMonitor
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: org_bench4q_monitor_performance_windows_LogicalDiskMonitor
* Method: getInstances
* Signature: ()[Ljava/lang/String;
*/
JNIEXPORT jobjectArray JNICALL Java_org_bench4q_monitor_performance_windows_LogicalDiskMonitor_getInstances
(JNIEnv *, jobject);
/*
* Class: org_bench4q_monitor_performance_windows_LogicalDiskMonitor
* Method: getCounterList
* Signature: ()[Ljava/lang/String;
*/
JNIEXPORT jobjectArray JNICALL Java_org_bench4q_monitor_performance_windows_LogicalDiskMonitor_getCounterList
(JNIEnv *, jobject);
/*
* Class: org_bench4q_monitor_performance_windows_LogicalDiskMonitor
* Method: getFreeSpacePercent
* Signature: (Ljava/lang/String;)D
*/
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_LogicalDiskMonitor_getFreeSpacePercent
(JNIEnv *, jobject, jstring);
/*
* Class: org_bench4q_monitor_performance_windows_LogicalDiskMonitor
* Method: getFreeMegabytes
* Signature: (Ljava/lang/String;)D
*/
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_LogicalDiskMonitor_getFreeMegabytes
(JNIEnv *, jobject, jstring);
/*
* Class: org_bench4q_monitor_performance_windows_LogicalDiskMonitor
* Method: getCurrentDiskQueueLength
* Signature: (Ljava/lang/String;)D
*/
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_LogicalDiskMonitor_getCurrentDiskQueueLength
(JNIEnv *, jobject, jstring);
/*
* Class: org_bench4q_monitor_performance_windows_LogicalDiskMonitor
* Method: getDiskTimePercent
* Signature: (Ljava/lang/String;I)D
*/
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_LogicalDiskMonitor_getDiskTimePercent
(JNIEnv *, jobject, jstring, jint);
/*
* Class: org_bench4q_monitor_performance_windows_LogicalDiskMonitor
* Method: getAverageDiskQueueLength
* Signature: (Ljava/lang/String;I)D
*/
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_LogicalDiskMonitor_getAverageDiskQueueLength
(JNIEnv *, jobject, jstring, jint);
/*
* Class: org_bench4q_monitor_performance_windows_LogicalDiskMonitor
* Method: getDiskReadTimePercent
* Signature: (Ljava/lang/String;I)D
*/
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_LogicalDiskMonitor_getDiskReadTimePercent
(JNIEnv *, jobject, jstring, jint);
/*
* Class: org_bench4q_monitor_performance_windows_LogicalDiskMonitor
* Method: getAverageDiskReadQueueLength
* Signature: (Ljava/lang/String;I)D
*/
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_LogicalDiskMonitor_getAverageDiskReadQueueLength
(JNIEnv *, jobject, jstring, jint);
/*
* Class: org_bench4q_monitor_performance_windows_LogicalDiskMonitor
* Method: getDiskWriteTimePercent
* Signature: (Ljava/lang/String;I)D
*/
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_LogicalDiskMonitor_getDiskWriteTimePercent
(JNIEnv *, jobject, jstring, jint);
/*
* Class: org_bench4q_monitor_performance_windows_LogicalDiskMonitor
* Method: getAverageDiskWriteQueueLength
* Signature: (Ljava/lang/String;I)D
*/
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_LogicalDiskMonitor_getAverageDiskWriteQueueLength
(JNIEnv *, jobject, jstring, jint);
/*
* Class: org_bench4q_monitor_performance_windows_LogicalDiskMonitor
* Method: getAverageDiskTransferTimeInSecond
* Signature: (Ljava/lang/String;I)D
*/
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_LogicalDiskMonitor_getAverageDiskTransferTimeInSecond
(JNIEnv *, jobject, jstring, jint);
/*
* Class: org_bench4q_monitor_performance_windows_LogicalDiskMonitor
* Method: getAverageDiskReadTimeInSecond
* Signature: (Ljava/lang/String;I)D
*/
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_LogicalDiskMonitor_getAverageDiskReadTimeInSecond
(JNIEnv *, jobject, jstring, jint);
/*
* Class: org_bench4q_monitor_performance_windows_LogicalDiskMonitor
* Method: getAverageDiskWriteTimeInSecond
* Signature: (Ljava/lang/String;I)D
*/
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_LogicalDiskMonitor_getAverageDiskWriteTimeInSecond
(JNIEnv *, jobject, jstring, jint);
/*
* Class: org_bench4q_monitor_performance_windows_LogicalDiskMonitor
* Method: getDiskTransfersPerSecond
* Signature: (Ljava/lang/String;I)D
*/
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_LogicalDiskMonitor_getDiskTransfersPerSecond
(JNIEnv *, jobject, jstring, jint);
/*
* Class: org_bench4q_monitor_performance_windows_LogicalDiskMonitor
* Method: getDiskReadsPerSecond
* Signature: (Ljava/lang/String;I)D
*/
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_LogicalDiskMonitor_getDiskReadsPerSecond
(JNIEnv *, jobject, jstring, jint);
/*
* Class: org_bench4q_monitor_performance_windows_LogicalDiskMonitor
* Method: getDiskWritesPerSecond
* Signature: (Ljava/lang/String;I)D
*/
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_LogicalDiskMonitor_getDiskWritesPerSecond
(JNIEnv *, jobject, jstring, jint);
/*
* Class: org_bench4q_monitor_performance_windows_LogicalDiskMonitor
* Method: getDiskBytesPerSecond
* Signature: (Ljava/lang/String;I)D
*/
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_LogicalDiskMonitor_getDiskBytesPerSecond
(JNIEnv *, jobject, jstring, jint);
/*
* Class: org_bench4q_monitor_performance_windows_LogicalDiskMonitor
* Method: getDiskReadBytesPerSecond
* Signature: (Ljava/lang/String;I)D
*/
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_LogicalDiskMonitor_getDiskReadBytesPerSecond
(JNIEnv *, jobject, jstring, jint);
/*
* Class: org_bench4q_monitor_performance_windows_LogicalDiskMonitor
* Method: getDiskWriteBytesPerSecond
* Signature: (Ljava/lang/String;I)D
*/
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_LogicalDiskMonitor_getDiskWriteBytesPerSecond
(JNIEnv *, jobject, jstring, jint);
/*
* Class: org_bench4q_monitor_performance_windows_LogicalDiskMonitor
* Method: getAverageDiskBytesPerTransfer
* Signature: (Ljava/lang/String;I)D
*/
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_LogicalDiskMonitor_getAverageDiskBytesPerTransfer
(JNIEnv *, jobject, jstring, jint);
/*
* Class: org_bench4q_monitor_performance_windows_LogicalDiskMonitor
* Method: getAverageDiskBytesPerRead
* Signature: (Ljava/lang/String;I)D
*/
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_LogicalDiskMonitor_getAverageDiskBytesPerRead
(JNIEnv *, jobject, jstring, jint);
/*
* Class: org_bench4q_monitor_performance_windows_LogicalDiskMonitor
* Method: getAverageDiskBytesPerWrite
* Signature: (Ljava/lang/String;I)D
*/
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_LogicalDiskMonitor_getAverageDiskBytesPerWrite
(JNIEnv *, jobject, jstring, jint);
/*
* Class: org_bench4q_monitor_performance_windows_LogicalDiskMonitor
* Method: getIdleTimePercent
* Signature: (Ljava/lang/String;I)D
*/
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_LogicalDiskMonitor_getIdleTimePercent
(JNIEnv *, jobject, jstring, jint);
/*
* Class: org_bench4q_monitor_performance_windows_LogicalDiskMonitor
* Method: getSplitIOPerSecond
* Signature: (Ljava/lang/String;I)D
*/
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_LogicalDiskMonitor_getSplitIOPerSecond
(JNIEnv *, jobject, jstring, jint);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -13,6 +13,8 @@ using namespace std;
class MONITOR_API Common class MONITOR_API Common
{ {
public: public:
static string WideStringToString(const wstring & str);
static wstring StringToWideString(const string & str);
static double GetCounterValue(const wchar_t * fullCounterPath); static double GetCounterValue(const wchar_t * fullCounterPath);
static double GetCounterValueWithIdle(const wchar_t * fullCounterPath,int idleTime); static double GetCounterValueWithIdle(const wchar_t * fullCounterPath,int idleTime);
static list<wstring> GetInstanceName(const wchar_t * objectName); static list<wstring> GetInstanceName(const wchar_t * objectName);
@ -24,29 +26,29 @@ class MONITOR_API LogicalDisk
public: public:
static list<wstring> GetInstances(); static list<wstring> GetInstances();
static list<wstring> GetCounterList(); static list<wstring> GetCounterList();
static double GetFreeSpacePercent(wchar_t * instanceName); static double GetFreeSpacePercent(const wchar_t * instanceName);
static double GetFreeMegabytes(wchar_t * instanceName); static double GetFreeMegabytes(const wchar_t * instanceName);
static double GetCurrentDiskQueueLength(wchar_t * instanceName); static double GetCurrentDiskQueueLength(const wchar_t * instanceName);
static double GetDiskTimePercent(wchar_t * instanceName, int idleTime); static double GetDiskTimePercent(const wchar_t * instanceName, int idleTime);
static double GetAverageDiskQueueLength(wchar_t * instanceName, int idleTime); static double GetAverageDiskQueueLength(const wchar_t * instanceName, int idleTime);
static double GetDiskReadTimePercent(wchar_t * instanceName, int idleTime); static double GetDiskReadTimePercent(const wchar_t * instanceName, int idleTime);
static double GetAverageDiskReadQueueLength(wchar_t * instanceName, int idleTime); static double GetAverageDiskReadQueueLength(const wchar_t * instanceName, int idleTime);
static double GetDiskWriteTimePercent(wchar_t * instanceName, int idleTime); static double GetDiskWriteTimePercent(const wchar_t * instanceName, int idleTime);
static double GetAverageDiskWriteQueueLength(wchar_t * instanceName, int idleTime); static double GetAverageDiskWriteQueueLength(const wchar_t * instanceName, int idleTime);
static double GetAverageDiskTransferTimeInSecond(wchar_t * instanceName, int idleTime); static double GetAverageDiskTransferTimeInSecond(const wchar_t * instanceName, int idleTime);
static double GetAverageDiskReadTimeInSecond(wchar_t * instanceName, int idleTime); static double GetAverageDiskReadTimeInSecond(const wchar_t * instanceName, int idleTime);
static double GetAverageDiskWriteTimeInSecond(wchar_t * instanceName, int idleTime); static double GetAverageDiskWriteTimeInSecond(const wchar_t * instanceName, int idleTime);
static double GetDiskTransfersPerSecond(wchar_t * instanceName, int idleTime); static double GetDiskTransfersPerSecond(const wchar_t * instanceName, int idleTime);
static double GetDiskReadsPerSecond(wchar_t * instanceName, int idleTime); static double GetDiskReadsPerSecond(const wchar_t * instanceName, int idleTime);
static double GetDiskWritesPerSecond(wchar_t * instanceName, int idleTime); static double GetDiskWritesPerSecond(const wchar_t * instanceName, int idleTime);
static double GetDiskBytesPerSecond(wchar_t * instanceName, int idleTime); static double GetDiskBytesPerSecond(const wchar_t * instanceName, int idleTime);
static double GetDiskReadBytesPerSecond(wchar_t * instanceName, int idleTime); static double GetDiskReadBytesPerSecond(const wchar_t * instanceName, int idleTime);
static double GetDiskWriteBytesPerSecond(wchar_t * instanceName, int idleTime); static double GetDiskWriteBytesPerSecond(const wchar_t * instanceName, int idleTime);
static double GetAverageDiskBytesPerTransfer(wchar_t * instanceName, int idleTime); static double GetAverageDiskBytesPerTransfer(const wchar_t * instanceName, int idleTime);
static double GetAverageDiskBytesPerRead(wchar_t * instanceName, int idleTime); static double GetAverageDiskBytesPerRead(const wchar_t * instanceName, int idleTime);
static double GetAverageDiskBytesPerWrite(wchar_t * instanceName, int idleTime); static double GetAverageDiskBytesPerWrite(const wchar_t * instanceName, int idleTime);
static double GetIdleTimePercent(wchar_t * instanceName, int idleTime); static double GetIdleTimePercent(const wchar_t * instanceName, int idleTime);
static double GetSplitIOPerSecond(wchar_t * instanceName, int idleTime); static double GetSplitIOPerSecond(const wchar_t * instanceName, int idleTime);
}; };
class MONITOR_API Memory class MONITOR_API Memory
@ -110,7 +112,7 @@ class MONITOR_API Process
public: public:
static list<wstring> GetInstances(); static list<wstring> GetInstances();
static list<wstring> GetCounterList(); static list<wstring> GetCounterList();
static double Process::GetProcessId(wchar_t * instanceName); static double Process::GetProcessId(const wchar_t * instanceName);
}; };
class MONITOR_API Processor class MONITOR_API Processor
@ -118,21 +120,21 @@ class MONITOR_API Processor
public: public:
static list<wstring> GetInstances(); static list<wstring> GetInstances();
static list<wstring> GetCounterList(); static list<wstring> GetCounterList();
static double GetProcessorTimePercent(wchar_t * instanceName, int idleTime); static double GetProcessorTimePercent(const wchar_t * instanceName, int idleTime);
static double GetUserTimePercent(wchar_t * instanceName, int idleTime); static double GetUserTimePercent(const wchar_t * instanceName, int idleTime);
static double GetPrivilegedTimePercent(wchar_t * instanceName, int idleTime); static double GetPrivilegedTimePercent(const wchar_t * instanceName, int idleTime);
static double GetInterruptsPerSecond(wchar_t * instanceName, int idleTime); static double GetInterruptsPerSecond(const wchar_t * instanceName, int idleTime);
static double GetDpcTimePercent(wchar_t * instanceName, int idleTime); static double GetDpcTimePercent(const wchar_t * instanceName, int idleTime);
static double GetInterruptTimePercent(wchar_t * instanceName, int idleTime); static double GetInterruptTimePercent(const wchar_t * instanceName, int idleTime);
static double GetDpcsQueuedPerSecond(wchar_t * instanceName, int idleTime); static double GetDpcsQueuedPerSecond(const wchar_t * instanceName, int idleTime);
static double GetDpcRate(wchar_t * instanceName); static double GetDpcRate(const wchar_t * instanceName);
static double GetIdleTimePercent(wchar_t * instanceName, int idleTime); static double GetIdleTimePercent(const wchar_t * instanceName, int idleTime);
static double GetC1TimePercent(wchar_t * instanceName, int idleTime); static double GetC1TimePercent(const wchar_t * instanceName, int idleTime);
static double GetC2TimePercent(wchar_t * instanceName, int idleTime); static double GetC2TimePercent(const wchar_t * instanceName, int idleTime);
static double GetC3TimePercent(wchar_t * instanceName, int idleTime); static double GetC3TimePercent(const wchar_t * instanceName, int idleTime);
static double GetC1TransitionsPerSecond(wchar_t * instanceName, int idleTime); static double GetC1TransitionsPerSecond(const wchar_t * instanceName, int idleTime);
static double GetC2TransitionsPerSecond(wchar_t * instanceName, int idleTime); static double GetC2TransitionsPerSecond(const wchar_t * instanceName, int idleTime);
static double GetC3TransitionsPerSecond(wchar_t * instanceName, int idleTime); static double GetC3TransitionsPerSecond(const wchar_t * instanceName, int idleTime);
}; };
class MONITOR_API ProcessorInformation class MONITOR_API ProcessorInformation
@ -140,34 +142,34 @@ class MONITOR_API ProcessorInformation
public: public:
static list<wstring> GetInstances(); static list<wstring> GetInstances();
static list<wstring> GetCounterList(); static list<wstring> GetCounterList();
static double GetPerformanceLimitFlags(wchar_t * instanceName); static double GetPerformanceLimitFlags(const wchar_t * instanceName);
static double GetPerformanceLimitPercent(wchar_t * instanceName); static double GetPerformanceLimitPercent(const wchar_t * instanceName);
static double GetPrivilegedUtilityPercent(wchar_t * instanceName, int idleTime); static double GetPrivilegedUtilityPercent(const wchar_t * instanceName, int idleTime);
static double GetProcessorUtilityPercent(wchar_t * instanceName, int idleTime); static double GetProcessorUtilityPercent(const wchar_t * instanceName, int idleTime);
static double GetProcessorPerformancePercent(wchar_t * instanceName, int idleTime); static double GetProcessorPerformancePercent(const wchar_t * instanceName, int idleTime);
static double GetIdleBreakEventsPerSecond(wchar_t * instanceName, int idleTime); static double GetIdleBreakEventsPerSecond(const wchar_t * instanceName, int idleTime);
static double GetAverageIdleTime(wchar_t * instanceName, int idleTime); static double GetAverageIdleTime(const wchar_t * instanceName, int idleTime);
static double GetClockInterruptsPerSecond(wchar_t * instanceName, int idleTime); static double GetClockInterruptsPerSecond(const wchar_t * instanceName, int idleTime);
static double GetProcessorStateFlags(wchar_t * instanceName); static double GetProcessorStateFlags(const wchar_t * instanceName);
static double GetPercentageOfMaximumFrequency(wchar_t * instanceName); static double GetPercentageOfMaximumFrequency(const wchar_t * instanceName);
static double GetProcessorFrequency(wchar_t * instanceName); static double GetProcessorFrequency(const wchar_t * instanceName);
static double GetParkingStatus(wchar_t * instanceName); static double GetParkingStatus(const wchar_t * instanceName);
static double GetPriorityTimePercent(wchar_t * instanceName, int idleTime); static double GetPriorityTimePercent(const wchar_t * instanceName, int idleTime);
static double GetC3TransitionsPerSecond(wchar_t * instanceName, int idleTime); static double GetC3TransitionsPerSecond(const wchar_t * instanceName, int idleTime);
static double GetC2TransitionsPerSecond(wchar_t * instanceName, int idleTime); static double GetC2TransitionsPerSecond(const wchar_t * instanceName, int idleTime);
static double GetC1TransitionsPerSecond(wchar_t * instanceName, int idleTime); static double GetC1TransitionsPerSecond(const wchar_t * instanceName, int idleTime);
static double GetC3TimePercent(wchar_t * instanceName, int idleTime); static double GetC3TimePercent(const wchar_t * instanceName, int idleTime);
static double GetC2TimePercent(wchar_t * instanceName, int idleTime); static double GetC2TimePercent(const wchar_t * instanceName, int idleTime);
static double GetC1TimePercent(wchar_t * instanceName, int idleTime); static double GetC1TimePercent(const wchar_t * instanceName, int idleTime);
static double GetIdleTimePercent(wchar_t * instanceName, int idleTime); static double GetIdleTimePercent(const wchar_t * instanceName, int idleTime);
static double GetDpcRate(wchar_t * instanceName); static double GetDpcRate(const wchar_t * instanceName);
static double GetDpcsQueuedPerSecond(wchar_t * instanceName, int idleTime); static double GetDpcsQueuedPerSecond(const wchar_t * instanceName, int idleTime);
static double GetInterruptTimePercent(wchar_t * instanceName, int idleTime); static double GetInterruptTimePercent(const wchar_t * instanceName, int idleTime);
static double GetDpcTimePercent(wchar_t * instanceName, int idleTime); static double GetDpcTimePercent(const wchar_t * instanceName, int idleTime);
static double GetInterruptsPerSecond(wchar_t * instanceName, int idleTime); static double GetInterruptsPerSecond(const wchar_t * instanceName, int idleTime);
static double GetPrivilegedTimePercent(wchar_t * instanceName, int idleTime); static double GetPrivilegedTimePercent(const wchar_t * instanceName, int idleTime);
static double GetUserTimePercent(wchar_t * instanceName, int idleTime); static double GetUserTimePercent(const wchar_t * instanceName, int idleTime);
static double GetProcessorTimePercent(wchar_t * instanceName, int idleTime); static double GetProcessorTimePercent(const wchar_t * instanceName, int idleTime);
}; };
class MONITOR_API System class MONITOR_API System

View File

@ -1,8 +0,0 @@
#include "stdafx.h"
#include "Native.h"
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_probe_windows_WindowsCpuProbe_getCpuUsage
(JNIEnv * environment, jobject object)
{
return ProcessorInformation::GetProcessorTimePercent(L"_Total",1500);
}

View File

@ -146,7 +146,7 @@
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="WindowsCpuProbe.h" /> <ClInclude Include="LogicalDiskMonitor.h" />
<ClInclude Include="MonitorApi.h" /> <ClInclude Include="MonitorApi.h" />
<ClInclude Include="Native.h" /> <ClInclude Include="Native.h" />
<ClInclude Include="stdafx.h" /> <ClInclude Include="stdafx.h" />
@ -166,7 +166,7 @@
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader> </PrecompiledHeader>
</ClCompile> </ClCompile>
<ClCompile Include="Native.cpp" /> <ClCompile Include="LogicalDiskMonitor.cpp" />
<ClCompile Include="stdafx.cpp"> <ClCompile Include="stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>

View File

@ -21,10 +21,10 @@
<ClInclude Include="Native.h"> <ClInclude Include="Native.h">
<Filter>头文件</Filter> <Filter>头文件</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="WindowsCpuProbe.h"> <ClInclude Include="MonitorApi.h">
<Filter>头文件</Filter> <Filter>头文件</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="MonitorApi.h"> <ClInclude Include="LogicalDiskMonitor.h">
<Filter>头文件</Filter> <Filter>头文件</Filter>
</ClInclude> </ClInclude>
</ItemGroup> </ItemGroup>
@ -32,10 +32,10 @@
<ClCompile Include="stdafx.cpp"> <ClCompile Include="stdafx.cpp">
<Filter>源文件</Filter> <Filter>源文件</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="Native.cpp"> <ClCompile Include="dllmain.cpp">
<Filter>源文件</Filter> <Filter>源文件</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="dllmain.cpp"> <ClCompile Include="LogicalDiskMonitor.cpp">
<Filter>源文件</Filter> <Filter>源文件</Filter>
</ClCompile> </ClCompile>
</ItemGroup> </ItemGroup>

View File

@ -1,21 +0,0 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_bench4q_monitor_probe_windows_WindowsCpuProbe */
#ifndef _Included_org_bench4q_monitor_probe_windows_WindowsCpuProbe
#define _Included_org_bench4q_monitor_probe_windows_WindowsCpuProbe
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: org_bench4q_monitor_probe_windows_WindowsCpuProbe
* Method: getCpuUsage
* Signature: ()D
*/
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_probe_windows_WindowsCpuProbe_getCpuUsage
(JNIEnv *, jobject);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -17,7 +17,4 @@
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#include <windows.h> #include <windows.h>
#include <jni.h>
#include "WindowsCpuProbe.h"
#include "MonitorApi.h" #include "MonitorApi.h"

View File

@ -13,6 +13,8 @@ using namespace std;
class MONITOR_API Common class MONITOR_API Common
{ {
public: public:
static string WideStringToString(const wstring & str);
static wstring StringToWideString(const string & str);
static double GetCounterValue(const wchar_t * fullCounterPath); static double GetCounterValue(const wchar_t * fullCounterPath);
static double GetCounterValueWithIdle(const wchar_t * fullCounterPath,int idleTime); static double GetCounterValueWithIdle(const wchar_t * fullCounterPath,int idleTime);
static list<wstring> GetInstanceName(const wchar_t * objectName); static list<wstring> GetInstanceName(const wchar_t * objectName);
@ -24,29 +26,29 @@ class MONITOR_API LogicalDisk
public: public:
static list<wstring> GetInstances(); static list<wstring> GetInstances();
static list<wstring> GetCounterList(); static list<wstring> GetCounterList();
static double GetFreeSpacePercent(wchar_t * instanceName); static double GetFreeSpacePercent(const wchar_t * instanceName);
static double GetFreeMegabytes(wchar_t * instanceName); static double GetFreeMegabytes(const wchar_t * instanceName);
static double GetCurrentDiskQueueLength(wchar_t * instanceName); static double GetCurrentDiskQueueLength(const wchar_t * instanceName);
static double GetDiskTimePercent(wchar_t * instanceName, int idleTime); static double GetDiskTimePercent(const wchar_t * instanceName, int idleTime);
static double GetAverageDiskQueueLength(wchar_t * instanceName, int idleTime); static double GetAverageDiskQueueLength(const wchar_t * instanceName, int idleTime);
static double GetDiskReadTimePercent(wchar_t * instanceName, int idleTime); static double GetDiskReadTimePercent(const wchar_t * instanceName, int idleTime);
static double GetAverageDiskReadQueueLength(wchar_t * instanceName, int idleTime); static double GetAverageDiskReadQueueLength(const wchar_t * instanceName, int idleTime);
static double GetDiskWriteTimePercent(wchar_t * instanceName, int idleTime); static double GetDiskWriteTimePercent(const wchar_t * instanceName, int idleTime);
static double GetAverageDiskWriteQueueLength(wchar_t * instanceName, int idleTime); static double GetAverageDiskWriteQueueLength(const wchar_t * instanceName, int idleTime);
static double GetAverageDiskTransferTimeInSecond(wchar_t * instanceName, int idleTime); static double GetAverageDiskTransferTimeInSecond(const wchar_t * instanceName, int idleTime);
static double GetAverageDiskReadTimeInSecond(wchar_t * instanceName, int idleTime); static double GetAverageDiskReadTimeInSecond(const wchar_t * instanceName, int idleTime);
static double GetAverageDiskWriteTimeInSecond(wchar_t * instanceName, int idleTime); static double GetAverageDiskWriteTimeInSecond(const wchar_t * instanceName, int idleTime);
static double GetDiskTransfersPerSecond(wchar_t * instanceName, int idleTime); static double GetDiskTransfersPerSecond(const wchar_t * instanceName, int idleTime);
static double GetDiskReadsPerSecond(wchar_t * instanceName, int idleTime); static double GetDiskReadsPerSecond(const wchar_t * instanceName, int idleTime);
static double GetDiskWritesPerSecond(wchar_t * instanceName, int idleTime); static double GetDiskWritesPerSecond(const wchar_t * instanceName, int idleTime);
static double GetDiskBytesPerSecond(wchar_t * instanceName, int idleTime); static double GetDiskBytesPerSecond(const wchar_t * instanceName, int idleTime);
static double GetDiskReadBytesPerSecond(wchar_t * instanceName, int idleTime); static double GetDiskReadBytesPerSecond(const wchar_t * instanceName, int idleTime);
static double GetDiskWriteBytesPerSecond(wchar_t * instanceName, int idleTime); static double GetDiskWriteBytesPerSecond(const wchar_t * instanceName, int idleTime);
static double GetAverageDiskBytesPerTransfer(wchar_t * instanceName, int idleTime); static double GetAverageDiskBytesPerTransfer(const wchar_t * instanceName, int idleTime);
static double GetAverageDiskBytesPerRead(wchar_t * instanceName, int idleTime); static double GetAverageDiskBytesPerRead(const wchar_t * instanceName, int idleTime);
static double GetAverageDiskBytesPerWrite(wchar_t * instanceName, int idleTime); static double GetAverageDiskBytesPerWrite(const wchar_t * instanceName, int idleTime);
static double GetIdleTimePercent(wchar_t * instanceName, int idleTime); static double GetIdleTimePercent(const wchar_t * instanceName, int idleTime);
static double GetSplitIOPerSecond(wchar_t * instanceName, int idleTime); static double GetSplitIOPerSecond(const wchar_t * instanceName, int idleTime);
}; };
class MONITOR_API Memory class MONITOR_API Memory
@ -110,7 +112,7 @@ class MONITOR_API Process
public: public:
static list<wstring> GetInstances(); static list<wstring> GetInstances();
static list<wstring> GetCounterList(); static list<wstring> GetCounterList();
static double Process::GetProcessId(wchar_t * instanceName); static double Process::GetProcessId(const wchar_t * instanceName);
}; };
class MONITOR_API Processor class MONITOR_API Processor
@ -118,21 +120,21 @@ class MONITOR_API Processor
public: public:
static list<wstring> GetInstances(); static list<wstring> GetInstances();
static list<wstring> GetCounterList(); static list<wstring> GetCounterList();
static double GetProcessorTimePercent(wchar_t * instanceName, int idleTime); static double GetProcessorTimePercent(const wchar_t * instanceName, int idleTime);
static double GetUserTimePercent(wchar_t * instanceName, int idleTime); static double GetUserTimePercent(const wchar_t * instanceName, int idleTime);
static double GetPrivilegedTimePercent(wchar_t * instanceName, int idleTime); static double GetPrivilegedTimePercent(const wchar_t * instanceName, int idleTime);
static double GetInterruptsPerSecond(wchar_t * instanceName, int idleTime); static double GetInterruptsPerSecond(const wchar_t * instanceName, int idleTime);
static double GetDpcTimePercent(wchar_t * instanceName, int idleTime); static double GetDpcTimePercent(const wchar_t * instanceName, int idleTime);
static double GetInterruptTimePercent(wchar_t * instanceName, int idleTime); static double GetInterruptTimePercent(const wchar_t * instanceName, int idleTime);
static double GetDpcsQueuedPerSecond(wchar_t * instanceName, int idleTime); static double GetDpcsQueuedPerSecond(const wchar_t * instanceName, int idleTime);
static double GetDpcRate(wchar_t * instanceName); static double GetDpcRate(const wchar_t * instanceName);
static double GetIdleTimePercent(wchar_t * instanceName, int idleTime); static double GetIdleTimePercent(const wchar_t * instanceName, int idleTime);
static double GetC1TimePercent(wchar_t * instanceName, int idleTime); static double GetC1TimePercent(const wchar_t * instanceName, int idleTime);
static double GetC2TimePercent(wchar_t * instanceName, int idleTime); static double GetC2TimePercent(const wchar_t * instanceName, int idleTime);
static double GetC3TimePercent(wchar_t * instanceName, int idleTime); static double GetC3TimePercent(const wchar_t * instanceName, int idleTime);
static double GetC1TransitionsPerSecond(wchar_t * instanceName, int idleTime); static double GetC1TransitionsPerSecond(const wchar_t * instanceName, int idleTime);
static double GetC2TransitionsPerSecond(wchar_t * instanceName, int idleTime); static double GetC2TransitionsPerSecond(const wchar_t * instanceName, int idleTime);
static double GetC3TransitionsPerSecond(wchar_t * instanceName, int idleTime); static double GetC3TransitionsPerSecond(const wchar_t * instanceName, int idleTime);
}; };
class MONITOR_API ProcessorInformation class MONITOR_API ProcessorInformation
@ -140,34 +142,34 @@ class MONITOR_API ProcessorInformation
public: public:
static list<wstring> GetInstances(); static list<wstring> GetInstances();
static list<wstring> GetCounterList(); static list<wstring> GetCounterList();
static double GetPerformanceLimitFlags(wchar_t * instanceName); static double GetPerformanceLimitFlags(const wchar_t * instanceName);
static double GetPerformanceLimitPercent(wchar_t * instanceName); static double GetPerformanceLimitPercent(const wchar_t * instanceName);
static double GetPrivilegedUtilityPercent(wchar_t * instanceName, int idleTime); static double GetPrivilegedUtilityPercent(const wchar_t * instanceName, int idleTime);
static double GetProcessorUtilityPercent(wchar_t * instanceName, int idleTime); static double GetProcessorUtilityPercent(const wchar_t * instanceName, int idleTime);
static double GetProcessorPerformancePercent(wchar_t * instanceName, int idleTime); static double GetProcessorPerformancePercent(const wchar_t * instanceName, int idleTime);
static double GetIdleBreakEventsPerSecond(wchar_t * instanceName, int idleTime); static double GetIdleBreakEventsPerSecond(const wchar_t * instanceName, int idleTime);
static double GetAverageIdleTime(wchar_t * instanceName, int idleTime); static double GetAverageIdleTime(const wchar_t * instanceName, int idleTime);
static double GetClockInterruptsPerSecond(wchar_t * instanceName, int idleTime); static double GetClockInterruptsPerSecond(const wchar_t * instanceName, int idleTime);
static double GetProcessorStateFlags(wchar_t * instanceName); static double GetProcessorStateFlags(const wchar_t * instanceName);
static double GetPercentageOfMaximumFrequency(wchar_t * instanceName); static double GetPercentageOfMaximumFrequency(const wchar_t * instanceName);
static double GetProcessorFrequency(wchar_t * instanceName); static double GetProcessorFrequency(const wchar_t * instanceName);
static double GetParkingStatus(wchar_t * instanceName); static double GetParkingStatus(const wchar_t * instanceName);
static double GetPriorityTimePercent(wchar_t * instanceName, int idleTime); static double GetPriorityTimePercent(const wchar_t * instanceName, int idleTime);
static double GetC3TransitionsPerSecond(wchar_t * instanceName, int idleTime); static double GetC3TransitionsPerSecond(const wchar_t * instanceName, int idleTime);
static double GetC2TransitionsPerSecond(wchar_t * instanceName, int idleTime); static double GetC2TransitionsPerSecond(const wchar_t * instanceName, int idleTime);
static double GetC1TransitionsPerSecond(wchar_t * instanceName, int idleTime); static double GetC1TransitionsPerSecond(const wchar_t * instanceName, int idleTime);
static double GetC3TimePercent(wchar_t * instanceName, int idleTime); static double GetC3TimePercent(const wchar_t * instanceName, int idleTime);
static double GetC2TimePercent(wchar_t * instanceName, int idleTime); static double GetC2TimePercent(const wchar_t * instanceName, int idleTime);
static double GetC1TimePercent(wchar_t * instanceName, int idleTime); static double GetC1TimePercent(const wchar_t * instanceName, int idleTime);
static double GetIdleTimePercent(wchar_t * instanceName, int idleTime); static double GetIdleTimePercent(const wchar_t * instanceName, int idleTime);
static double GetDpcRate(wchar_t * instanceName); static double GetDpcRate(const wchar_t * instanceName);
static double GetDpcsQueuedPerSecond(wchar_t * instanceName, int idleTime); static double GetDpcsQueuedPerSecond(const wchar_t * instanceName, int idleTime);
static double GetInterruptTimePercent(wchar_t * instanceName, int idleTime); static double GetInterruptTimePercent(const wchar_t * instanceName, int idleTime);
static double GetDpcTimePercent(wchar_t * instanceName, int idleTime); static double GetDpcTimePercent(const wchar_t * instanceName, int idleTime);
static double GetInterruptsPerSecond(wchar_t * instanceName, int idleTime); static double GetInterruptsPerSecond(const wchar_t * instanceName, int idleTime);
static double GetPrivilegedTimePercent(wchar_t * instanceName, int idleTime); static double GetPrivilegedTimePercent(const wchar_t * instanceName, int idleTime);
static double GetUserTimePercent(wchar_t * instanceName, int idleTime); static double GetUserTimePercent(const wchar_t * instanceName, int idleTime);
static double GetProcessorTimePercent(wchar_t * instanceName, int idleTime); static double GetProcessorTimePercent(const wchar_t * instanceName, int idleTime);
}; };
class MONITOR_API System class MONITOR_API System

View File

@ -14,7 +14,6 @@ int _tmain(int argc, _TCHAR* argv[])
//{ //{
// wcout<<(*iter).c_str()<<endl; // wcout<<(*iter).c_str()<<endl;
//} //}
while(1) while(1)
{ {
printf("%lf\n",Memory::GetLongTermAverageStandbyCacheLifetimes()); printf("%lf\n",Memory::GetLongTermAverageStandbyCacheLifetimes());

View File

@ -2,7 +2,7 @@ package org.bench4q.monitor;
import java.io.File; import java.io.File;
import org.bench4q.monitor.probe.windows.WindowsCpuProbe; import org.bench4q.monitor.performance.windows.LogicalDiskMonitor;
public class Main { public class Main {
static { static {
@ -48,9 +48,18 @@ public class Main {
} }
public static void main(String[] args) { public static void main(String[] args) {
LogicalDiskMonitor logicalDiskMonitor = new LogicalDiskMonitor();
String[] instances = logicalDiskMonitor.getInstances();
for (String elem : instances) {
System.out.println(elem);
}
String[] counterList = logicalDiskMonitor.getCounterList();
for (String elem : counterList) {
System.out.println(elem);
}
System.out.println(logicalDiskMonitor.getFreeSpacePercent("_Total"));
MonitorServer monitorServer = new MonitorServer(5555); MonitorServer monitorServer = new MonitorServer(5555);
monitorServer.start(); monitorServer.start();
System.out.println(new WindowsCpuProbe().getCpuUsage());
} }
} }

View File

@ -0,0 +1,5 @@
package org.bench4q.monitor.performance;
public class LinuxPerformanceMonitor {
}

View File

@ -0,0 +1,5 @@
package org.bench4q.monitor.performance;
public class PerformanceMonitor {
}

View File

@ -0,0 +1,5 @@
package org.bench4q.monitor.performance;
public class WindowsPerformanceMonitor {
}

View File

@ -0,0 +1,5 @@
package org.bench4q.monitor.performance.linux;
public class CpuInfoMonitor {
// /proc/cpuinfo
}

View File

@ -0,0 +1,5 @@
package org.bench4q.monitor.performance.linux;
public class CpuStatusMonitor {
// /proc/stat
}

View File

@ -0,0 +1,5 @@
package org.bench4q.monitor.performance.linux;
public class DiskStatusMonitor {
// /proc/diskstats
}

View File

@ -0,0 +1,5 @@
package org.bench4q.monitor.performance.linux;
public class MemoryInfoMonitor {
// /proc/meminfo
}

View File

@ -0,0 +1,5 @@
package org.bench4q.monitor.performance.linux;
public class NetworkMonitor {
// /proc/net/dev
}

View File

@ -0,0 +1,68 @@
package org.bench4q.monitor.performance.windows;
public class LogicalDiskMonitor {
public native String[] getInstances();
public native String[] getCounterList();
public native double getFreeSpacePercent(String instanceName);
public native double getFreeMegabytes(String instanceName);
public native double getCurrentDiskQueueLength(String instanceName);
public native double getDiskTimePercent(String instanceName, int idleTime);
public native double getAverageDiskQueueLength(String instanceName,
int idleTime);
public native double getDiskReadTimePercent(String instanceName,
int idleTime);
public native double getAverageDiskReadQueueLength(String instanceName,
int idleTime);
public native double getDiskWriteTimePercent(String instanceName,
int idleTime);
public native double getAverageDiskWriteQueueLength(String instanceName,
int idleTime);
public native double getAverageDiskTransferTimeInSecond(
String instanceName, int idleTime);
public native double getAverageDiskReadTimeInSecond(String instanceName,
int idleTime);
public native double getAverageDiskWriteTimeInSecond(String instanceName,
int idleTime);
public native double getDiskTransfersPerSecond(String instanceName,
int idleTime);
public native double getDiskReadsPerSecond(String instanceName, int idleTime);
public native double getDiskWritesPerSecond(String instanceName,
int idleTime);
public native double getDiskBytesPerSecond(String instanceName, int idleTime);
public native double getDiskReadBytesPerSecond(String instanceName,
int idleTime);
public native double getDiskWriteBytesPerSecond(String instanceName,
int idleTime);
public native double getAverageDiskBytesPerTransfer(String instanceName,
int idleTime);
public native double getAverageDiskBytesPerRead(String instanceName,
int idleTime);
public native double getAverageDiskBytesPerWrite(String instanceName,
int idleTime);
public native double getIdleTimePercent(String instanceName, int idleTime);
public native double getSplitIOPerSecond(String instanceName, int idleTime);
}

View File

@ -0,0 +1,5 @@
package org.bench4q.monitor.performance.windows;
public class MemoryMonitor {
}

View File

@ -0,0 +1,5 @@
package org.bench4q.monitor.performance.windows;
public class NetworkInterfaceMonitor {
}

View File

@ -0,0 +1,5 @@
package org.bench4q.monitor.performance.windows;
public class PhysicalDiskMonitor {
}

View File

@ -0,0 +1,5 @@
package org.bench4q.monitor.performance.windows;
public class ProcessMonitor {
}

View File

@ -0,0 +1,5 @@
package org.bench4q.monitor.performance.windows;
public class ProcessorInformationMonitor {
}

View File

@ -0,0 +1,5 @@
package org.bench4q.monitor.performance.windows;
public class ProcessorMonitor {
}

View File

@ -0,0 +1,5 @@
package org.bench4q.monitor.performance.windows;
public class SystemMonitor {
}

View File

@ -0,0 +1,5 @@
package org.bench4q.monitor.performance.windows;
public class TcpMonitor {
}

View File

@ -0,0 +1,5 @@
package org.bench4q.monitor.performance.windows;
public class UdpMonitor {
}

View File

@ -1,5 +0,0 @@
package org.bench4q.monitor.probe;
public class CpuProbe {
}

View File

@ -1,5 +0,0 @@
package org.bench4q.monitor.probe;
public class CpuProbeInfo {
}

View File

@ -1,5 +0,0 @@
package org.bench4q.monitor.probe;
public class DiskProbe {
}

View File

@ -1,5 +0,0 @@
package org.bench4q.monitor.probe;
public class DiskProbeInfo {
}

View File

@ -1,5 +0,0 @@
package org.bench4q.monitor.probe;
public class MemoryProbe {
}

View File

@ -1,5 +0,0 @@
package org.bench4q.monitor.probe;
public class MemoryProbeInfo {
}

View File

@ -1,5 +0,0 @@
package org.bench4q.monitor.probe;
public class NetworkProbe {
}

View File

@ -1,5 +0,0 @@
package org.bench4q.monitor.probe;
public class NetworkProbeInfo {
}

View File

@ -1,5 +0,0 @@
package org.bench4q.monitor.probe.linux;
public class LinuxCpuProbe {
// /proc/stat
}

View File

@ -1,5 +0,0 @@
package org.bench4q.monitor.probe.linux;
public class LinuxCpuProbeInfo {
}

View File

@ -1,5 +0,0 @@
package org.bench4q.monitor.probe.linux;
public class LinuxDiskProbe {
// /proc/diskstats
}

View File

@ -1,5 +0,0 @@
package org.bench4q.monitor.probe.linux;
public class LinuxDiskProbeInfo {
}

View File

@ -1,5 +0,0 @@
package org.bench4q.monitor.probe.linux;
public class LinuxMemoryProbe {
// /proc/meminfo
}

View File

@ -1,5 +0,0 @@
package org.bench4q.monitor.probe.linux;
public class LinuxMemoryProbeInfo {
}

View File

@ -1,5 +0,0 @@
package org.bench4q.monitor.probe.linux;
public class LinuxNetworkProbe {
}

View File

@ -1,5 +0,0 @@
package org.bench4q.monitor.probe.linux;
public class LinuxNetworkProbeInfo {
}

View File

@ -1,5 +0,0 @@
package org.bench4q.monitor.probe.windows;
public class WindowsCpuProbe {
public native double getCpuUsage();
}

View File

@ -1,5 +0,0 @@
package org.bench4q.monitor.probe.windows;
public class WindowsCpuProbeInfo {
}

View File

@ -1,5 +0,0 @@
package org.bench4q.monitor.probe.windows;
public class WindowsDiskProbe {
// /proc/diskstats
}

View File

@ -1,5 +0,0 @@
package org.bench4q.monitor.probe.windows;
public class WindowsDiskProbeInfo {
}

View File

@ -1,5 +0,0 @@
package org.bench4q.monitor.probe.windows;
public class WindowsMemoryProbe {
// /proc/meminfo
}

View File

@ -1,5 +0,0 @@
package org.bench4q.monitor.probe.windows;
public class WindowsMemoryProbeInfo {
}

View File

@ -1,5 +0,0 @@
package org.bench4q.monitor.probe.windows;
public class WindowsNetworkProbe {
}

View File

@ -1,5 +0,0 @@
package org.bench4q.monitor.probe.windows;
public class WindowsNetworkProbeInfo {
}