Skip to content
This repository has been archived by the owner on Dec 29, 2023. It is now read-only.

Commit

Permalink
Added package support
Browse files Browse the repository at this point in the history
  • Loading branch information
bastiao committed Jun 3, 2019
1 parent cd8fc31 commit 8e522cb
Show file tree
Hide file tree
Showing 7 changed files with 95 additions and 12 deletions.
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,28 @@ remote applications:
## Output - export format


There are summary metrics to measure:

```
ActionName,ExecutionIteration,Timestamp,UsedMemory,CPUTime
monitor-1,0,2019.06.03.17.20.21,19800024,46190000000
monitor-1,1,2019.06.03.17.20.25,19856992,46900000000
monitor-2,0,2019.06.03.17.20.26,19917168,46900000000
monitor-2,1,2019.06.03.17.20.28,19977176,46900000000
```



There are two outputs, Heap:

```
ActionName,ExecutionIteration,NameOfObject,ByteOrderBySize,Size,Count
monitor-1,0,java.lang.String (retained),58918,58918
monitor-1,0,int[],29849,29849
monitor-1,0,char[],60273,60273
```



## Recommended tools

Expand All @@ -120,6 +139,8 @@ remote applications:

Build >= JDK12

For package: mvn package.

## Support

It is an open source project and no enterprise support is provided, only by the community.
Expand Down
4 changes: 2 additions & 2 deletions conf/rmjvm-dicoogle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ actions:
cmd: "c:\\Users\\bastiao\\Software\\dcm4che-5.16.3-bin\\dcm4che-5.16.3\\bin\\ianscu.bat -c DICOOGLE-STORAGE@localhost:6666"
timeout: 0 # ms
monitor: ['cpu', 'mem']
executions: 10
executions: 2
- name: monitor-dicom-qr
cmd: "c:\\Users\\bastiao\\Software\\dcm4che-5.16.3-bin\\dcm4che-5.16.3\\bin\\ianscu.bat -c DICOOGLE-STORAGE@localhost:1045"
monitor: ['mem']
timeout: 0 # ms
executions: 100
executions: 2

# configure a tracer
# there are few examples, such zipkin
Expand Down
17 changes: 17 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,23 @@
</executions>
</plugin>

<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.5.3</version>
<configuration>
<descriptor>src/assembly/dep.xml</descriptor>
</configuration>
<executions>
<execution>
<id>create-archive</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>

</plugins>
</build>

Expand Down
3 changes: 3 additions & 0 deletions rmjvm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash

java -jar rmjvm-jar-with-dependencies.jar "$@"
34 changes: 34 additions & 0 deletions src/assembly/dep.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>bin</id>
<formats>
<format>tar.gz</format>
<format>tar.bz2</format>
<format>zip</format>
</formats>
<fileSets>
<fileSet>
<directory>${project.basedir}</directory>
<outputDirectory>/</outputDirectory>
<includes>
<include>README*</include>
<include>LICENSE*</include>
<include>bin/*</include>
<include>NOTICE*</include>
<include>conf/rmjvm.yml</include>
</includes>
</fileSet>
<fileSet>
<directory>${project.build.directory}</directory>
<outputDirectory>/</outputDirectory>
<includes>
<include>*.jar</include>
</includes>
</fileSet>
<fileSet>
<directory>${project.build.directory}/site</directory>
<outputDirectory>docs</outputDirectory>
</fileSet>
</fileSets>
</assembly>
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,9 @@ public void monitor() throws IOException {
String fileName = "heap_dump_" + new SimpleDateFormat("dd.MM.yyyy HH.mm.ss").format(new Date()) + ".hprof";
boolean onlyLiveObjects = false;
bean.dumpHeap(fileName, onlyLiveObjects);
File heapFile = new File(nameHeapFile + fileName);

heap = HeapFactory.createFastHeap(new File(nameHeapFile + fileName));
heap = HeapFactory.createFastHeap(heapFile);
MemoryAnalysisUtil.heap = heap;


Expand Down Expand Up @@ -185,6 +186,11 @@ public void monitor() throws IOException {
System.out.println("average memory usage is: " + tempMemory / sampleCount);//print average memory usage
this.totalMemory = tempMemory / sampleCount;
jmxc.close();
heap = null;
MemoryAnalysisUtil.heap = null;
System.out.println("Delete the following heap: " + heapFile.getAbsolutePath());
heapFile.deleteOnExit();
System.out.println("Heap exists: " + heapFile.exists());


}
Expand Down
20 changes: 11 additions & 9 deletions src/test/java/TestMemoryMonitor.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,20 +59,22 @@ void testMemoryConnection() throws IOException, MalformedObjectNameException {
JMXConnection con = null;
try {
con = new JMXConnection("service:jmx:rmi:///jndi/rmi://" + hostName + ":" + portNum + "/jmxrmi");


// Create a temporary directory
//File myTempDir = Files.createTempDir();
Path tempDirWithPrefix = Files.createTempDirectory("rmjvm-");

MemoryMonitor monitor = new MemoryMonitor(con);
monitor.initHeapDump(new File("c:/Users/bastiao/Projects/dicoogle/dicoogle/target/"));
String report = monitor.reportStrings();
String hist = monitor.printHistogram();
System.out.println(hist);
}
catch (Exception e){
return;
}

// Create a temporary directory
//File myTempDir = Files.createTempDir();
Path tempDirWithPrefix = Files.createTempDirectory("rmjvm-");

MemoryMonitor monitor = new MemoryMonitor(con);
monitor.initHeapDump(new File("c:/Users/bastiao/Projects/dicoogle/dicoogle/target/"));
String report = monitor.reportStrings();
String hist = monitor.printHistogram();
System.out.println(hist);

}

Expand Down

0 comments on commit 8e522cb

Please sign in to comment.