src/hotspot/share/memory/metaspace/metaspaceDCmd.cpp
changeset 50309 37ebfe8bac7f
parent 50021 b8308d6356e7
child 51334 cc2c79d22508
equal deleted inserted replaced
50308:9ace9865028c 50309:37ebfe8bac7f
     1 /*
     1 /*
     2  * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
       
     3  * Copyright (c) 2018, SAP and/or its affiliates.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     5  *
     5  * This code is free software; you can redistribute it and/or modify it
     6  * 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
     7  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     8  * published by the Free Software Foundation.
    32 
    33 
    33 MetaspaceDCmd::MetaspaceDCmd(outputStream* output, bool heap)
    34 MetaspaceDCmd::MetaspaceDCmd(outputStream* output, bool heap)
    34   : DCmdWithParser(output, heap)
    35   : DCmdWithParser(output, heap)
    35   , _basic("basic", "Prints a basic summary (does not need a safepoint).", "BOOLEAN", false, "false")
    36   , _basic("basic", "Prints a basic summary (does not need a safepoint).", "BOOLEAN", false, "false")
    36   , _show_loaders("show-loaders", "Shows usage by class loader.", "BOOLEAN", false, "false")
    37   , _show_loaders("show-loaders", "Shows usage by class loader.", "BOOLEAN", false, "false")
       
    38   , _show_classes("show-classes", "If show-loaders is set, shows loaded classes for each loader.", "BOOLEAN", false, "false")
    37   , _by_chunktype("by-chunktype", "Break down numbers by chunk type.", "BOOLEAN", false, "false")
    39   , _by_chunktype("by-chunktype", "Break down numbers by chunk type.", "BOOLEAN", false, "false")
    38   , _by_spacetype("by-spacetype", "Break down numbers by loader type.", "BOOLEAN", false, "false")
    40   , _by_spacetype("by-spacetype", "Break down numbers by loader type.", "BOOLEAN", false, "false")
    39   , _show_vslist("vslist", "Shows details about the underlying virtual space.", "BOOLEAN", false, "false")
    41   , _show_vslist("vslist", "Shows details about the underlying virtual space.", "BOOLEAN", false, "false")
    40   , _show_vsmap("vsmap", "Shows chunk composition of the underlying virtual spaces", "BOOLEAN", false, "false")
    42   , _show_vsmap("vsmap", "Shows chunk composition of the underlying virtual spaces", "BOOLEAN", false, "false")
    41   , _scale("scale", "Memory usage in which to scale. Valid values are: 1, KB, MB or GB (fixed scale) "
    43   , _scale("scale", "Memory usage in which to scale. Valid values are: 1, KB, MB or GB (fixed scale) "
    42            "or \"dynamic\" for a dynamically choosen scale.",
    44            "or \"dynamic\" for a dynamically choosen scale.",
    43      "STRING", false, "dynamic")
    45      "STRING", false, "dynamic")
    44 {
    46 {
    45   _dcmdparser.add_dcmd_option(&_basic);
    47   _dcmdparser.add_dcmd_option(&_basic);
    46   _dcmdparser.add_dcmd_option(&_show_loaders);
    48   _dcmdparser.add_dcmd_option(&_show_loaders);
       
    49   _dcmdparser.add_dcmd_option(&_show_classes);
    47   _dcmdparser.add_dcmd_option(&_by_chunktype);
    50   _dcmdparser.add_dcmd_option(&_by_chunktype);
    48   _dcmdparser.add_dcmd_option(&_by_spacetype);
    51   _dcmdparser.add_dcmd_option(&_by_spacetype);
    49   _dcmdparser.add_dcmd_option(&_show_vslist);
    52   _dcmdparser.add_dcmd_option(&_show_vslist);
    50   _dcmdparser.add_dcmd_option(&_show_vsmap);
    53   _dcmdparser.add_dcmd_option(&_show_vsmap);
    51   _dcmdparser.add_dcmd_option(&_scale);
    54   _dcmdparser.add_dcmd_option(&_scale);
    85     MetaspaceUtils::print_basic_report(output(), scale);
    88     MetaspaceUtils::print_basic_report(output(), scale);
    86   } else {
    89   } else {
    87     // Full mode. Requires safepoint.
    90     // Full mode. Requires safepoint.
    88     int flags = 0;
    91     int flags = 0;
    89     if (_show_loaders.value())         flags |= MetaspaceUtils::rf_show_loaders;
    92     if (_show_loaders.value())         flags |= MetaspaceUtils::rf_show_loaders;
       
    93     if (_show_classes.value())         flags |= MetaspaceUtils::rf_show_classes;
    90     if (_by_chunktype.value())         flags |= MetaspaceUtils::rf_break_down_by_chunktype;
    94     if (_by_chunktype.value())         flags |= MetaspaceUtils::rf_break_down_by_chunktype;
    91     if (_by_spacetype.value())         flags |= MetaspaceUtils::rf_break_down_by_spacetype;
    95     if (_by_spacetype.value())         flags |= MetaspaceUtils::rf_break_down_by_spacetype;
    92     if (_show_vslist.value())          flags |= MetaspaceUtils::rf_show_vslist;
    96     if (_show_vslist.value())          flags |= MetaspaceUtils::rf_show_vslist;
    93     if (_show_vsmap.value())           flags |= MetaspaceUtils::rf_show_vsmap;
    97     if (_show_vsmap.value())           flags |= MetaspaceUtils::rf_show_vsmap;
    94     VM_PrintMetadata op(output(), scale, flags);
    98     VM_PrintMetadata op(output(), scale, flags);