From 4624ee9288e51e8eb1021d36e2d480ae1d6e7fbf Mon Sep 17 00:00:00 2001 From: Zhen Tang Date: Wed, 10 Jul 2013 00:02:20 +0800 Subject: [PATCH] jni adapter for tcpv4 monitor added. --- WindowsMonitor/Native/Native.vcxproj | 2 ++ WindowsMonitor/Native/Native.vcxproj.filters | 6 +++++ src/main/java/org/bench4q/monitor/Main.java | 7 ++++++ .../performance/windows/TCPv4Monitor.java | 23 +++++++++++++++++++ .../{TcpMonitor.java => TCPv6Monitor.java} | 2 +- .../{UdpMonitor.java => UDPv4Monitor.java} | 2 +- .../performance/windows/UDPv6Monitor.java | 5 ++++ 7 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 src/main/java/org/bench4q/monitor/performance/windows/TCPv4Monitor.java rename src/main/java/org/bench4q/monitor/performance/windows/{TcpMonitor.java => TCPv6Monitor.java} (65%) rename src/main/java/org/bench4q/monitor/performance/windows/{UdpMonitor.java => UDPv4Monitor.java} (65%) create mode 100644 src/main/java/org/bench4q/monitor/performance/windows/UDPv6Monitor.java diff --git a/WindowsMonitor/Native/Native.vcxproj b/WindowsMonitor/Native/Native.vcxproj index 5ba87835..45ae3878 100644 --- a/WindowsMonitor/Native/Native.vcxproj +++ b/WindowsMonitor/Native/Native.vcxproj @@ -153,6 +153,7 @@ + @@ -179,6 +180,7 @@ Create Create + diff --git a/WindowsMonitor/Native/Native.vcxproj.filters b/WindowsMonitor/Native/Native.vcxproj.filters index c84af46c..d39730b5 100644 --- a/WindowsMonitor/Native/Native.vcxproj.filters +++ b/WindowsMonitor/Native/Native.vcxproj.filters @@ -36,6 +36,9 @@ 头文件 + + 头文件 + @@ -56,5 +59,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 b83d7f7a..14223a01 100644 --- a/src/main/java/org/bench4q/monitor/Main.java +++ b/src/main/java/org/bench4q/monitor/Main.java @@ -5,6 +5,7 @@ import java.io.File; import org.bench4q.monitor.performance.windows.LogicalDiskMonitor; import org.bench4q.monitor.performance.windows.MemoryMonitor; import org.bench4q.monitor.performance.windows.NetworkInterfaceMonitor; +import org.bench4q.monitor.performance.windows.TCPv4Monitor; public class Main { static { @@ -85,6 +86,12 @@ public class Main { System.out.println(elem); } + TCPv4Monitor tcpv4Monitor = new TCPv4Monitor(); + String[] tcpv4Counter = tcpv4Monitor.getCounterList(); + for (String elem : tcpv4Counter) { + System.out.println(elem); + } + MonitorServer monitorServer = new MonitorServer(5555); monitorServer.start(); } diff --git a/src/main/java/org/bench4q/monitor/performance/windows/TCPv4Monitor.java b/src/main/java/org/bench4q/monitor/performance/windows/TCPv4Monitor.java new file mode 100644 index 00000000..c512fdb2 --- /dev/null +++ b/src/main/java/org/bench4q/monitor/performance/windows/TCPv4Monitor.java @@ -0,0 +1,23 @@ +package org.bench4q.monitor.performance.windows; + +public class TCPv4Monitor { + public native String[] getCounterList(); + + public native double getSegmentsPerSecond(int idleTime); + + public native double getConnectionsEstablished(); + + public native double getConnectionsActive(); + + public native double getConnectionsPassive(); + + public native double getConnectionFailures(); + + public native double getConnectionsReset(); + + public native double getSegmentsReceivedPerSecond(int idleTime); + + public native double getSegmentsSentPerSecond(int idleTime); + + public native double getSegmentsRetransmittedPerSecond(int idleTime); +} diff --git a/src/main/java/org/bench4q/monitor/performance/windows/TcpMonitor.java b/src/main/java/org/bench4q/monitor/performance/windows/TCPv6Monitor.java similarity index 65% rename from src/main/java/org/bench4q/monitor/performance/windows/TcpMonitor.java rename to src/main/java/org/bench4q/monitor/performance/windows/TCPv6Monitor.java index 732900ca..64e83bfc 100644 --- a/src/main/java/org/bench4q/monitor/performance/windows/TcpMonitor.java +++ b/src/main/java/org/bench4q/monitor/performance/windows/TCPv6Monitor.java @@ -1,5 +1,5 @@ package org.bench4q.monitor.performance.windows; -public class TcpMonitor { +public class TCPv6Monitor { } diff --git a/src/main/java/org/bench4q/monitor/performance/windows/UdpMonitor.java b/src/main/java/org/bench4q/monitor/performance/windows/UDPv4Monitor.java similarity index 65% rename from src/main/java/org/bench4q/monitor/performance/windows/UdpMonitor.java rename to src/main/java/org/bench4q/monitor/performance/windows/UDPv4Monitor.java index 818f07fa..82767f75 100644 --- a/src/main/java/org/bench4q/monitor/performance/windows/UdpMonitor.java +++ b/src/main/java/org/bench4q/monitor/performance/windows/UDPv4Monitor.java @@ -1,5 +1,5 @@ package org.bench4q.monitor.performance.windows; -public class UdpMonitor { +public class UDPv4Monitor { } diff --git a/src/main/java/org/bench4q/monitor/performance/windows/UDPv6Monitor.java b/src/main/java/org/bench4q/monitor/performance/windows/UDPv6Monitor.java new file mode 100644 index 00000000..8ba4f820 --- /dev/null +++ b/src/main/java/org/bench4q/monitor/performance/windows/UDPv6Monitor.java @@ -0,0 +1,5 @@ +package org.bench4q.monitor.performance.windows; + +public class UDPv6Monitor { + +}