diff --git a/WindowsMonitor/Native/Native.vcxproj b/WindowsMonitor/Native/Native.vcxproj
index 3f25a807..f434d765 100644
--- a/WindowsMonitor/Native/Native.vcxproj
+++ b/WindowsMonitor/Native/Native.vcxproj
@@ -156,6 +156,8 @@
+
+
@@ -185,6 +187,8 @@
+
+
diff --git a/WindowsMonitor/Native/Native.vcxproj.filters b/WindowsMonitor/Native/Native.vcxproj.filters
index 1c1b3828..6189073d 100644
--- a/WindowsMonitor/Native/Native.vcxproj.filters
+++ b/WindowsMonitor/Native/Native.vcxproj.filters
@@ -45,6 +45,12 @@
头文件
+
+ 头文件
+
+
+ 头文件
+
@@ -74,5 +80,11 @@
源文件
+
+ 源文件
+
+
+ 源文件
+
\ No newline at end of file
diff --git a/WindowsMonitor/Native/UDPv4Monitor.cpp b/WindowsMonitor/Native/UDPv4Monitor.cpp
new file mode 100644
index 00000000..ed04310e
--- /dev/null
+++ b/WindowsMonitor/Native/UDPv4Monitor.cpp
@@ -0,0 +1,51 @@
+#include "stdafx.h"
+#include "UDPv4Monitor.h"
+#include "Common.h"
+
+JNIEXPORT jobjectArray JNICALL Java_org_bench4q_monitor_performance_windows_UDPv4Monitor_getCounterList
+ (JNIEnv * environment, jobject object)
+{
+ list counterList=UDPv4::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_UDPv4Monitor_getDatagramsPerSecond
+ (JNIEnv * environment, jobject object, jint idleTime)
+{
+ return UDPv4::GetDatagramsPerSecond(idleTime);
+}
+
+JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_UDPv4Monitor_getDatagramsReceivedPerSecond
+ (JNIEnv * environment, jobject object, jint idleTime)
+{
+ return UDPv4::GetDatagramsReceivedPerSecond(idleTime);
+}
+
+JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_UDPv4Monitor_getDatagramsNoPortPerSecond
+ (JNIEnv * environment, jobject object, jint idleTime)
+{
+ return UDPv4::GetDatagramsNoPortPerSecond(idleTime);
+}
+
+JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_UDPv4Monitor_getDatagramsReceivedErrors
+ (JNIEnv * environment, jobject object)
+{
+ return UDPv4::GetDatagramsReceivedErrors();
+}
+
+JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_UDPv4Monitor_getDatagramsSentPerSecond
+ (JNIEnv * environment, jobject object, jint idleTime)
+{
+ return UDPv4::GetDatagramsSentPerSecond(idleTime);
+}
diff --git a/WindowsMonitor/Native/UDPv4Monitor.h b/WindowsMonitor/Native/UDPv4Monitor.h
new file mode 100644
index 00000000..e85c4989
--- /dev/null
+++ b/WindowsMonitor/Native/UDPv4Monitor.h
@@ -0,0 +1,61 @@
+/* DO NOT EDIT THIS FILE - it is machine generated */
+#include
+/* Header for class org_bench4q_monitor_performance_windows_UDPv4Monitor */
+
+#ifndef _Included_org_bench4q_monitor_performance_windows_UDPv4Monitor
+#define _Included_org_bench4q_monitor_performance_windows_UDPv4Monitor
+#ifdef __cplusplus
+extern "C" {
+#endif
+ /*
+ * Class: org_bench4q_monitor_performance_windows_UDPv4Monitor
+ * Method: getCounterList
+ * Signature: ()[Ljava/lang/String;
+ */
+ JNIEXPORT jobjectArray JNICALL Java_org_bench4q_monitor_performance_windows_UDPv4Monitor_getCounterList
+ (JNIEnv *, jobject);
+
+ /*
+ * Class: org_bench4q_monitor_performance_windows_UDPv4Monitor
+ * Method: getDatagramsPerSecond
+ * Signature: (I)D
+ */
+ JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_UDPv4Monitor_getDatagramsPerSecond
+ (JNIEnv *, jobject, jint);
+
+ /*
+ * Class: org_bench4q_monitor_performance_windows_UDPv4Monitor
+ * Method: getDatagramsReceivedPerSecond
+ * Signature: (I)D
+ */
+ JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_UDPv4Monitor_getDatagramsReceivedPerSecond
+ (JNIEnv *, jobject, jint);
+
+ /*
+ * Class: org_bench4q_monitor_performance_windows_UDPv4Monitor
+ * Method: getDatagramsNoPortPerSecond
+ * Signature: (I)D
+ */
+ JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_UDPv4Monitor_getDatagramsNoPortPerSecond
+ (JNIEnv *, jobject, jint);
+
+ /*
+ * Class: org_bench4q_monitor_performance_windows_UDPv4Monitor
+ * Method: getDatagramsReceivedErrors
+ * Signature: ()D
+ */
+ JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_UDPv4Monitor_getDatagramsReceivedErrors
+ (JNIEnv *, jobject);
+
+ /*
+ * Class: org_bench4q_monitor_performance_windows_UDPv4Monitor
+ * Method: getDatagramsSentPerSecond
+ * Signature: (I)D
+ */
+ JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_UDPv4Monitor_getDatagramsSentPerSecond
+ (JNIEnv *, jobject, jint);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/WindowsMonitor/Native/UDPv6Monitor.cpp b/WindowsMonitor/Native/UDPv6Monitor.cpp
new file mode 100644
index 00000000..881e50f8
--- /dev/null
+++ b/WindowsMonitor/Native/UDPv6Monitor.cpp
@@ -0,0 +1,51 @@
+#include "stdafx.h"
+#include "UDPv6Monitor.h"
+#include "Common.h"
+
+JNIEXPORT jobjectArray JNICALL Java_org_bench4q_monitor_performance_windows_UDPv6Monitor_getCounterList
+ (JNIEnv * environment, jobject object)
+{
+ list counterList=UDPv6::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_UDPv6Monitor_getDatagramsPerSecond
+ (JNIEnv * environment, jobject object, jint idleTime)
+{
+ return UDPv6::GetDatagramsPerSecond(idleTime);
+}
+
+JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_UDPv6Monitor_getDatagramsReceivedPerSecond
+ (JNIEnv * environment, jobject object, jint idleTime)
+{
+ return UDPv6::GetDatagramsReceivedPerSecond(idleTime);
+}
+
+JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_UDPv6Monitor_getDatagramsNoPortPerSecond
+ (JNIEnv * environment, jobject object, jint idleTime)
+{
+ return UDPv6::GetDatagramsNoPortPerSecond(idleTime);
+}
+
+JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_UDPv6Monitor_getDatagramsReceivedErrors
+ (JNIEnv * environment, jobject object)
+{
+ return UDPv6::GetDatagramsReceivedErrors();
+}
+
+JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_UDPv6Monitor_getDatagramsSentPerSecond
+ (JNIEnv * environment, jobject object, jint idleTime)
+{
+ return UDPv6::GetDatagramsSentPerSecond(idleTime);
+}
diff --git a/WindowsMonitor/Native/UDPv6Monitor.h b/WindowsMonitor/Native/UDPv6Monitor.h
new file mode 100644
index 00000000..1dc43641
--- /dev/null
+++ b/WindowsMonitor/Native/UDPv6Monitor.h
@@ -0,0 +1,61 @@
+/* DO NOT EDIT THIS FILE - it is machine generated */
+#include
+/* Header for class org_bench4q_monitor_performance_windows_UDPv6Monitor */
+
+#ifndef _Included_org_bench4q_monitor_performance_windows_UDPv6Monitor
+#define _Included_org_bench4q_monitor_performance_windows_UDPv6Monitor
+#ifdef __cplusplus
+extern "C" {
+#endif
+ /*
+ * Class: org_bench4q_monitor_performance_windows_UDPv6Monitor
+ * Method: getCounterList
+ * Signature: ()[Ljava/lang/String;
+ */
+ JNIEXPORT jobjectArray JNICALL Java_org_bench4q_monitor_performance_windows_UDPv6Monitor_getCounterList
+ (JNIEnv *, jobject);
+
+ /*
+ * Class: org_bench4q_monitor_performance_windows_UDPv6Monitor
+ * Method: getDatagramsPerSecond
+ * Signature: (I)D
+ */
+ JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_UDPv6Monitor_getDatagramsPerSecond
+ (JNIEnv *, jobject, jint);
+
+ /*
+ * Class: org_bench4q_monitor_performance_windows_UDPv6Monitor
+ * Method: getDatagramsReceivedPerSecond
+ * Signature: (I)D
+ */
+ JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_UDPv6Monitor_getDatagramsReceivedPerSecond
+ (JNIEnv *, jobject, jint);
+
+ /*
+ * Class: org_bench4q_monitor_performance_windows_UDPv6Monitor
+ * Method: getDatagramsNoPortPerSecond
+ * Signature: (I)D
+ */
+ JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_UDPv6Monitor_getDatagramsNoPortPerSecond
+ (JNIEnv *, jobject, jint);
+
+ /*
+ * Class: org_bench4q_monitor_performance_windows_UDPv6Monitor
+ * Method: getDatagramsReceivedErrors
+ * Signature: ()D
+ */
+ JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_UDPv6Monitor_getDatagramsReceivedErrors
+ (JNIEnv *, jobject);
+
+ /*
+ * Class: org_bench4q_monitor_performance_windows_UDPv6Monitor
+ * Method: getDatagramsSentPerSecond
+ * Signature: (I)D
+ */
+ JNIEXPORT jdouble JNICALL Java_org_bench4q_monitor_performance_windows_UDPv6Monitor_getDatagramsSentPerSecond
+ (JNIEnv *, jobject, jint);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/src/main/java/org/bench4q/monitor/Main.java b/src/main/java/org/bench4q/monitor/Main.java
index 0f8ca743..092cdd20 100644
--- a/src/main/java/org/bench4q/monitor/Main.java
+++ b/src/main/java/org/bench4q/monitor/Main.java
@@ -8,6 +8,8 @@ import org.bench4q.monitor.performance.windows.NetworkInterfaceMonitor;
import org.bench4q.monitor.performance.windows.PhysicalDiskMonitor;
import org.bench4q.monitor.performance.windows.TCPv4Monitor;
import org.bench4q.monitor.performance.windows.TCPv6Monitor;
+import org.bench4q.monitor.performance.windows.UDPv4Monitor;
+import org.bench4q.monitor.performance.windows.UDPv6Monitor;
public class Main {
static {
@@ -111,6 +113,18 @@ public class Main {
System.out.println(elem);
}
+ UDPv4Monitor udpv4Monitor = new UDPv4Monitor();
+ String[] udpv4Counter = udpv4Monitor.getCounterList();
+ for (String elem : udpv4Counter) {
+ System.out.println(elem);
+ }
+
+ UDPv6Monitor udpv6Monitor = new UDPv6Monitor();
+ String[] udpv6Counter = udpv6Monitor.getCounterList();
+ for (String elem : udpv6Counter) {
+ System.out.println(elem);
+ }
+
MonitorServer monitorServer = new MonitorServer(5555);
monitorServer.start();
}