diff --git a/WindowsMonitor/Native/LogicalDiskMonitor.cpp b/WindowsMonitor/Native/LogicalDiskMonitor.cpp index 9fc381a9..dc48fb1e 100644 --- a/WindowsMonitor/Native/LogicalDiskMonitor.cpp +++ b/WindowsMonitor/Native/LogicalDiskMonitor.cpp @@ -1,7 +1,5 @@ #include "stdafx.h" #include "LogicalDiskMonitor.h" -#include -using namespace std; JNIEXPORT jobjectArray JNICALL Java_org_bench4q_monitor_performance_windows_LogicalDiskMonitor_getInstances (JNIEnv * environment, jobject object) diff --git a/WindowsMonitor/Native/MemoryMonitor.cpp b/WindowsMonitor/Native/MemoryMonitor.cpp new file mode 100644 index 00000000..bda16258 --- /dev/null +++ b/WindowsMonitor/Native/MemoryMonitor.cpp @@ -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 counterList=Memory::GetCounterList(); + list::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(); +} \ No newline at end of file diff --git a/WindowsMonitor/Native/MemoryMonitor.h b/WindowsMonitor/Native/MemoryMonitor.h new file mode 100644 index 00000000..b5b9c5ec --- /dev/null +++ b/WindowsMonitor/Native/MemoryMonitor.h @@ -0,0 +1,309 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* 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 diff --git a/WindowsMonitor/Native/Native.vcxproj b/WindowsMonitor/Native/Native.vcxproj index 1608de48..125bb07b 100644 --- a/WindowsMonitor/Native/Native.vcxproj +++ b/WindowsMonitor/Native/Native.vcxproj @@ -147,6 +147,7 @@ + @@ -167,6 +168,7 @@ + Create Create diff --git a/WindowsMonitor/Native/Native.vcxproj.filters b/WindowsMonitor/Native/Native.vcxproj.filters index 91746d1f..a00e5b87 100644 --- a/WindowsMonitor/Native/Native.vcxproj.filters +++ b/WindowsMonitor/Native/Native.vcxproj.filters @@ -27,6 +27,9 @@ 头文件 + + 头文件 + @@ -38,5 +41,8 @@ 源文件 + + 源文件 + \ No newline at end of file diff --git a/src/main/java/org/bench4q/monitor/Main.java b/src/main/java/org/bench4q/monitor/Main.java index 5652ca98..de4cf99f 100644 --- a/src/main/java/org/bench4q/monitor/Main.java +++ b/src/main/java/org/bench4q/monitor/Main.java @@ -3,6 +3,7 @@ package org.bench4q.monitor; import java.io.File; import org.bench4q.monitor.performance.windows.LogicalDiskMonitor; +import org.bench4q.monitor.performance.windows.MemoryMonitor; public class Main { static { @@ -58,6 +59,14 @@ public class Main { System.out.println(elem); } 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.start(); } diff --git a/src/main/java/org/bench4q/monitor/performance/windows/MemoryMonitor.java b/src/main/java/org/bench4q/monitor/performance/windows/MemoryMonitor.java index 08715d6f..05297686 100644 --- a/src/main/java/org/bench4q/monitor/performance/windows/MemoryMonitor.java +++ b/src/main/java/org/bench4q/monitor/performance/windows/MemoryMonitor.java @@ -1,5 +1,78 @@ package org.bench4q.monitor.performance.windows; 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(); }