You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by pm...@apache.org on 2018/11/18 20:42:22 UTC

svn commit: r1846859 - in /jmeter/trunk: bin/threaddump.cmd bin/threaddump.sh src/core/org/apache/jmeter/JMeter.java xdocs/changes.xml

Author: pmouawad
Date: Sun Nov 18 20:42:22 2018
New Revision: 1846859

URL: http://svn.apache.org/viewvc?rev=1846859&view=rev
Log:
Bug 62925 - Add support for ThreadDump to the JMeter non-GUI
Bugzilla Id: 62925

Added:
    jmeter/trunk/bin/threaddump.cmd   (with props)
    jmeter/trunk/bin/threaddump.sh   (with props)
Modified:
    jmeter/trunk/src/core/org/apache/jmeter/JMeter.java
    jmeter/trunk/xdocs/changes.xml

Added: jmeter/trunk/bin/threaddump.cmd
URL: http://svn.apache.org/viewvc/jmeter/trunk/bin/threaddump.cmd?rev=1846859&view=auto
==============================================================================
--- jmeter/trunk/bin/threaddump.cmd (added)
+++ jmeter/trunk/bin/threaddump.cmd Sun Nov 18 20:42:22 2018
@@ -0,0 +1,23 @@
+@echo off
+
+rem   Licensed to the Apache Software Foundation (ASF) under one or more
+rem   contributor license agreements.  See the NOTICE file distributed with
+rem   this work for additional information regarding copyright ownership.
+rem   The ASF licenses this file to You under the Apache License, Version 2.0
+rem   (the "License"); you may not use this file except in compliance with
+rem   the License.  You may obtain a copy of the License at
+rem 
+rem       http://www.apache.org/licenses/LICENSE-2.0
+rem 
+rem   Unless required by applicable law or agreed to in writing, software
+rem   distributed under the License is distributed on an "AS IS" BASIS,
+rem   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+rem   See the License for the specific language governing permissions and
+rem   limitations under the License.
+
+rem   Ask the JMeter client to perform a ThreadDump
+
+rem   P1 = command port for JMeter instance (defaults to 4445)
+
+java -cp %~dp0ApacheJMeter.jar org.apache.jmeter.util.ShutdownClient ThreadDump %*
+pause 
\ No newline at end of file

Propchange: jmeter/trunk/bin/threaddump.cmd
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jmeter/trunk/bin/threaddump.sh
URL: http://svn.apache.org/viewvc/jmeter/trunk/bin/threaddump.sh?rev=1846859&view=auto
==============================================================================
--- jmeter/trunk/bin/threaddump.sh (added)
+++ jmeter/trunk/bin/threaddump.sh Sun Nov 18 20:42:22 2018
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+##   Licensed to the Apache Software Foundation (ASF) under one or more
+##   contributor license agreements.  See the NOTICE file distributed with
+##   this work for additional information regarding copyright ownership.
+##   The ASF licenses this file to You under the Apache License, Version 2.0
+##   (the "License"); you may not use this file except in compliance with
+##   the License.  You may obtain a copy of the License at
+## 
+##       http://www.apache.org/licenses/LICENSE-2.0
+## 
+##   Unless required by applicable law or agreed to in writing, software
+##   distributed under the License is distributed on an "AS IS" BASIS,
+##   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+##   See the License for the specific language governing permissions and
+##   limitations under the License.
+
+#   Ask the JMeter client to perform a ThreadDump
+
+#   P1 = command port for JMeter instance (defaults to 4445)
+
+DIRNAME="$(dirname "$0")"
+
+java -cp "${DIRNAME}/ApacheJMeter.jar" org.apache.jmeter.util.ShutdownClient ThreadDump "$@"

Propchange: jmeter/trunk/bin/threaddump.sh
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jmeter/trunk/bin/threaddump.sh
------------------------------------------------------------------------------
    svn:executable = *

Modified: jmeter/trunk/src/core/org/apache/jmeter/JMeter.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/JMeter.java?rev=1846859&r1=1846858&r2=1846859&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/JMeter.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/JMeter.java Sun Nov 18 20:42:22 2018
@@ -107,6 +107,7 @@ import org.apache.jorphan.reflect.ClassT
 import org.apache.jorphan.util.HeapDumper;
 import org.apache.jorphan.util.JMeterException;
 import org.apache.jorphan.util.JOrphanUtils;
+import org.apache.jorphan.util.ThreadDumper;
 import org.apache.logging.log4j.Level;
 import org.apache.logging.log4j.core.config.Configurator;
 import org.slf4j.Logger;
@@ -1419,7 +1420,7 @@ public class JMeter implements JMeterPlu
 
     private static void waitForSignals(final List<JMeterEngine> engines, DatagramSocket socket) {
         byte[] buf = new byte[80];
-        System.out.println("Waiting for possible Shutdown/StopTestNow/Heapdump message on port "+socket.getLocalPort());//NOSONAR
+        System.out.println("Waiting for possible Shutdown/StopTestNow/HeapDump/ThreadDump message on port "+socket.getLocalPort());//NOSONAR
         DatagramPacket request = new DatagramPacket(buf, buf.length);
         try {
             while(true) {
@@ -1444,6 +1445,9 @@ public class JMeter implements JMeterPlu
                         case "HeapDump" :
                             HeapDumper.dumpHeap();
                             break;
+                        case "ThreadDump" :
+                            ThreadDumper.threadDump();
+                            break;
                         default:
                             System.out.println("Command: "+command+" not recognised ");//NOSONAR                            
                     }

Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1846859&r1=1846858&r2=1846859&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml [utf-8] (original)
+++ jmeter/trunk/xdocs/changes.xml [utf-8] Sun Nov 18 20:42:22 2018
@@ -122,6 +122,7 @@ of previous time slot as a base. Startin
    <li><bug>62752</bug>Add to Documentation: <code>ctx.getThreadNum()</code> is zero-based while <code>${__threadNum}</code> is one-based</li>
    <li><pr>411</pr>Use <code>SHA-1</code> instead of <code>SHA1</code> in <code>org.apache.jmeter.save.SaveService</code>. Contributed by Paco (paco.xu at daocloud.io)</li>
    <li><bug>62914</bug>Add a hint in Thread Group UI about duration of test</li>
+   <li><bug>62925</bug>Add support for ThreadDump to the JMeter non-GUI</li>
 </ul>
 
 <ch_section>Non-functional changes</ch_section>