Java Code Examples for sun.jvm.hotspot.runtime.VM#Flag

The following examples show how to use sun.jvm.hotspot.runtime.VM#Flag . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CommandProcessor.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public void doit(Tokens t) {
    int tokens = t.countTokens();
    if (tokens != 0 && tokens != 1) {
        usage();
    } else {
        String name = tokens > 0 ? t.nextToken() : null;
        boolean nonDefault = false;
        if (name != null && name.equals("-nd")) {
            name = null;
            nonDefault = true;
        }

        VM.Flag[] flags = VM.getVM().getCommandLineFlags();
        if (flags == null) {
            out.println("Command Flag info not available (use 1.4.1_03 or later)!");
        } else {
            boolean printed = false;
            for (int f = 0; f < flags.length; f++) {
                VM.Flag flag = flags[f];
                if (name == null || flag.getName().equals(name)) {

                    if (nonDefault && flag.getOrigin() == 0) {
                        // only print flags which aren't their defaults
                        continue;
                    }
                    out.println(flag.getName() + " = " + flag.getValue() + " " + flag.getOrigin());
                    printed = true;
                }
            }
            if (name != null && !printed) {
                out.println("Couldn't find flag: " + name);
            }
        }
    }
}
 
Example 2
Source File: JInfo.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private void printVMFlags() {
    VM.Flag[] flags = VM.getVM().getCommandLineFlags();
    System.out.print("Non-default VM flags: ");
    for (VM.Flag flag : flags) {
        if (flag.getOrigin() == 0) {
            // only print flags which aren't their defaults
            continue;
        }
        if (flag.isBool()) {
            String onoff = flag.getBool() ? "+" : "-";
            System.out.print("-XX:" + onoff + flag.getName() + " ");
        } else {
            System.out.print("-XX:" + flag.getName() + "="
                    + flag.getValue() + " ");
        }
    }
    System.out.println();

    System.out.print("Command line: ");
    String str = Arguments.getJVMFlags();
    if (str != null) {
        System.out.print(str + " ");
    }
    str = Arguments.getJVMArgs();
    if (str != null) {
        System.out.print(str);
    }
    System.out.println();
}
 
Example 3
Source File: CommandProcessor.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public void doit(Tokens t) {
    int tokens = t.countTokens();
    if (tokens != 0 && tokens != 1) {
        usage();
    } else {
        String name = tokens > 0 ? t.nextToken() : null;
        boolean nonDefault = false;
        if (name != null && name.equals("-nd")) {
            name = null;
            nonDefault = true;
        }

        VM.Flag[] flags = VM.getVM().getCommandLineFlags();
        if (flags == null) {
            out.println("Command Flag info not available (use 1.4.1_03 or later)!");
        } else {
            boolean printed = false;
            for (int f = 0; f < flags.length; f++) {
                VM.Flag flag = flags[f];
                if (name == null || flag.getName().equals(name)) {

                    if (nonDefault && flag.getOrigin() == 0) {
                        // only print flags which aren't their defaults
                        continue;
                    }
                    out.println(flag.getName() + " = " + flag.getValue() + " " + flag.getOrigin());
                    printed = true;
                }
            }
            if (name != null && !printed) {
                out.println("Couldn't find flag: " + name);
            }
        }
    }
}
 
Example 4
Source File: JInfo.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private void printVMFlags() {
    VM.Flag[] flags = VM.getVM().getCommandLineFlags();
    System.out.print("Non-default VM flags: ");
    for (VM.Flag flag : flags) {
        if (flag.getOrigin() == 0) {
            // only print flags which aren't their defaults
            continue;
        }
        if (flag.isBool()) {
            String onoff = flag.getBool() ? "+" : "-";
            System.out.print("-XX:" + onoff + flag.getName() + " ");
        } else {
            System.out.print("-XX:" + flag.getName() + "="
                    + flag.getValue() + " ");
        }
    }
    System.out.println();

    System.out.print("Command line: ");
    String str = Arguments.getJVMFlags();
    if (str != null) {
        System.out.print(str + " ");
    }
    str = Arguments.getJVMArgs();
    if (str != null) {
        System.out.print(str);
    }
    System.out.println();
}
 
Example 5
Source File: CommandProcessor.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public void doit(Tokens t) {
    int tokens = t.countTokens();
    if (tokens != 0 && tokens != 1) {
        usage();
    } else {
        String name = tokens > 0 ? t.nextToken() : null;
        boolean nonDefault = false;
        if (name != null && name.equals("-nd")) {
            name = null;
            nonDefault = true;
        }

        VM.Flag[] flags = VM.getVM().getCommandLineFlags();
        if (flags == null) {
            out.println("Command Flag info not available (use 1.4.1_03 or later)!");
        } else {
            boolean printed = false;
            for (int f = 0; f < flags.length; f++) {
                VM.Flag flag = flags[f];
                if (name == null || flag.getName().equals(name)) {

                    if (nonDefault && flag.getOrigin() == 0) {
                        // only print flags which aren't their defaults
                        continue;
                    }
                    out.println(flag.getName() + " = " + flag.getValue() + " " + flag.getOrigin());
                    printed = true;
                }
            }
            if (name != null && !printed) {
                out.println("Couldn't find flag: " + name);
            }
        }
    }
}
 
Example 6
Source File: JInfo.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private void printVMFlags() {
    VM.Flag[] flags = VM.getVM().getCommandLineFlags();
    System.out.print("Non-default VM flags: ");
    for (VM.Flag flag : flags) {
        if (flag.getOrigin() == 0) {
            // only print flags which aren't their defaults
            continue;
        }
        if (flag.isBool()) {
            String onoff = flag.getBool() ? "+" : "-";
            System.out.print("-XX:" + onoff + flag.getName() + " ");
        } else {
            System.out.print("-XX:" + flag.getName() + "="
                    + flag.getValue() + " ");
        }
    }
    System.out.println();

    System.out.print("Command line: ");
    String str = Arguments.getJVMFlags();
    if (str != null) {
        System.out.print(str + " ");
    }
    str = Arguments.getJVMArgs();
    if (str != null) {
        System.out.print(str);
    }
    System.out.println();
}
 
Example 7
Source File: CommandProcessor.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public void doit(Tokens t) {
    int tokens = t.countTokens();
    if (tokens != 0 && tokens != 1) {
        usage();
    } else {
        String name = tokens > 0 ? t.nextToken() : null;
        boolean nonDefault = false;
        if (name != null && name.equals("-nd")) {
            name = null;
            nonDefault = true;
        }

        VM.Flag[] flags = VM.getVM().getCommandLineFlags();
        if (flags == null) {
            out.println("Command Flag info not available (use 1.4.1_03 or later)!");
        } else {
            boolean printed = false;
            for (int f = 0; f < flags.length; f++) {
                VM.Flag flag = flags[f];
                if (name == null || flag.getName().equals(name)) {

                    if (nonDefault && flag.getOrigin() == 0) {
                        // only print flags which aren't their defaults
                        continue;
                    }
                    out.println(flag.getName() + " = " + flag.getValue() + " " + flag.getOrigin());
                    printed = true;
                }
            }
            if (name != null && !printed) {
                out.println("Couldn't find flag: " + name);
            }
        }
    }
}
 
Example 8
Source File: JInfo.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private void printVMFlags() {
    VM.Flag[] flags = VM.getVM().getCommandLineFlags();
    System.out.print("Non-default VM flags: ");
    for (VM.Flag flag : flags) {
        if (flag.getOrigin() == 0) {
            // only print flags which aren't their defaults
            continue;
        }
        if (flag.isBool()) {
            String onoff = flag.getBool() ? "+" : "-";
            System.out.print("-XX:" + onoff + flag.getName() + " ");
        } else {
            System.out.print("-XX:" + flag.getName() + "="
                    + flag.getValue() + " ");
        }
    }
    System.out.println();

    System.out.print("Command line: ");
    String str = Arguments.getJVMFlags();
    if (str != null) {
        System.out.print(str + " ");
    }
    str = Arguments.getJVMArgs();
    if (str != null) {
        System.out.print(str);
    }
    System.out.println();
}
 
Example 9
Source File: CommandProcessor.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public void doit(Tokens t) {
    int tokens = t.countTokens();
    if (tokens != 0 && tokens != 1) {
        usage();
    } else {
        String name = tokens > 0 ? t.nextToken() : null;
        boolean nonDefault = false;
        if (name != null && name.equals("-nd")) {
            name = null;
            nonDefault = true;
        }

        VM.Flag[] flags = VM.getVM().getCommandLineFlags();
        if (flags == null) {
            out.println("Command Flag info not available (use 1.4.1_03 or later)!");
        } else {
            boolean printed = false;
            for (int f = 0; f < flags.length; f++) {
                VM.Flag flag = flags[f];
                if (name == null || flag.getName().equals(name)) {

                    if (nonDefault && flag.getOrigin() == 0) {
                        // only print flags which aren't their defaults
                        continue;
                    }
                    out.println(flag.getName() + " = " + flag.getValue() + " " + flag.getOrigin());
                    printed = true;
                }
            }
            if (name != null && !printed) {
                out.println("Couldn't find flag: " + name);
            }
        }
    }
}
 
Example 10
Source File: JInfo.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private void printVMFlags() {
    VM.Flag[] flags = VM.getVM().getCommandLineFlags();
    System.out.print("Non-default VM flags: ");
    for (VM.Flag flag : flags) {
        if (flag.getOrigin() == 0) {
            // only print flags which aren't their defaults
            continue;
        }
        if (flag.isBool()) {
            String onoff = flag.getBool() ? "+" : "-";
            System.out.print("-XX:" + onoff + flag.getName() + " ");
        } else {
            System.out.print("-XX:" + flag.getName() + "="
                    + flag.getValue() + " ");
        }
    }
    System.out.println();

    System.out.print("Command line: ");
    String str = Arguments.getJVMFlags();
    if (str != null) {
        System.out.print(str + " ");
    }
    str = Arguments.getJVMArgs();
    if (str != null) {
        System.out.print(str);
    }
    System.out.println();
}
 
Example 11
Source File: CommandProcessor.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public void doit(Tokens t) {
    int tokens = t.countTokens();
    if (tokens != 0 && tokens != 1) {
        usage();
    } else {
        String name = tokens > 0 ? t.nextToken() : null;
        boolean nonDefault = false;
        if (name != null && name.equals("-nd")) {
            name = null;
            nonDefault = true;
        }

        VM.Flag[] flags = VM.getVM().getCommandLineFlags();
        if (flags == null) {
            out.println("Command Flag info not available (use 1.4.1_03 or later)!");
        } else {
            boolean printed = false;
            for (int f = 0; f < flags.length; f++) {
                VM.Flag flag = flags[f];
                if (name == null || flag.getName().equals(name)) {

                    if (nonDefault && flag.getOrigin() == 0) {
                        // only print flags which aren't their defaults
                        continue;
                    }
                    out.println(flag.getName() + " = " + flag.getValue() + " " + flag.getOrigin());
                    printed = true;
                }
            }
            if (name != null && !printed) {
                out.println("Couldn't find flag: " + name);
            }
        }
    }
}
 
Example 12
Source File: JInfo.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private void printVMFlags() {
    VM.Flag[] flags = VM.getVM().getCommandLineFlags();
    System.out.print("Non-default VM flags: ");
    for (VM.Flag flag : flags) {
        if (flag.getOrigin() == 0) {
            // only print flags which aren't their defaults
            continue;
        }
        if (flag.isBool()) {
            String onoff = flag.getBool() ? "+" : "-";
            System.out.print("-XX:" + onoff + flag.getName() + " ");
        } else {
            System.out.print("-XX:" + flag.getName() + "="
                    + flag.getValue() + " ");
        }
    }
    System.out.println();

    System.out.print("Command line: ");
    String str = Arguments.getJVMFlags();
    if (str != null) {
        System.out.print(str + " ");
    }
    str = Arguments.getJVMArgs();
    if (str != null) {
        System.out.print(str);
    }
    System.out.println();
}
 
Example 13
Source File: CommandProcessor.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public void doit(Tokens t) {
    int tokens = t.countTokens();
    if (tokens != 0 && tokens != 1) {
        usage();
    } else {
        String name = tokens > 0 ? t.nextToken() : null;
        boolean nonDefault = false;
        if (name != null && name.equals("-nd")) {
            name = null;
            nonDefault = true;
        }

        VM.Flag[] flags = VM.getVM().getCommandLineFlags();
        if (flags == null) {
            out.println("Command Flag info not available (use 1.4.1_03 or later)!");
        } else {
            boolean printed = false;
            for (int f = 0; f < flags.length; f++) {
                VM.Flag flag = flags[f];
                if (name == null || flag.getName().equals(name)) {

                    if (nonDefault && flag.getOrigin() == 0) {
                        // only print flags which aren't their defaults
                        continue;
                    }
                    out.println(flag.getName() + " = " + flag.getValue() + " " + flag.getOrigin());
                    printed = true;
                }
            }
            if (name != null && !printed) {
                out.println("Couldn't find flag: " + name);
            }
        }
    }
}
 
Example 14
Source File: JInfo.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private void printVMFlags() {
    VM.Flag[] flags = VM.getVM().getCommandLineFlags();
    System.out.print("Non-default VM flags: ");
    for (VM.Flag flag : flags) {
        if (flag.getOrigin() == 0) {
            // only print flags which aren't their defaults
            continue;
        }
        if (flag.isBool()) {
            String onoff = flag.getBool() ? "+" : "-";
            System.out.print("-XX:" + onoff + flag.getName() + " ");
        } else {
            System.out.print("-XX:" + flag.getName() + "="
                    + flag.getValue() + " ");
        }
    }
    System.out.println();

    System.out.print("Command line: ");
    String str = Arguments.getJVMFlags();
    if (str != null) {
        System.out.print(str + " ");
    }
    str = Arguments.getJVMArgs();
    if (str != null) {
        System.out.print(str);
    }
    System.out.println();
}
 
Example 15
Source File: CommandProcessor.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public void doit(Tokens t) {
    int tokens = t.countTokens();
    if (tokens != 0 && tokens != 1) {
        usage();
    } else {
        String name = tokens > 0 ? t.nextToken() : null;
        boolean nonDefault = false;
        if (name != null && name.equals("-nd")) {
            name = null;
            nonDefault = true;
        }

        VM.Flag[] flags = VM.getVM().getCommandLineFlags();
        if (flags == null) {
            out.println("Command Flag info not available (use 1.4.1_03 or later)!");
        } else {
            boolean printed = false;
            for (int f = 0; f < flags.length; f++) {
                VM.Flag flag = flags[f];
                if (name == null || flag.getName().equals(name)) {

                    if (nonDefault && flag.getOrigin() == 0) {
                        // only print flags which aren't their defaults
                        continue;
                    }
                    out.println(flag.getName() + " = " + flag.getValue() + " " + flag.getOrigin());
                    printed = true;
                }
            }
            if (name != null && !printed) {
                out.println("Couldn't find flag: " + name);
            }
        }
    }
}
 
Example 16
Source File: JInfo.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private void printVMFlags() {
    VM.Flag[] flags = VM.getVM().getCommandLineFlags();
    System.out.print("Non-default VM flags: ");
    for (VM.Flag flag : flags) {
        if (flag.getOrigin() == 0) {
            // only print flags which aren't their defaults
            continue;
        }
        if (flag.isBool()) {
            String onoff = flag.getBool() ? "+" : "-";
            System.out.print("-XX:" + onoff + flag.getName() + " ");
        } else {
            System.out.print("-XX:" + flag.getName() + "="
                    + flag.getValue() + " ");
        }
    }
    System.out.println();

    System.out.print("Command line: ");
    String str = Arguments.getJVMFlags();
    if (str != null) {
        System.out.print(str + " ");
    }
    str = Arguments.getJVMArgs();
    if (str != null) {
        System.out.print(str);
    }
    System.out.println();
}