From 0653718a7ea859ed55c4f27a75e9534195e3e935 Mon Sep 17 00:00:00 2001
From: fanfuxiaoran <495538672@qq.com>
Date: Mon, 12 Aug 2013 14:00:04 +0800
Subject: [PATCH] add /Native/SystrmMonitor
---
WindowsMonitor/Native/Native.vcxproj | 405 +++++++++---------
WindowsMonitor/Native/Native.vcxproj.filters | 9 +
WindowsMonitor/Native/SystemMonitor.cpp | 36 ++
WindowsMonitor/Native/SystemMonitor.h | 24 ++
.../performance/windows/SystemMonitor.java | 11 +-
5 files changed, 279 insertions(+), 206 deletions(-)
create mode 100644 WindowsMonitor/Native/SystemMonitor.cpp
create mode 100644 WindowsMonitor/Native/SystemMonitor.h
diff --git a/WindowsMonitor/Native/Native.vcxproj b/WindowsMonitor/Native/Native.vcxproj
index 77f5094a..b95b45ad 100644
--- a/WindowsMonitor/Native/Native.vcxproj
+++ b/WindowsMonitor/Native/Native.vcxproj
@@ -1,202 +1,205 @@
-
-
-
-
- Debug
- Win32
-
-
- Debug
- x64
-
-
- Release
- Win32
-
-
- Release
- x64
-
-
-
- {286E6C20-9603-4870-BD34-FF54406AE1DC}
- Win32Proj
- Native
-
-
-
- DynamicLibrary
- true
- v110
- Unicode
-
-
- DynamicLibrary
- true
- v110
- Unicode
-
-
- DynamicLibrary
- false
- v110
- true
- Unicode
-
-
- DynamicLibrary
- false
- v110
- true
- Unicode
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- true
-
-
- true
- AllRules.ruleset
- true
-
-
- false
-
-
- false
-
-
-
- Use
- Level3
- Disabled
- WIN32;_DEBUG;_WINDOWS;_USRDLL;NATIVE_EXPORTS;%(PreprocessorDefinitions)
- true
- $(JAVA_HOME)/include/win32;$(JAVA_HOME)/include;%(AdditionalIncludeDirectories)
-
-
- Windows
- true
-
-
-
-
- Use
- Level3
- Disabled
- WIN32;_DEBUG;_WINDOWS;_USRDLL;NATIVE_EXPORTS;%(PreprocessorDefinitions)
- true
- $(JAVA_HOME)/include/win32;$(JAVA_HOME)/include;%(AdditionalIncludeDirectories)
- true
-
-
- Windows
- true
-
-
-
-
- Level3
- Use
- MaxSpeed
- true
- true
- WIN32;NDEBUG;_WINDOWS;_USRDLL;NATIVE_EXPORTS;%(PreprocessorDefinitions)
- true
- $(JAVA_HOME)/include/win32;$(JAVA_HOME)/include;%(AdditionalIncludeDirectories)
-
-
- Windows
- true
- true
- true
-
-
-
-
- Level3
- Use
- MaxSpeed
- true
- true
- WIN32;NDEBUG;_WINDOWS;_USRDLL;NATIVE_EXPORTS;%(PreprocessorDefinitions)
- true
- $(JAVA_HOME)/include/win32;$(JAVA_HOME)/include;%(AdditionalIncludeDirectories)
-
-
- Windows
- true
- true
- true
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- false
- false
-
-
-
-
- false
- false
-
-
-
-
-
-
-
-
-
-
-
-
-
- Create
- Create
- Create
- Create
-
-
-
-
-
-
-
-
-
+
+
+
+
+ Debug
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ Win32
+
+
+ Release
+ x64
+
+
+
+ {286E6C20-9603-4870-BD34-FF54406AE1DC}
+ Win32Proj
+ Native
+
+
+
+ DynamicLibrary
+ true
+ v110
+ Unicode
+
+
+ DynamicLibrary
+ true
+ v110
+ Unicode
+
+
+ DynamicLibrary
+ false
+ v110
+ true
+ Unicode
+
+
+ DynamicLibrary
+ false
+ v110
+ true
+ Unicode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+ true
+ AllRules.ruleset
+ true
+
+
+ false
+
+
+ false
+
+
+
+ Use
+ Level3
+ Disabled
+ WIN32;_DEBUG;_WINDOWS;_USRDLL;NATIVE_EXPORTS;%(PreprocessorDefinitions)
+ true
+ $(JAVA_HOME)/include/win32;$(JAVA_HOME)/include;%(AdditionalIncludeDirectories)
+
+
+ Windows
+ true
+
+
+
+
+ Use
+ Level3
+ Disabled
+ WIN32;_DEBUG;_WINDOWS;_USRDLL;NATIVE_EXPORTS;%(PreprocessorDefinitions)
+ true
+ $(JAVA_HOME)/include/win32;$(JAVA_HOME)/include;%(AdditionalIncludeDirectories)
+ true
+
+
+ Windows
+ true
+
+
+
+
+ Level3
+ Use
+ MaxSpeed
+ true
+ true
+ WIN32;NDEBUG;_WINDOWS;_USRDLL;NATIVE_EXPORTS;%(PreprocessorDefinitions)
+ true
+ $(JAVA_HOME)/include/win32;$(JAVA_HOME)/include;%(AdditionalIncludeDirectories)
+
+
+ Windows
+ true
+ true
+ true
+
+
+
+
+ Level3
+ Use
+ MaxSpeed
+ true
+ true
+ WIN32;NDEBUG;_WINDOWS;_USRDLL;NATIVE_EXPORTS;%(PreprocessorDefinitions)
+ true
+ $(JAVA_HOME)/include/win32;$(JAVA_HOME)/include;%(AdditionalIncludeDirectories)
+
+
+ Windows
+ true
+ true
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ false
+ false
+
+
+
+
+ false
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Create
+ Create
+ Create
+ Create
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/WindowsMonitor/Native/Native.vcxproj.filters b/WindowsMonitor/Native/Native.vcxproj.filters
index 3f4a1575..9e5cf821 100644
--- a/WindowsMonitor/Native/Native.vcxproj.filters
+++ b/WindowsMonitor/Native/Native.vcxproj.filters
@@ -60,6 +60,12 @@
头文件
+
+ 头文件
+
+
+ 头文件
+
@@ -104,5 +110,8 @@
源文件
+
+ 源文件
+
\ No newline at end of file
diff --git a/WindowsMonitor/Native/SystemMonitor.cpp b/WindowsMonitor/Native/SystemMonitor.cpp
new file mode 100644
index 00000000..46cbacfb
--- /dev/null
+++ b/WindowsMonitor/Native/SystemMonitor.cpp
@@ -0,0 +1,36 @@
+#include "stdafx.h"
+#include "SystemMonitor.h"
+#include "Common.h"
+
+JNIEXPORT jobjectArray JNICALL Java_org_bench4q_monitor_performance_windows_SystemMonitor_getCounterList
+ (JNIEnv * environment, jobject object)
+{
+ list counterList=System::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(GetUTF8String((*iter).c_str())));
+ i++;
+ }
+ return array;
+}
+
+JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_SystemMonitor_GetFileDataOperationsPerSecond
+ (JNIEnv * environment, jobject object, jint idleTime)
+{
+ return System::GetFileDataOperationsPerSecond(idleTime);
+}
+
+
+
+JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_SystemMonitor_GetProcessorQueueLength
+ (JNIEnv * environment, jobject object)
+{
+ return System::GetProcessorQueueLength();
+}
+
diff --git a/WindowsMonitor/Native/SystemMonitor.h b/WindowsMonitor/Native/SystemMonitor.h
new file mode 100644
index 00000000..74d84081
--- /dev/null
+++ b/WindowsMonitor/Native/SystemMonitor.h
@@ -0,0 +1,24 @@
+#include
+/* Header for class org_bench4q_monitor_performance_windows_TCPv4Monitor */
+
+#ifndef _Included_org_bench4q_monitor_performance_windows_SystemMonitor
+#define _Included_org_bench4q_monitor_performance_windows_SystemMonitor
+#ifdef __cplusplus
+extern "C" {
+#endif
+ JNIEXPORT jobjectArray JNICALL Java_org_bench4q_monitor_performance_windows_SystemMonitor_getCounterList
+ (JNIEnv * environment, jobject object);
+
+
+JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_SystemMonitor_GetFileDataOperationsPerSecond
+ (JNIEnv * environment, jobject object, jint idleTime);
+
+
+
+JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_SystemMonitor_GetProcessorQueueLength
+ (JNIEnv * environment, jobject object);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
\ No newline at end of file
diff --git a/src/main/java/org/bench4q/monitor/performance/windows/SystemMonitor.java b/src/main/java/org/bench4q/monitor/performance/windows/SystemMonitor.java
index 03130bc2..e872366d 100644
--- a/src/main/java/org/bench4q/monitor/performance/windows/SystemMonitor.java
+++ b/src/main/java/org/bench4q/monitor/performance/windows/SystemMonitor.java
@@ -3,7 +3,7 @@ package org.bench4q.monitor.performance.windows;
public class SystemMonitor {
public native String[] getCounterList();
- public native double getFileReadOperationsPerSecond(int idleTime);
+ /*public native double getFileReadOperationsPerSecond(int idleTime);
public native double getFileWriteOperationsPerSecond(int idleTime);
@@ -17,14 +17,15 @@ public class SystemMonitor {
public native double getContextSwitchesPerSecond(int idleTime);
- public native double getSystemCallsPerSecond(int idleTime);
+ public native double getSystemCallsPerSecond(int idleTime);*/
public native double getFileDataOperationsPerSecond(int idleTime);
- public native double getSystemUpTime();
-
public native double getProcessorQueueLength();
+ /*public native double getSystemUpTime();
+
+
public native double getProcessesCount();
public native double getThreadsCount();
@@ -35,5 +36,5 @@ public class SystemMonitor {
public native double getFloatingEmulationsPerSecond(int idleTime);
- public native double getRegistryQuotaInUsePercent();
+ public native double getRegistryQuotaInUsePercent();*/
}