37 |
37 |
38 public class ClassMetaspaceSizeInJmapHeap { |
38 public class ClassMetaspaceSizeInJmapHeap { |
39 public static void main(String[] args) throws Exception { |
39 public static void main(String[] args) throws Exception { |
40 String pid = Integer.toString(ProcessTools.getProcessId()); |
40 String pid = Integer.toString(ProcessTools.getProcessId()); |
41 |
41 |
42 ProcessBuilder pb = new ProcessBuilder(); |
42 JDKToolLauncher jmap = JDKToolLauncher.create("jmap") |
43 pb.command(JDKToolFinder.getJDKTool("jmap"), "-heap", pid); |
43 .addToolArg("-heap") |
|
44 .addToolArg(pid); |
|
45 ProcessBuilder pb = new ProcessBuilder(jmap.getCommand()); |
44 |
46 |
45 File out = new File("ClassMetaspaceSizeInJmapHeap.stdout.txt"); |
47 File out = new File("ClassMetaspaceSizeInJmapHeap.stdout.txt"); |
46 pb.redirectOutput(out); |
48 pb.redirectOutput(out); |
47 |
49 |
48 File err = new File("ClassMetaspaceSizeInJmapHeap.stderr.txt"); |
50 File err = new File("ClassMetaspaceSizeInJmapHeap.stderr.txt"); |