comparison agent/src/share/classes/sun/jvm/hotspot/tools/JMap.java @ 8112:b685ca4f4fb9

8008536: Add HotSpot support for printing class loader statistics for JMap Reviewed-by: sla, brutisso
author ehelin
date Wed, 20 Feb 2013 16:41:23 +0100
parents c18cbe5936b8
children 9075044ed66b
comparison
equal deleted inserted replaced
8110:9a8ee5301f33 8112:b685ca4f4fb9
1 /* 1 /*
2 * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 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 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
43 public String getName() { 43 public String getName() {
44 return "jmap"; 44 return "jmap";
45 } 45 }
46 46
47 protected String getCommandFlags() { 47 protected String getCommandFlags() {
48 return "-heap|-heap:format=b|-histo|-permstat|-finalizerinfo"; 48 return "-heap|-heap:format=b|-histo|-clstats|-finalizerinfo";
49 } 49 }
50 50
51 protected void printFlagsUsage() { 51 protected void printFlagsUsage() {
52 System.out.println(" <no option>\tto print same info as Solaris pmap"); 52 System.out.println(" <no option>\tto print same info as Solaris pmap");
53 System.out.println(" -heap\tto print java heap summary"); 53 System.out.println(" -heap\tto print java heap summary");
54 System.out.println(" -heap:format=b\tto dump java heap in hprof binary format"); 54 System.out.println(" -heap:format=b\tto dump java heap in hprof binary format");
55 System.out.println(" -histo\tto print histogram of java object heap"); 55 System.out.println(" -histo\tto print histogram of java object heap");
56 System.out.println(" -permstat\tto print permanent generation statistics"); 56 System.out.println(" -clstats\tto print class loader statistics");
57 System.out.println(" -finalizerinfo\tto print information on objects awaiting finalization"); 57 System.out.println(" -finalizerinfo\tto print information on objects awaiting finalization");
58 super.printFlagsUsage(); 58 super.printFlagsUsage();
59 } 59 }
60 60
61 public static final int MODE_HEAP_SUMMARY = 0; 61 public static final int MODE_HEAP_SUMMARY = 0;
62 public static final int MODE_HISTOGRAM = 1; 62 public static final int MODE_HISTOGRAM = 1;
63 public static final int MODE_PERMSTAT = 2; 63 public static final int MODE_CLSTATS = 2;
64 public static final int MODE_PMAP = 3; 64 public static final int MODE_PMAP = 3;
65 public static final int MODE_HEAP_GRAPH_HPROF_BIN = 4; 65 public static final int MODE_HEAP_GRAPH_HPROF_BIN = 4;
66 public static final int MODE_HEAP_GRAPH_GXL = 5; 66 public static final int MODE_HEAP_GRAPH_GXL = 5;
67 public static final int MODE_FINALIZERINFO = 6; 67 public static final int MODE_FINALIZERINFO = 6;
68 68
76 76
77 case MODE_HISTOGRAM: 77 case MODE_HISTOGRAM:
78 tool = new ObjectHistogram(); 78 tool = new ObjectHistogram();
79 break; 79 break;
80 80
81 case MODE_PERMSTAT: 81 case MODE_CLSTATS:
82 tool = new PermStat(); 82 tool = new ClassLoaderStats();
83 break; 83 break;
84 84
85 case MODE_PMAP: 85 case MODE_PMAP:
86 tool = new PMap(); 86 tool = new PMap();
87 break; 87 break;
116 if (modeFlag.equals("-heap")) { 116 if (modeFlag.equals("-heap")) {
117 mode = MODE_HEAP_SUMMARY; 117 mode = MODE_HEAP_SUMMARY;
118 } else if (modeFlag.equals("-histo")) { 118 } else if (modeFlag.equals("-histo")) {
119 mode = MODE_HISTOGRAM; 119 mode = MODE_HISTOGRAM;
120 } else if (modeFlag.equals("-permstat")) { 120 } else if (modeFlag.equals("-permstat")) {
121 mode = MODE_PERMSTAT; 121 mode = MODE_CLSTATS;
122 } else if (modeFlag.equals("-clstats")) {
123 mode = MODE_CLSTATS;
122 } else if (modeFlag.equals("-finalizerinfo")) { 124 } else if (modeFlag.equals("-finalizerinfo")) {
123 mode = MODE_FINALIZERINFO; 125 mode = MODE_FINALIZERINFO;
124 } else { 126 } else {
125 int index = modeFlag.indexOf("-heap:format="); 127 int index = modeFlag.indexOf("-heap:format=");
126 if (index != -1) { 128 if (index != -1) {