jni adapter for memory monitor added.

This commit is contained in:
Zhen Tang 2013-07-08 00:50:14 +08:00
parent 3e21bca0da
commit 4774e2379a
7 changed files with 635 additions and 2 deletions

View File

@ -1,7 +1,5 @@
#include "stdafx.h" #include "stdafx.h"
#include "LogicalDiskMonitor.h" #include "LogicalDiskMonitor.h"
#include <iostream>
using namespace std;
JNIEXPORT jobjectArray JNICALL Java_org_bench4q_monitor_performance_windows_LogicalDiskMonitor_getInstances JNIEXPORT jobjectArray JNICALL Java_org_bench4q_monitor_performance_windows_LogicalDiskMonitor_getInstances
(JNIEnv * environment, jobject object) (JNIEnv * environment, jobject object)

View File

@ -0,0 +1,236 @@
#include "stdafx.h"
#include "MemoryMonitor.h"
JNIEXPORT jobjectArray JNICALL Java_org_bench4q_monitor_performance_windows_MemoryMonitor_getCounterList
(JNIEnv * environment, jobject object)
{
list<wstring> counterList=Memory::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_MemoryMonitor_getPageFaultsPerSecond
(JNIEnv * environment, jobject object, jint idleTime)
{
return Memory::GetPageFaultsPerSecond(idleTime);
}
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_MemoryMonitor_getAvailableBytes
(JNIEnv * environment, jobject object)
{
return Memory::GetAvailableBytes();
}
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_MemoryMonitor_getCommittedBytes
(JNIEnv * environment, jobject object)
{
return Memory::GetCommittedBytes();
}
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_MemoryMonitor_getCommitLimit
(JNIEnv * environment, jobject object)
{
return Memory::GetCommitLimit();
}
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_MemoryMonitor_getWriteCopiesPerSecond
(JNIEnv * environment, jobject object, jint idleTime)
{
return Memory::GetWriteCopiesPerSecond(idleTime);
}
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_MemoryMonitor_getTransitionFaultsPerSecond
(JNIEnv * environment, jobject object, jint idleTime)
{
return Memory::GetTransitionFaultsPerSecond(idleTime);
}
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_MemoryMonitor_getCacheFaultsPerSecond
(JNIEnv * environment, jobject object, jint idleTime)
{
return Memory::GetCacheFaultsPerSecond(idleTime);
}
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_MemoryMonitor_getDemandZeroFaultsPerSecond
(JNIEnv * environment, jobject object, jint idleTime)
{
return Memory::GetDemandZeroFaultsPerSecond(idleTime);
}
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_MemoryMonitor_getPagesPerSecond
(JNIEnv * environment, jobject object, jint idleTime)
{
return Memory::GetPagesPerSecond(idleTime);
}
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_MemoryMonitor_getPagesInputPerSecond
(JNIEnv * environment, jobject object, jint idleTime)
{
return Memory::GetPagesInputPerSecond(idleTime);
}
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_MemoryMonitor_getPageReadsPerSecond
(JNIEnv * environment, jobject object, jint idleTime)
{
return Memory::GetPageReadsPerSecond(idleTime);
}
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_MemoryMonitor_getPagesOutputPerSecond
(JNIEnv * environment, jobject object, jint idleTime)
{
return Memory::GetPagesOutputPerSecond(idleTime);
}
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_MemoryMonitor_getPoolPagedBytes
(JNIEnv * environment, jobject object)
{
return Memory::GetPoolPagedBytes();
}
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_MemoryMonitor_getPoolNonpagedBytes
(JNIEnv * environment, jobject object)
{
return Memory::GetPoolNonpagedBytes();
}
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_MemoryMonitor_getPageWritesPerSecond
(JNIEnv * environment, jobject object, jint idleTime)
{
return Memory::GetPageWritesPerSecond(idleTime);
}
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_MemoryMonitor_getPoolPagedAllocs
(JNIEnv * environment, jobject object)
{
return Memory::GetPoolPagedAllocs();
}
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_MemoryMonitor_getPoolNonpagedAllocs
(JNIEnv * environment, jobject object)
{
return Memory::GetPoolNonpagedAllocs();
}
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_MemoryMonitor_getFreeSystemPageTableEntries
(JNIEnv * environment, jobject object)
{
return Memory::GetFreeSystemPageTableEntries();
}
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_MemoryMonitor_getCacheBytes
(JNIEnv * environment, jobject object)
{
return Memory::GetCacheBytes();
}
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_MemoryMonitor_getCacheBytesPeak
(JNIEnv * environment, jobject object)
{
return Memory::GetCacheBytesPeak();
}
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_MemoryMonitor_getPoolPagedResidentBytes
(JNIEnv * environment, jobject object)
{
return Memory::GetPoolPagedResidentBytes();
}
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_MemoryMonitor_getSystemCodeTotalBytes
(JNIEnv * environment, jobject object)
{
return Memory::GetSystemCodeTotalBytes();
}
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_MemoryMonitor_getSystemCodeResidentBytes
(JNIEnv * environment, jobject object)
{
return Memory::GetSystemCodeResidentBytes();
}
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_MemoryMonitor_getSystemDriverTotalBytes
(JNIEnv * environment, jobject object)
{
return Memory::GetSystemDriverTotalBytes();
}
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_MemoryMonitor_getSystemDriverResidentBytes
(JNIEnv * environment, jobject object)
{
return Memory::GetSystemDriverResidentBytes();
}
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_MemoryMonitor_getSystemCacheResidentBytes
(JNIEnv * environment, jobject object)
{
return Memory::GetSystemCacheResidentBytes();
}
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_MemoryMonitor_getCommittedBytesInUsePercent
(JNIEnv * environment, jobject object)
{
return Memory::GetCommittedBytesInUsePercent();
}
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_MemoryMonitor_getAvailableKiloBytes
(JNIEnv * environment, jobject object)
{
return Memory::GetAvailableKiloBytes();
}
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_MemoryMonitor_getAvailableMegaBytes
(JNIEnv * environment, jobject object)
{
return Memory::GetAvailableMegaBytes();
}
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_MemoryMonitor_getTransitionPagesRepurposedPerSecond
(JNIEnv * environment, jobject object, jint idleTime)
{
return Memory::GetTransitionPagesRepurposedPerSecond(idleTime);
}
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_MemoryMonitor_getFreeAndZeroPageListBytes
(JNIEnv * environment, jobject object)
{
return Memory::GetFreeAndZeroPageListBytes();
}
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_MemoryMonitor_getModifiedPageListBytes
(JNIEnv * environment, jobject object)
{
return Memory::GetModifiedPageListBytes();
}
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_MemoryMonitor_getStandbyCacheReserveBytes
(JNIEnv * environment, jobject object)
{
return Memory::GetStandbyCacheReserveBytes();
}
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_MemoryMonitor_getStandbyCacheNormalPriorityBytes
(JNIEnv * environment, jobject object)
{
return Memory::GetStandbyCacheNormalPriorityBytes();
}
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_MemoryMonitor_getStandbyCacheCoreBytes
(JNIEnv * environment, jobject object)
{
return Memory::GetStandbyCacheCoreBytes();
}
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_MemoryMonitor_getLongTermAverageStandbyCacheLifetimes
(JNIEnv * environment, jobject object)
{
return Memory::GetLongTermAverageStandbyCacheLifetimes();
}

View File

@ -0,0 +1,309 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_bench4q_monitor_performance_windows_MemoryMonitor */
#ifndef _Included_org_bench4q_monitor_performance_windows_MemoryMonitor
#define _Included_org_bench4q_monitor_performance_windows_MemoryMonitor
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: org_bench4q_monitor_performance_windows_MemoryMonitor
* Method: getCounterList
* Signature: ()[Ljava/lang/String;
*/
JNIEXPORT jobjectArray JNICALL Java_org_bench4q_monitor_performance_windows_MemoryMonitor_getCounterList
(JNIEnv *, jobject);
/*
* Class: org_bench4q_monitor_performance_windows_MemoryMonitor
* Method: getPageFaultsPerSecond
* Signature: (I)D
*/
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_MemoryMonitor_getPageFaultsPerSecond
(JNIEnv *, jobject, jint);
/*
* Class: org_bench4q_monitor_performance_windows_MemoryMonitor
* Method: getAvailableBytes
* Signature: ()D
*/
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_MemoryMonitor_getAvailableBytes
(JNIEnv *, jobject);
/*
* Class: org_bench4q_monitor_performance_windows_MemoryMonitor
* Method: getCommittedBytes
* Signature: ()D
*/
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_MemoryMonitor_getCommittedBytes
(JNIEnv *, jobject);
/*
* Class: org_bench4q_monitor_performance_windows_MemoryMonitor
* Method: getCommitLimit
* Signature: ()D
*/
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_MemoryMonitor_getCommitLimit
(JNIEnv *, jobject);
/*
* Class: org_bench4q_monitor_performance_windows_MemoryMonitor
* Method: getWriteCopiesPerSecond
* Signature: (I)D
*/
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_MemoryMonitor_getWriteCopiesPerSecond
(JNIEnv *, jobject, jint);
/*
* Class: org_bench4q_monitor_performance_windows_MemoryMonitor
* Method: getTransitionFaultsPerSecond
* Signature: (I)D
*/
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_MemoryMonitor_getTransitionFaultsPerSecond
(JNIEnv *, jobject, jint);
/*
* Class: org_bench4q_monitor_performance_windows_MemoryMonitor
* Method: getCacheFaultsPerSecond
* Signature: (I)D
*/
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_MemoryMonitor_getCacheFaultsPerSecond
(JNIEnv *, jobject, jint);
/*
* Class: org_bench4q_monitor_performance_windows_MemoryMonitor
* Method: getDemandZeroFaultsPerSecond
* Signature: (I)D
*/
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_MemoryMonitor_getDemandZeroFaultsPerSecond
(JNIEnv *, jobject, jint);
/*
* Class: org_bench4q_monitor_performance_windows_MemoryMonitor
* Method: getPagesPerSecond
* Signature: (I)D
*/
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_MemoryMonitor_getPagesPerSecond
(JNIEnv *, jobject, jint);
/*
* Class: org_bench4q_monitor_performance_windows_MemoryMonitor
* Method: getPagesInputPerSecond
* Signature: (I)D
*/
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_MemoryMonitor_getPagesInputPerSecond
(JNIEnv *, jobject, jint);
/*
* Class: org_bench4q_monitor_performance_windows_MemoryMonitor
* Method: getPageReadsPerSecond
* Signature: (I)D
*/
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_MemoryMonitor_getPageReadsPerSecond
(JNIEnv *, jobject, jint);
/*
* Class: org_bench4q_monitor_performance_windows_MemoryMonitor
* Method: getPagesOutputPerSecond
* Signature: (I)D
*/
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_MemoryMonitor_getPagesOutputPerSecond
(JNIEnv *, jobject, jint);
/*
* Class: org_bench4q_monitor_performance_windows_MemoryMonitor
* Method: getPoolPagedBytes
* Signature: ()D
*/
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_MemoryMonitor_getPoolPagedBytes
(JNIEnv *, jobject);
/*
* Class: org_bench4q_monitor_performance_windows_MemoryMonitor
* Method: getPoolNonpagedBytes
* Signature: ()D
*/
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_MemoryMonitor_getPoolNonpagedBytes
(JNIEnv *, jobject);
/*
* Class: org_bench4q_monitor_performance_windows_MemoryMonitor
* Method: getPageWritesPerSecond
* Signature: (I)D
*/
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_MemoryMonitor_getPageWritesPerSecond
(JNIEnv *, jobject, jint);
/*
* Class: org_bench4q_monitor_performance_windows_MemoryMonitor
* Method: getPoolPagedAllocs
* Signature: ()D
*/
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_MemoryMonitor_getPoolPagedAllocs
(JNIEnv *, jobject);
/*
* Class: org_bench4q_monitor_performance_windows_MemoryMonitor
* Method: getPoolNonpagedAllocs
* Signature: ()D
*/
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_MemoryMonitor_getPoolNonpagedAllocs
(JNIEnv *, jobject);
/*
* Class: org_bench4q_monitor_performance_windows_MemoryMonitor
* Method: getFreeSystemPageTableEntries
* Signature: ()D
*/
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_MemoryMonitor_getFreeSystemPageTableEntries
(JNIEnv *, jobject);
/*
* Class: org_bench4q_monitor_performance_windows_MemoryMonitor
* Method: getCacheBytes
* Signature: ()D
*/
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_MemoryMonitor_getCacheBytes
(JNIEnv *, jobject);
/*
* Class: org_bench4q_monitor_performance_windows_MemoryMonitor
* Method: getCacheBytesPeak
* Signature: ()D
*/
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_MemoryMonitor_getCacheBytesPeak
(JNIEnv *, jobject);
/*
* Class: org_bench4q_monitor_performance_windows_MemoryMonitor
* Method: getPoolPagedResidentBytes
* Signature: ()D
*/
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_MemoryMonitor_getPoolPagedResidentBytes
(JNIEnv *, jobject);
/*
* Class: org_bench4q_monitor_performance_windows_MemoryMonitor
* Method: getSystemCodeTotalBytes
* Signature: ()D
*/
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_MemoryMonitor_getSystemCodeTotalBytes
(JNIEnv *, jobject);
/*
* Class: org_bench4q_monitor_performance_windows_MemoryMonitor
* Method: getSystemCodeResidentBytes
* Signature: ()D
*/
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_MemoryMonitor_getSystemCodeResidentBytes
(JNIEnv *, jobject);
/*
* Class: org_bench4q_monitor_performance_windows_MemoryMonitor
* Method: getSystemDriverTotalBytes
* Signature: ()D
*/
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_MemoryMonitor_getSystemDriverTotalBytes
(JNIEnv *, jobject);
/*
* Class: org_bench4q_monitor_performance_windows_MemoryMonitor
* Method: getSystemDriverResidentBytes
* Signature: ()D
*/
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_MemoryMonitor_getSystemDriverResidentBytes
(JNIEnv *, jobject);
/*
* Class: org_bench4q_monitor_performance_windows_MemoryMonitor
* Method: getSystemCacheResidentBytes
* Signature: ()D
*/
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_MemoryMonitor_getSystemCacheResidentBytes
(JNIEnv *, jobject);
/*
* Class: org_bench4q_monitor_performance_windows_MemoryMonitor
* Method: getCommittedBytesInUsePercent
* Signature: ()D
*/
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_MemoryMonitor_getCommittedBytesInUsePercent
(JNIEnv *, jobject);
/*
* Class: org_bench4q_monitor_performance_windows_MemoryMonitor
* Method: getAvailableKiloBytes
* Signature: ()D
*/
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_MemoryMonitor_getAvailableKiloBytes
(JNIEnv *, jobject);
/*
* Class: org_bench4q_monitor_performance_windows_MemoryMonitor
* Method: getAvailableMegaBytes
* Signature: ()D
*/
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_MemoryMonitor_getAvailableMegaBytes
(JNIEnv *, jobject);
/*
* Class: org_bench4q_monitor_performance_windows_MemoryMonitor
* Method: getTransitionPagesRepurposedPerSecond
* Signature: (I)D
*/
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_MemoryMonitor_getTransitionPagesRepurposedPerSecond
(JNIEnv *, jobject, jint);
/*
* Class: org_bench4q_monitor_performance_windows_MemoryMonitor
* Method: getFreeAndZeroPageListBytes
* Signature: ()D
*/
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_MemoryMonitor_getFreeAndZeroPageListBytes
(JNIEnv *, jobject);
/*
* Class: org_bench4q_monitor_performance_windows_MemoryMonitor
* Method: getModifiedPageListBytes
* Signature: ()D
*/
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_MemoryMonitor_getModifiedPageListBytes
(JNIEnv *, jobject);
/*
* Class: org_bench4q_monitor_performance_windows_MemoryMonitor
* Method: getStandbyCacheReserveBytes
* Signature: ()D
*/
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_MemoryMonitor_getStandbyCacheReserveBytes
(JNIEnv *, jobject);
/*
* Class: org_bench4q_monitor_performance_windows_MemoryMonitor
* Method: getStandbyCacheNormalPriorityBytes
* Signature: ()D
*/
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_MemoryMonitor_getStandbyCacheNormalPriorityBytes
(JNIEnv *, jobject);
/*
* Class: org_bench4q_monitor_performance_windows_MemoryMonitor
* Method: getStandbyCacheCoreBytes
* Signature: ()D
*/
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_MemoryMonitor_getStandbyCacheCoreBytes
(JNIEnv *, jobject);
/*
* Class: org_bench4q_monitor_performance_windows_MemoryMonitor
* Method: getLongTermAverageStandbyCacheLifetimes
* Signature: ()D
*/
JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_MemoryMonitor_getLongTermAverageStandbyCacheLifetimes
(JNIEnv *, jobject);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -147,6 +147,7 @@
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="LogicalDiskMonitor.h" /> <ClInclude Include="LogicalDiskMonitor.h" />
<ClInclude Include="MemoryMonitor.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" />
@ -167,6 +168,7 @@
</PrecompiledHeader> </PrecompiledHeader>
</ClCompile> </ClCompile>
<ClCompile Include="LogicalDiskMonitor.cpp" /> <ClCompile Include="LogicalDiskMonitor.cpp" />
<ClCompile Include="MemoryMonitor.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

@ -27,6 +27,9 @@
<ClInclude Include="LogicalDiskMonitor.h"> <ClInclude Include="LogicalDiskMonitor.h">
<Filter>头文件</Filter> <Filter>头文件</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="MemoryMonitor.h">
<Filter>头文件</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="stdafx.cpp"> <ClCompile Include="stdafx.cpp">
@ -38,5 +41,8 @@
<ClCompile Include="LogicalDiskMonitor.cpp"> <ClCompile Include="LogicalDiskMonitor.cpp">
<Filter>源文件</Filter> <Filter>源文件</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="MemoryMonitor.cpp">
<Filter>源文件</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -3,6 +3,7 @@ package org.bench4q.monitor;
import java.io.File; import java.io.File;
import org.bench4q.monitor.performance.windows.LogicalDiskMonitor; import org.bench4q.monitor.performance.windows.LogicalDiskMonitor;
import org.bench4q.monitor.performance.windows.MemoryMonitor;
public class Main { public class Main {
static { static {
@ -58,6 +59,14 @@ public class Main {
System.out.println(elem); System.out.println(elem);
} }
System.out.println(logicalDiskMonitor.getFreeMegabytes("_Total")); System.out.println(logicalDiskMonitor.getFreeMegabytes("_Total"));
MemoryMonitor memoryMonitor=new MemoryMonitor();
String[] list=memoryMonitor.getCounterList();
for (String elem : list) {
System.out.println(elem);
}
System.out.println(memoryMonitor.getAvailableBytes());
System.out.println(memoryMonitor.getAvailableKiloBytes());
System.out.println(memoryMonitor.getAvailableMegaBytes());
MonitorServer monitorServer = new MonitorServer(5555); MonitorServer monitorServer = new MonitorServer(5555);
monitorServer.start(); monitorServer.start();
} }

View File

@ -1,5 +1,78 @@
package org.bench4q.monitor.performance.windows; package org.bench4q.monitor.performance.windows;
public class MemoryMonitor { public class MemoryMonitor {
public native String[] getCounterList();
public native double getPageFaultsPerSecond(int idleTime);
public native double getAvailableBytes();
public native double getCommittedBytes();
public native double getCommitLimit();
public native double getWriteCopiesPerSecond(int idleTime);
public native double getTransitionFaultsPerSecond(int idleTime);
public native double getCacheFaultsPerSecond(int idleTime);
public native double getDemandZeroFaultsPerSecond(int idleTime);
public native double getPagesPerSecond(int idleTime);
public native double getPagesInputPerSecond(int idleTime);
public native double getPageReadsPerSecond(int idleTime);
public native double getPagesOutputPerSecond(int idleTime);
public native double getPoolPagedBytes();
public native double getPoolNonpagedBytes();
public native double getPageWritesPerSecond(int idleTime);
public native double getPoolPagedAllocs();
public native double getPoolNonpagedAllocs();
public native double getFreeSystemPageTableEntries();
public native double getCacheBytes();
public native double getCacheBytesPeak();
public native double getPoolPagedResidentBytes();
public native double getSystemCodeTotalBytes();
public native double getSystemCodeResidentBytes();
public native double getSystemDriverTotalBytes();
public native double getSystemDriverResidentBytes();
public native double getSystemCacheResidentBytes();
public native double getCommittedBytesInUsePercent();
public native double getAvailableKiloBytes();
public native double getAvailableMegaBytes();
public native double getTransitionPagesRepurposedPerSecond(int idleTime);
public native double getFreeAndZeroPageListBytes();
public native double getModifiedPageListBytes();
public native double getStandbyCacheReserveBytes();
public native double getStandbyCacheNormalPriorityBytes();
public native double getStandbyCacheCoreBytes();
public native double getLongTermAverageStandbyCacheLifetimes();
} }