Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 19 additions & 16 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,36 +6,27 @@

<groupId>com.jvmtop</groupId>
<artifactId>jvmtop</artifactId>
<version>0.9.0-SNAPSHOT</version>
<version>1.0.0-SNAPSHOT</version>

<dependencies>
<dependency>
<groupId>net.sf.jopt-simple</groupId>
<artifactId>jopt-simple</artifactId>
<version>4.5</version>
</dependency>
<dependency>
<groupId>com.sun</groupId>
<artifactId>tools</artifactId>
<version>${jdk.version}</version>
<scope>system</scope>
<systemPath>${toolsjar}</systemPath>
<version>5.0.4</version>
</dependency>
</dependencies>


<properties>
<!-- change it to point to your tools.jar from your JDK -->
<toolsjar>${java.home}/../lib/tools.jar</toolsjar>
<jdk.version>1.6</jdk.version>
<jdk.version>11</jdk.version>
</properties>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4.1</version>
<version>3.3.0</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
Expand Down Expand Up @@ -73,16 +64,28 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<version>3.8.1</version>
<configuration>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
<compilerArgs>
<compilerArg>--add-exports=java.rmi/sun.rmi.server=ALL-UNNAMED</compilerArg>
<compilerArg>--add-exports=java.rmi/sun.rmi.transport=ALL-UNNAMED</compilerArg>
<compilerArg>--add-exports=jdk.internal.jvmstat/sun.jvmstat.monitor=ALL-UNNAMED</compilerArg>
<compilerArg>--add-exports=java.base/jdk.internal.perf=ALL-UNNAMED</compilerArg>
<compilerArg>--add-exports=java.management/sun.management.counter.perf=ALL-UNNAMED</compilerArg>
<compilerArg>--add-exports=java.management/sun.management.counter=ALL-UNNAMED</compilerArg>
<compilerArg>--add-exports=jdk.management.agent/jdk.internal.agent=ALL-UNNAMED</compilerArg>

</compilerArgs>

<fork>true</fork>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.4</version>
<version>3.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
Expand All @@ -91,7 +94,7 @@
</goals>
</execution>
</executions>
</plugin>
</plugin>
</plugins>
</build>
</project>
32 changes: 13 additions & 19 deletions src/main/java/com/jvmtop/openjdk/tools/LocalVirtualMachine.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,19 @@
*/
package com.jvmtop.openjdk.tools;

import com.sun.tools.attach.AgentInitializationException;
import com.sun.tools.attach.AgentLoadException;
import com.sun.tools.attach.AttachNotSupportedException;
import com.sun.tools.attach.VirtualMachine;
import com.sun.tools.attach.VirtualMachineDescriptor;
import jdk.internal.agent.ConnectorAddressLink;
import sun.jvmstat.monitor.HostIdentifier;
import sun.jvmstat.monitor.MonitorException;
import sun.jvmstat.monitor.MonitoredHost;
import sun.jvmstat.monitor.MonitoredVm;
import sun.jvmstat.monitor.MonitoredVmUtil;
import sun.jvmstat.monitor.VmIdentifier;

import java.io.File;
import java.io.IOException;
import java.util.Collections;
Expand All @@ -37,20 +50,6 @@
import java.util.Map;
import java.util.Properties;
import java.util.Set;

import sun.jvmstat.monitor.HostIdentifier;
import sun.jvmstat.monitor.MonitorException;
import sun.jvmstat.monitor.MonitoredHost;
import sun.jvmstat.monitor.MonitoredVm;
import sun.jvmstat.monitor.MonitoredVmUtil;
import sun.jvmstat.monitor.VmIdentifier;
import sun.management.ConnectorAddressLink;

import com.sun.tools.attach.AgentInitializationException;
import com.sun.tools.attach.AgentLoadException;
import com.sun.tools.attach.AttachNotSupportedException;
import com.sun.tools.attach.VirtualMachine;
import com.sun.tools.attach.VirtualMachineDescriptor;
// Sun specific
// Sun private

Expand Down Expand Up @@ -189,11 +188,6 @@ public static Map<Integer, LocalVirtualMachine> getNewVirtualMachines(
private static void getMonitoredVMs(Map<Integer, LocalVirtualMachine> map,
Map<Integer, LocalVirtualMachine> existingMap)
{
//Unsupported on J9
if (J9Mode)
{
return;
}
MonitoredHost host;
Set vms;
try
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/jvmtop/view/VMDetailView.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public class VMDetailView extends AbstractConsoleView

private boolean sortByTotalCPU_ = false;

private int numberOfDisplayedThreads_ = 10;
private int numberOfDisplayedThreads_ = 100;

private int threadNameDisplayWidth_ = 30;

Expand Down
24 changes: 16 additions & 8 deletions src/main/wrappers/jvmtop.sh
Original file line number Diff line number Diff line change
@@ -1,23 +1,31 @@
#!/bin/sh
# jvmtop - java monitoring for the command-line
# jvmtop - java monitoring for the command-line
# launch script
#
# author: Markus Kolb
#
#
DIR=$( cd $(dirname $0) ; pwd -P )

if [ -z "$JAVA_HOME" ] ; then
JAVA_HOME=`readlink -f \`which java 2>/dev/null\` 2>/dev/null | \
sed 's/\/bin\/java//'`
fi

TOOLSJAR="$JAVA_HOME/lib/tools.jar"
JMX_OPTS="$JMX_OPTS -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9999"
JMX_OPTS="$JMX_OPTS -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false"

if [ ! -f "$TOOLSJAR" ] ; then
echo "$JAVA_HOME seems to be no JDK!" >&2
exit 1
fi
#JAVA_DEBUG_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=*:9002"
JAVA_MODULES="--add-modules java.se
--add-exports=java.base/jdk.internal.ref=ALL-UNNAMED
--add-exports=jdk.internal.jvmstat/sun.jvmstat.monitor=ALL-UNNAMED
--add-exports=java.base/jdk.internal.perf=ALL-UNNAMED
--add-exports=java.management/sun.management.counter.perf=ALL-UNNAMED
--add-exports=java.management/sun.management.counter=ALL-UNNAMED
--add-exports=jdk.management.agent/jdk.internal.agent=ALL-UNNAMED
--add-opens java.rmi/sun.rmi.server=ALL-UNNAMED
--add-opens java.rmi/sun.rmi.transport=ALL-UNNAMED
--add-opens jdk.management/com.sun.management.internal=ALL-UNNAMED"

"$JAVA_HOME"/bin/java $JAVA_OPTS -cp "$DIR/jvmtop.jar:$TOOLSJAR" \
"$JAVA_HOME"/bin/java $JMX_OPTS $JAVA_DEBUG_OPTS $JAVA_MODULES $JAVA_OPTS -cp "$DIR/jvmtop.jar" \
com.jvmtop.JvmTop "$@"
exit $?