7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 package sun.jvm.hotspot.tools;
26
27 import sun.jvm.hotspot.runtime.*;
28 import sun.jvm.hotspot.debugger.JVMDebugger;
29
30 public class JInfo extends Tool {
31 public JInfo() {
32 super();
33 }
34
35 public JInfo(int m) {
36 mode = m;
37 }
38
39 public JInfo(JVMDebugger d) {
40 super(d);
41 }
42
43 protected boolean needsJavaPrefix() {
44 return false;
45 }
46
47 public String getName() {
48 return "jinfo";
121 if (mode != MODE_BOTH) {
122 // we have to consume first flag argument.
123 String[] newArgs = new String[args.length - 1];
124 for (int i = 0; i < newArgs.length; i++) {
125 newArgs[i] = args[i + 1];
126 }
127 args = newArgs;
128 }
129 break;
130 }
131
132 default:
133 new JInfo(mode).usage();
134 }
135
136 JInfo jinfo = new JInfo(mode);
137 jinfo.execute(args);
138 }
139
140 private void printVMFlags() {
141 String str = Arguments.getJVMFlags();
142 if (str != null) {
143 System.out.println(str);
144 }
145 str = Arguments.getJVMArgs();
146 if (str != null) {
147 System.out.println(str);
148 }
149 }
150
151 private int mode;
152 }
|
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 package sun.jvm.hotspot.tools;
26
27 import sun.jvm.hotspot.debugger.JVMDebugger;
28 import sun.jvm.hotspot.runtime.Arguments;
29 import sun.jvm.hotspot.runtime.VM;
30
31 public class JInfo extends Tool {
32 public JInfo() {
33 super();
34 }
35
36 public JInfo(int m) {
37 mode = m;
38 }
39
40 public JInfo(JVMDebugger d) {
41 super(d);
42 }
43
44 protected boolean needsJavaPrefix() {
45 return false;
46 }
47
48 public String getName() {
49 return "jinfo";
122 if (mode != MODE_BOTH) {
123 // we have to consume first flag argument.
124 String[] newArgs = new String[args.length - 1];
125 for (int i = 0; i < newArgs.length; i++) {
126 newArgs[i] = args[i + 1];
127 }
128 args = newArgs;
129 }
130 break;
131 }
132
133 default:
134 new JInfo(mode).usage();
135 }
136
137 JInfo jinfo = new JInfo(mode);
138 jinfo.execute(args);
139 }
140
141 private void printVMFlags() {
142 VM.Flag[] flags = VM.getVM().getCommandLineFlags();
143 System.out.print("Non-default VM flags: ");
144 for (int f = 0; f < flags.length; f++) {
145 VM.Flag flag = flags[f];
146 if (flag.getOrigin() == 0) {
147 // only print flags which aren't their defaults
148 continue;
149 }
150 if (flag.isBool()) {
151 String onoff = flag.getBool() ? "+" : "-";
152 System.out.print("-XX:"+onoff+flag.getName() + " ");
153 }
154 else {
155 System.out.print("-XX:"+flag.getName() + "=" + flag.getValue() + " ");
156 }
157 }
158 System.out.println();
159
160 System.out.println("Command line: "+Arguments.getJVMArgs() + Arguments.getJVMFlags());
161 }
162
163 private int mode;
164 }
|