author | alanb |
Thu, 17 Mar 2016 19:04:16 +0000 | |
changeset 36511 | 9d0388c6b336 |
parent 25859 | 3317bb8137f4 |
child 38360 | fb63be22ffa6 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
16501
678abe06c15c
8005116: NPG: Rename -permstat option for jmap in jdk8 to -clstats
stefank
parents:
14342
diff
changeset
|
2 |
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. |
2 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
5506 | 7 |
* published by the Free Software Foundation. Oracle designates this |
2 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
2 | 10 |
* |
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
5506 | 21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
2 | 24 |
*/ |
25 |
||
26 |
package sun.tools.jmap; |
|
27 |
||
28 |
import java.io.File; |
|
29 |
import java.io.IOException; |
|
30 |
import java.io.InputStream; |
|
31 |
||
32 |
import com.sun.tools.attach.VirtualMachine; |
|
33 |
import com.sun.tools.attach.AttachNotSupportedException; |
|
34 |
import sun.tools.attach.HotSpotVirtualMachine; |
|
36511 | 35 |
import jdk.internal.vm.agent.spi.ToolProvider; |
36 |
import jdk.internal.vm.agent.spi.ToolProviderFinder; |
|
2 | 37 |
|
38 |
/* |
|
39 |
* This class is the main class for the JMap utility. It parses its arguments |
|
21278 | 40 |
* and decides if the command should be satisfied using the VM attach mechanism |
2 | 41 |
* or an SA tool. At this time the only option that uses the VM attach mechanism |
42 |
* is the -dump option to get a heap dump of a running application. All other |
|
43 |
* options are mapped to SA tools. |
|
44 |
*/ |
|
45 |
public class JMap { |
|
46 |
||
47 |
// Options handled by the attach mechanism |
|
48 |
private static String HISTO_OPTION = "-histo"; |
|
49 |
private static String LIVE_HISTO_OPTION = "-histo:live"; |
|
50 |
private static String DUMP_OPTION_PREFIX = "-dump:"; |
|
51 |
||
52 |
// These options imply the use of a SA tool |
|
53 |
private static String SA_TOOL_OPTIONS = |
|
16501
678abe06c15c
8005116: NPG: Rename -permstat option for jmap in jdk8 to -clstats
stefank
parents:
14342
diff
changeset
|
54 |
"-heap|-heap:format=b|-clstats|-finalizerinfo"; |
2 | 55 |
|
56 |
// The -F (force) option is currently not passed through to SA |
|
57 |
private static String FORCE_SA_OPTION = "-F"; |
|
58 |
||
59 |
// Default option (if nothing provided) |
|
1089
12e2f9ad0367
6653883: jmap with no option should print mmap instead of heap information.
swamyv
parents:
2
diff
changeset
|
60 |
private static String DEFAULT_OPTION = "-pmap"; |
2 | 61 |
|
62 |
public static void main(String[] args) throws Exception { |
|
63 |
if (args.length == 0) { |
|
21673
c5d341bc60dd
8027765: Make exit codes and stdout/stderr printing from jmap/jinfo/jstack/jps consistent
sla
parents:
21278
diff
changeset
|
64 |
usage(1); // no arguments |
2 | 65 |
} |
66 |
||
67 |
// used to indicate if we should use SA |
|
68 |
boolean useSA = false; |
|
69 |
||
70 |
// the chosen option (-heap, -dump:*, ... ) |
|
71 |
String option = null; |
|
72 |
||
73 |
// First iterate over the options (arguments starting with -). There should be |
|
74 |
// one (but maybe two if -F is also used). |
|
75 |
int optionCount = 0; |
|
76 |
while (optionCount < args.length) { |
|
77 |
String arg = args[optionCount]; |
|
78 |
if (!arg.startsWith("-")) { |
|
79 |
break; |
|
80 |
} |
|
21673
c5d341bc60dd
8027765: Make exit codes and stdout/stderr printing from jmap/jinfo/jstack/jps consistent
sla
parents:
21278
diff
changeset
|
81 |
if (arg.equals("-help") || arg.equals("-h")) { |
c5d341bc60dd
8027765: Make exit codes and stdout/stderr printing from jmap/jinfo/jstack/jps consistent
sla
parents:
21278
diff
changeset
|
82 |
usage(0); |
c5d341bc60dd
8027765: Make exit codes and stdout/stderr printing from jmap/jinfo/jstack/jps consistent
sla
parents:
21278
diff
changeset
|
83 |
} else if (arg.equals(FORCE_SA_OPTION)) { |
2 | 84 |
useSA = true; |
85 |
} else { |
|
86 |
if (option != null) { |
|
21673
c5d341bc60dd
8027765: Make exit codes and stdout/stderr printing from jmap/jinfo/jstack/jps consistent
sla
parents:
21278
diff
changeset
|
87 |
usage(1); // option already specified |
2 | 88 |
} |
89 |
option = arg; |
|
90 |
} |
|
91 |
optionCount++; |
|
92 |
} |
|
93 |
||
94 |
// if no option provided then use default. |
|
95 |
if (option == null) { |
|
96 |
option = DEFAULT_OPTION; |
|
97 |
} |
|
98 |
if (option.matches(SA_TOOL_OPTIONS)) { |
|
99 |
useSA = true; |
|
100 |
} |
|
101 |
||
102 |
// Next we check the parameter count. For the SA tools there are |
|
103 |
// one or two parameters. For the built-in -dump option there is |
|
104 |
// only one parameter (the process-id) |
|
105 |
int paramCount = args.length - optionCount; |
|
106 |
if (paramCount == 0 || paramCount > 2) { |
|
21673
c5d341bc60dd
8027765: Make exit codes and stdout/stderr printing from jmap/jinfo/jstack/jps consistent
sla
parents:
21278
diff
changeset
|
107 |
usage(1); |
2 | 108 |
} |
109 |
||
110 |
if (optionCount == 0 || paramCount != 1) { |
|
111 |
useSA = true; |
|
112 |
} else { |
|
113 |
// the parameter for the -dump option is a process-id. |
|
114 |
// If it doesn't parse to a number then it must be SA |
|
115 |
// debug server |
|
116 |
if (!args[optionCount].matches("[0-9]+")) { |
|
117 |
useSA = true; |
|
118 |
} |
|
119 |
} |
|
120 |
||
121 |
||
122 |
// at this point we know if we are executing an SA tool or a built-in |
|
123 |
// option. |
|
124 |
||
125 |
if (useSA) { |
|
126 |
// parameters (<pid> or <exe> <core>) |
|
127 |
String params[] = new String[paramCount]; |
|
128 |
for (int i=optionCount; i<args.length; i++ ){ |
|
129 |
params[i-optionCount] = args[i]; |
|
130 |
} |
|
131 |
runTool(option, params); |
|
132 |
||
133 |
} else { |
|
134 |
String pid = args[1]; |
|
135 |
// Here we handle the built-in options |
|
136 |
// As more options are added we should create an abstract tool class and |
|
137 |
// have a table to map the options |
|
138 |
if (option.equals(HISTO_OPTION)) { |
|
139 |
histo(pid, false); |
|
140 |
} else if (option.equals(LIVE_HISTO_OPTION)) { |
|
141 |
histo(pid, true); |
|
142 |
} else if (option.startsWith(DUMP_OPTION_PREFIX)) { |
|
143 |
dump(pid, option); |
|
144 |
} else { |
|
21673
c5d341bc60dd
8027765: Make exit codes and stdout/stderr printing from jmap/jinfo/jstack/jps consistent
sla
parents:
21278
diff
changeset
|
145 |
usage(1); |
2 | 146 |
} |
147 |
} |
|
148 |
} |
|
149 |
||
150 |
// Invoke SA tool with the given arguments |
|
151 |
private static void runTool(String option, String args[]) throws Exception { |
|
152 |
String[][] tools = { |
|
36511 | 153 |
{ "-pmap", "pmap" }, |
154 |
{ "-heap", "heapSummary" }, |
|
155 |
{ "-heap:format=b", "heapDumper" }, |
|
156 |
{ "-histo", "objectHistogram" }, |
|
157 |
{ "-clstats", "classLoaderStats" }, |
|
158 |
{ "-finalizerinfo", "finalizerInfo" }, |
|
2 | 159 |
}; |
160 |
||
36511 | 161 |
String name = null; |
2 | 162 |
|
163 |
// -dump option needs to be handled in a special way |
|
164 |
if (option.startsWith(DUMP_OPTION_PREFIX)) { |
|
165 |
// first check that the option can be parsed |
|
166 |
String fn = parseDumpOptions(option); |
|
21673
c5d341bc60dd
8027765: Make exit codes and stdout/stderr printing from jmap/jinfo/jstack/jps consistent
sla
parents:
21278
diff
changeset
|
167 |
if (fn == null) { |
c5d341bc60dd
8027765: Make exit codes and stdout/stderr printing from jmap/jinfo/jstack/jps consistent
sla
parents:
21278
diff
changeset
|
168 |
usage(1); |
c5d341bc60dd
8027765: Make exit codes and stdout/stderr printing from jmap/jinfo/jstack/jps consistent
sla
parents:
21278
diff
changeset
|
169 |
} |
2 | 170 |
|
171 |
// tool for heap dumping |
|
36511 | 172 |
name = "heapDumper"; |
2 | 173 |
|
174 |
// HeapDumper -f <file> |
|
175 |
args = prepend(fn, args); |
|
176 |
args = prepend("-f", args); |
|
177 |
} else { |
|
178 |
int i=0; |
|
179 |
while (i < tools.length) { |
|
180 |
if (option.equals(tools[i][0])) { |
|
36511 | 181 |
name = tools[i][1]; |
2 | 182 |
break; |
183 |
} |
|
184 |
i++; |
|
185 |
} |
|
186 |
} |
|
36511 | 187 |
if (name == null) { |
21673
c5d341bc60dd
8027765: Make exit codes and stdout/stderr printing from jmap/jinfo/jstack/jps consistent
sla
parents:
21278
diff
changeset
|
188 |
usage(1); // no mapping to tool |
2 | 189 |
} |
190 |
||
36511 | 191 |
// Tool not available on this platform. |
192 |
ToolProvider tool = ToolProviderFinder.find(name); |
|
193 |
if (tool == null) { |
|
21673
c5d341bc60dd
8027765: Make exit codes and stdout/stderr printing from jmap/jinfo/jstack/jps consistent
sla
parents:
21278
diff
changeset
|
194 |
usage(1); |
2 | 195 |
} |
196 |
||
197 |
// invoke the main method with the arguments |
|
36511 | 198 |
tool.run(args); |
2 | 199 |
} |
200 |
||
201 |
private static final String LIVE_OBJECTS_OPTION = "-live"; |
|
202 |
private static final String ALL_OBJECTS_OPTION = "-all"; |
|
203 |
private static void histo(String pid, boolean live) throws IOException { |
|
204 |
VirtualMachine vm = attach(pid); |
|
205 |
InputStream in = ((HotSpotVirtualMachine)vm). |
|
206 |
heapHisto(live ? LIVE_OBJECTS_OPTION : ALL_OBJECTS_OPTION); |
|
207 |
drain(vm, in); |
|
208 |
} |
|
209 |
||
210 |
private static void dump(String pid, String options) throws IOException { |
|
211 |
// parse the options to get the dump filename |
|
212 |
String filename = parseDumpOptions(options); |
|
213 |
if (filename == null) { |
|
21673
c5d341bc60dd
8027765: Make exit codes and stdout/stderr printing from jmap/jinfo/jstack/jps consistent
sla
parents:
21278
diff
changeset
|
214 |
usage(1); // invalid options or no filename |
2 | 215 |
} |
216 |
||
217 |
// get the canonical path - important to avoid just passing |
|
218 |
// a "heap.bin" and having the dump created in the target VM |
|
219 |
// working directory rather than the directory where jmap |
|
220 |
// is executed. |
|
221 |
filename = new File(filename).getCanonicalPath(); |
|
222 |
||
223 |
// dump live objects only or not |
|
224 |
boolean live = isDumpLiveObjects(options); |
|
225 |
||
226 |
VirtualMachine vm = attach(pid); |
|
227 |
System.out.println("Dumping heap to " + filename + " ..."); |
|
228 |
InputStream in = ((HotSpotVirtualMachine)vm). |
|
229 |
dumpHeap((Object)filename, |
|
230 |
(live ? LIVE_OBJECTS_OPTION : ALL_OBJECTS_OPTION)); |
|
231 |
drain(vm, in); |
|
232 |
} |
|
233 |
||
234 |
// Parse the options to the -dump option. Valid options are format=b and |
|
235 |
// file=<file>. Returns <file> if provided. Returns null if <file> not |
|
236 |
// provided, or invalid option. |
|
237 |
private static String parseDumpOptions(String arg) { |
|
238 |
assert arg.startsWith(DUMP_OPTION_PREFIX); |
|
239 |
||
240 |
String filename = null; |
|
241 |
||
242 |
// options are separated by comma (,) |
|
243 |
String options[] = arg.substring(DUMP_OPTION_PREFIX.length()).split(","); |
|
244 |
||
245 |
for (int i=0; i<options.length; i++) { |
|
246 |
String option = options[i]; |
|
247 |
||
248 |
if (option.equals("format=b")) { |
|
249 |
// ignore format (not needed at this time) |
|
250 |
} else if (option.equals("live")) { |
|
251 |
// a valid suboption |
|
252 |
} else { |
|
253 |
||
254 |
// file=<file> - check that <file> is specified |
|
255 |
if (option.startsWith("file=")) { |
|
256 |
filename = option.substring(5); |
|
257 |
if (filename.length() == 0) { |
|
258 |
return null; |
|
259 |
} |
|
260 |
} else { |
|
261 |
return null; // option not recognized |
|
262 |
} |
|
263 |
} |
|
264 |
} |
|
265 |
return filename; |
|
266 |
} |
|
267 |
||
268 |
private static boolean isDumpLiveObjects(String arg) { |
|
269 |
// options are separated by comma (,) |
|
270 |
String options[] = arg.substring(DUMP_OPTION_PREFIX.length()).split(","); |
|
271 |
for (String suboption : options) { |
|
272 |
if (suboption.equals("live")) { |
|
273 |
return true; |
|
274 |
} |
|
275 |
} |
|
276 |
return false; |
|
277 |
} |
|
278 |
||
279 |
// Attach to <pid>, existing if we fail to attach |
|
280 |
private static VirtualMachine attach(String pid) { |
|
281 |
try { |
|
282 |
return VirtualMachine.attach(pid); |
|
283 |
} catch (Exception x) { |
|
284 |
String msg = x.getMessage(); |
|
285 |
if (msg != null) { |
|
286 |
System.err.println(pid + ": " + msg); |
|
287 |
} else { |
|
288 |
x.printStackTrace(); |
|
289 |
} |
|
290 |
if ((x instanceof AttachNotSupportedException) && haveSA()) { |
|
291 |
System.err.println("The -F option can be used when the " + |
|
292 |
"target process is not responding"); |
|
293 |
} |
|
294 |
System.exit(1); |
|
295 |
return null; // keep compiler happy |
|
296 |
} |
|
297 |
} |
|
298 |
||
299 |
// Read the stream from the target VM until EOF, then detach |
|
300 |
private static void drain(VirtualMachine vm, InputStream in) throws IOException { |
|
301 |
// read to EOF and just print output |
|
302 |
byte b[] = new byte[256]; |
|
303 |
int n; |
|
304 |
do { |
|
305 |
n = in.read(b); |
|
306 |
if (n > 0) { |
|
307 |
String s = new String(b, 0, n, "UTF-8"); |
|
308 |
System.out.print(s); |
|
309 |
} |
|
310 |
} while (n > 0); |
|
311 |
in.close(); |
|
312 |
vm.detach(); |
|
313 |
} |
|
314 |
||
315 |
// return a new string array with arg as the first element |
|
316 |
private static String[] prepend(String arg, String args[]) { |
|
317 |
String[] newargs = new String[args.length+1]; |
|
318 |
newargs[0] = arg; |
|
319 |
System.arraycopy(args, 0, newargs, 1, args.length); |
|
320 |
return newargs; |
|
321 |
} |
|
322 |
||
323 |
// returns true if SA is available |
|
324 |
private static boolean haveSA() { |
|
36511 | 325 |
return ToolProviderFinder.find("heapSummary") != null; |
2 | 326 |
} |
327 |
||
328 |
// print usage message |
|
21673
c5d341bc60dd
8027765: Make exit codes and stdout/stderr printing from jmap/jinfo/jstack/jps consistent
sla
parents:
21278
diff
changeset
|
329 |
private static void usage(int exit) { |
c5d341bc60dd
8027765: Make exit codes and stdout/stderr printing from jmap/jinfo/jstack/jps consistent
sla
parents:
21278
diff
changeset
|
330 |
System.err.println("Usage:"); |
2 | 331 |
if (haveSA()) { |
21673
c5d341bc60dd
8027765: Make exit codes and stdout/stderr printing from jmap/jinfo/jstack/jps consistent
sla
parents:
21278
diff
changeset
|
332 |
System.err.println(" jmap [option] <pid>"); |
c5d341bc60dd
8027765: Make exit codes and stdout/stderr printing from jmap/jinfo/jstack/jps consistent
sla
parents:
21278
diff
changeset
|
333 |
System.err.println(" (to connect to running process)"); |
c5d341bc60dd
8027765: Make exit codes and stdout/stderr printing from jmap/jinfo/jstack/jps consistent
sla
parents:
21278
diff
changeset
|
334 |
System.err.println(" jmap [option] <executable <core>"); |
c5d341bc60dd
8027765: Make exit codes and stdout/stderr printing from jmap/jinfo/jstack/jps consistent
sla
parents:
21278
diff
changeset
|
335 |
System.err.println(" (to connect to a core file)"); |
c5d341bc60dd
8027765: Make exit codes and stdout/stderr printing from jmap/jinfo/jstack/jps consistent
sla
parents:
21278
diff
changeset
|
336 |
System.err.println(" jmap [option] [server_id@]<remote server IP or hostname>"); |
c5d341bc60dd
8027765: Make exit codes and stdout/stderr printing from jmap/jinfo/jstack/jps consistent
sla
parents:
21278
diff
changeset
|
337 |
System.err.println(" (to connect to remote debug server)"); |
c5d341bc60dd
8027765: Make exit codes and stdout/stderr printing from jmap/jinfo/jstack/jps consistent
sla
parents:
21278
diff
changeset
|
338 |
System.err.println(""); |
c5d341bc60dd
8027765: Make exit codes and stdout/stderr printing from jmap/jinfo/jstack/jps consistent
sla
parents:
21278
diff
changeset
|
339 |
System.err.println("where <option> is one of:"); |
c5d341bc60dd
8027765: Make exit codes and stdout/stderr printing from jmap/jinfo/jstack/jps consistent
sla
parents:
21278
diff
changeset
|
340 |
System.err.println(" <none> to print same info as Solaris pmap"); |
c5d341bc60dd
8027765: Make exit codes and stdout/stderr printing from jmap/jinfo/jstack/jps consistent
sla
parents:
21278
diff
changeset
|
341 |
System.err.println(" -heap to print java heap summary"); |
c5d341bc60dd
8027765: Make exit codes and stdout/stderr printing from jmap/jinfo/jstack/jps consistent
sla
parents:
21278
diff
changeset
|
342 |
System.err.println(" -histo[:live] to print histogram of java object heap; if the \"live\""); |
c5d341bc60dd
8027765: Make exit codes and stdout/stderr printing from jmap/jinfo/jstack/jps consistent
sla
parents:
21278
diff
changeset
|
343 |
System.err.println(" suboption is specified, only count live objects"); |
c5d341bc60dd
8027765: Make exit codes and stdout/stderr printing from jmap/jinfo/jstack/jps consistent
sla
parents:
21278
diff
changeset
|
344 |
System.err.println(" -clstats to print class loader statistics"); |
c5d341bc60dd
8027765: Make exit codes and stdout/stderr printing from jmap/jinfo/jstack/jps consistent
sla
parents:
21278
diff
changeset
|
345 |
System.err.println(" -finalizerinfo to print information on objects awaiting finalization"); |
c5d341bc60dd
8027765: Make exit codes and stdout/stderr printing from jmap/jinfo/jstack/jps consistent
sla
parents:
21278
diff
changeset
|
346 |
System.err.println(" -dump:<dump-options> to dump java heap in hprof binary format"); |
c5d341bc60dd
8027765: Make exit codes and stdout/stderr printing from jmap/jinfo/jstack/jps consistent
sla
parents:
21278
diff
changeset
|
347 |
System.err.println(" dump-options:"); |
c5d341bc60dd
8027765: Make exit codes and stdout/stderr printing from jmap/jinfo/jstack/jps consistent
sla
parents:
21278
diff
changeset
|
348 |
System.err.println(" live dump only live objects; if not specified,"); |
c5d341bc60dd
8027765: Make exit codes and stdout/stderr printing from jmap/jinfo/jstack/jps consistent
sla
parents:
21278
diff
changeset
|
349 |
System.err.println(" all objects in the heap are dumped."); |
c5d341bc60dd
8027765: Make exit codes and stdout/stderr printing from jmap/jinfo/jstack/jps consistent
sla
parents:
21278
diff
changeset
|
350 |
System.err.println(" format=b binary format"); |
c5d341bc60dd
8027765: Make exit codes and stdout/stderr printing from jmap/jinfo/jstack/jps consistent
sla
parents:
21278
diff
changeset
|
351 |
System.err.println(" file=<file> dump heap to <file>"); |
c5d341bc60dd
8027765: Make exit codes and stdout/stderr printing from jmap/jinfo/jstack/jps consistent
sla
parents:
21278
diff
changeset
|
352 |
System.err.println(" Example: jmap -dump:live,format=b,file=heap.bin <pid>"); |
c5d341bc60dd
8027765: Make exit codes and stdout/stderr printing from jmap/jinfo/jstack/jps consistent
sla
parents:
21278
diff
changeset
|
353 |
System.err.println(" -F force. Use with -dump:<dump-options> <pid> or -histo"); |
c5d341bc60dd
8027765: Make exit codes and stdout/stderr printing from jmap/jinfo/jstack/jps consistent
sla
parents:
21278
diff
changeset
|
354 |
System.err.println(" to force a heap dump or histogram when <pid> does not"); |
c5d341bc60dd
8027765: Make exit codes and stdout/stderr printing from jmap/jinfo/jstack/jps consistent
sla
parents:
21278
diff
changeset
|
355 |
System.err.println(" respond. The \"live\" suboption is not supported"); |
c5d341bc60dd
8027765: Make exit codes and stdout/stderr printing from jmap/jinfo/jstack/jps consistent
sla
parents:
21278
diff
changeset
|
356 |
System.err.println(" in this mode."); |
c5d341bc60dd
8027765: Make exit codes and stdout/stderr printing from jmap/jinfo/jstack/jps consistent
sla
parents:
21278
diff
changeset
|
357 |
System.err.println(" -h | -help to print this help message"); |
c5d341bc60dd
8027765: Make exit codes and stdout/stderr printing from jmap/jinfo/jstack/jps consistent
sla
parents:
21278
diff
changeset
|
358 |
System.err.println(" -J<flag> to pass <flag> directly to the runtime system"); |
2 | 359 |
} else { |
21673
c5d341bc60dd
8027765: Make exit codes and stdout/stderr printing from jmap/jinfo/jstack/jps consistent
sla
parents:
21278
diff
changeset
|
360 |
System.err.println(" jmap -histo <pid>"); |
c5d341bc60dd
8027765: Make exit codes and stdout/stderr printing from jmap/jinfo/jstack/jps consistent
sla
parents:
21278
diff
changeset
|
361 |
System.err.println(" (to connect to running process and print histogram of java object heap"); |
c5d341bc60dd
8027765: Make exit codes and stdout/stderr printing from jmap/jinfo/jstack/jps consistent
sla
parents:
21278
diff
changeset
|
362 |
System.err.println(" jmap -dump:<dump-options> <pid>"); |
c5d341bc60dd
8027765: Make exit codes and stdout/stderr printing from jmap/jinfo/jstack/jps consistent
sla
parents:
21278
diff
changeset
|
363 |
System.err.println(" (to connect to running process and dump java heap)"); |
c5d341bc60dd
8027765: Make exit codes and stdout/stderr printing from jmap/jinfo/jstack/jps consistent
sla
parents:
21278
diff
changeset
|
364 |
System.err.println(""); |
c5d341bc60dd
8027765: Make exit codes and stdout/stderr printing from jmap/jinfo/jstack/jps consistent
sla
parents:
21278
diff
changeset
|
365 |
System.err.println(" dump-options:"); |
c5d341bc60dd
8027765: Make exit codes and stdout/stderr printing from jmap/jinfo/jstack/jps consistent
sla
parents:
21278
diff
changeset
|
366 |
System.err.println(" format=b binary default"); |
c5d341bc60dd
8027765: Make exit codes and stdout/stderr printing from jmap/jinfo/jstack/jps consistent
sla
parents:
21278
diff
changeset
|
367 |
System.err.println(" file=<file> dump heap to <file>"); |
c5d341bc60dd
8027765: Make exit codes and stdout/stderr printing from jmap/jinfo/jstack/jps consistent
sla
parents:
21278
diff
changeset
|
368 |
System.err.println(""); |
c5d341bc60dd
8027765: Make exit codes and stdout/stderr printing from jmap/jinfo/jstack/jps consistent
sla
parents:
21278
diff
changeset
|
369 |
System.err.println(" Example: jmap -dump:format=b,file=heap.bin <pid>"); |
2 | 370 |
} |
371 |
||
21673
c5d341bc60dd
8027765: Make exit codes and stdout/stderr printing from jmap/jinfo/jstack/jps consistent
sla
parents:
21278
diff
changeset
|
372 |
System.exit(exit); |
2 | 373 |
} |
374 |
} |