Skip to content

Commit 6aa3ce4

Browse files
committed
Add manifest, agent jar for instrumentation
1 parent 67d64fc commit 6aa3ce4

File tree

4 files changed

+23
-3
lines changed

4 files changed

+23
-3
lines changed

java/misc/src/main/java/org/openapex/samples/misc/instrument/commands.txt renamed to java/misc/src/main/java/org/openapex/samples/misc/instrument/Commands.txt

File renamed without changes.
Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,33 @@
11
package org.openapex.samples.misc.instrument;
22

3+
import lombok.AllArgsConstructor;
4+
import lombok.Data;
5+
36
import java.io.File;
47
import java.lang.instrument.Instrumentation;
8+
import java.util.HashMap;
9+
import java.util.Map;
510

611
public class ObjectSize {
712
public static void main(String[] args) {
813
File f = new File("data/user.csv");
914
String hello = "Hello World";
1015
Integer num = Integer.valueOf(100);
11-
System.out.println("Size of file object (bytes): "+MyInstrumentationAgent.getObjectSize(f));
12-
System.out.println("Size of string (bytes): "+MyInstrumentationAgent.getObjectSize(hello));
13-
System.out.println("Size of integer (bytes): "+MyInstrumentationAgent.getObjectSize(num));
16+
Map<Integer, Employee> employees = new HashMap<>();
17+
employees.put(1, new Employee("abc", "address1"));
18+
employees.put(2, new Employee("def", "address2"));
19+
employees.put(3, new Employee("ghi", "address3"));
20+
employees.put(4, new Employee("jkl", "address4"));
21+
System.out.println("Size of file object (bytes): " + MyInstrumentationAgent.getObjectSize(f));
22+
System.out.println("Size of string (bytes): " + MyInstrumentationAgent.getObjectSize(hello));
23+
System.out.println("Size of integer (bytes): " + MyInstrumentationAgent.getObjectSize(num));
24+
System.out.println("Size of map (bytes): " + MyInstrumentationAgent.getObjectSize(employees));
25+
}
26+
27+
@Data
28+
@AllArgsConstructor
29+
private static class Employee {
30+
private String name;
31+
private String address;
1432
}
1533
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Premain-Class: org.openapex.samples.misc.instrument.MyInstrumentationAgent
2+
Agent-Class: org.openapex.samples.misc.instrument.MyInstrumentationAgent
Binary file not shown.

0 commit comments

Comments
 (0)