57 |
57 |
58 public static void main(String[] args) throws Exception { |
58 public static void main(String[] args) throws Exception { |
59 // If we are on MacOSX, test if JMap tool is signed, otherwise return |
59 // If we are on MacOSX, test if JMap tool is signed, otherwise return |
60 // since test will fail with privilege error. |
60 // since test will fail with privilege error. |
61 if (Platform.isOSX()) { |
61 if (Platform.isOSX()) { |
62 String jmapToolPath = JDKToolFinder.getCurrentJDKTool("jmap"); |
62 String jmapToolPath = JDKToolFinder.getTestJDKTool("jmap"); |
63 ProcessBuilder codesignProcessBuilder = new ProcessBuilder( |
63 ProcessBuilder codesignProcessBuilder = new ProcessBuilder( |
64 "codesign", "-v", jmapToolPath); |
64 "codesign", "-v", jmapToolPath); |
65 Process codesignProcess = codesignProcessBuilder.start(); |
65 Process codesignProcess = codesignProcessBuilder.start(); |
66 OutputAnalyzer analyser = new OutputAnalyzer(codesignProcess); |
66 OutputAnalyzer analyser = new OutputAnalyzer(codesignProcess); |
67 try { |
67 try { |
105 int pid = Integer.parseInt(pidstring.substring(4, |
105 int pid = Integer.parseInt(pidstring.substring(4, |
106 pidstring.length() - 1)); |
106 pidstring.length() - 1)); |
107 System.out.println("Extracted pid: " + pid); |
107 System.out.println("Extracted pid: " + pid); |
108 |
108 |
109 JDKToolLauncher jMapLauncher = JDKToolLauncher |
109 JDKToolLauncher jMapLauncher = JDKToolLauncher |
110 .create("jmap", false); |
110 .createUsingTestJDK("jmap"); |
111 jMapLauncher.addToolArg("-dump:format=b,file=" + pid + "-" |
111 jMapLauncher.addToolArg("-dump:format=b,file=" + pid + "-" |
112 + HEAP_DUMP_FILE_NAME); |
112 + HEAP_DUMP_FILE_NAME); |
113 jMapLauncher.addToolArg(String.valueOf(pid)); |
113 jMapLauncher.addToolArg(String.valueOf(pid)); |
114 |
114 |
115 ProcessBuilder jMapProcessBuilder = new ProcessBuilder( |
115 ProcessBuilder jMapProcessBuilder = new ProcessBuilder( |