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 #include "precompiled.hpp"
25 #include "memory/metaspace.hpp"
26 #include "services/diagnosticCommand.hpp"
27
28 MetaspaceDCmd::MetaspaceDCmd(outputStream* output, bool heap): DCmd(output, heap) {
29 }
30
31 void MetaspaceDCmd::execute(DCmdSource source, TRAPS) {
32 const size_t scale = 1 * K;
33 VM_PrintMetadata op(output(), scale);
34 VMThread::execute(&op);
35 }
36
|
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 #include "precompiled.hpp"
25 #include "memory/metaspace.hpp"
26 #include "services/diagnosticCommand.hpp"
27 #include "services/nmtCommon.hpp"
28
29
30 MetaspaceDCmd::MetaspaceDCmd(outputStream* output, bool heap)
31 : DCmdWithParser(output, heap)
32 , _show_loaders("loaders", "Shows usage by class loader.", "BOOLEAN", false, "false")
33 , _by_chunktype("by_chunktype", "Break down numbers by chunk type.", "BOOLEAN", false, "false")
34 , _by_spacetype("by_spacetype", "Break down numbers by loader type.", "BOOLEAN", false, "false")
35 , _show_vslist("vslist", "Shows details about the virtual space list", "BOOLEAN", false, "false")
36 , _show_vsmap("vsmap", "Shows a map of the virtual spaces", "BOOLEAN", false, "false")
37 , _show_chunk_freelist("chunk-freelist", "Shows details about the free chunk list", "BOOLEAN", false, "false")
38 , _scale("scale", "Memory usage in which to scale. Valid values are: 1, KB, MB or GB (fixed scale) "
39 "or \"dynamic\" for dynamically choosen scale.",
40 "STRING", false, "dynamic")
41 {
42 _dcmdparser.add_dcmd_option(&_show_loaders);
43 _dcmdparser.add_dcmd_option(&_by_chunktype);
44 _dcmdparser.add_dcmd_option(&_by_spacetype);
45 _dcmdparser.add_dcmd_option(&_show_vslist);
46 _dcmdparser.add_dcmd_option(&_show_vsmap);
47 _dcmdparser.add_dcmd_option(&_show_chunk_freelist);
48 _dcmdparser.add_dcmd_option(&_scale);
49 }
50
51 void MetaspaceDCmd::execute(DCmdSource source, TRAPS) {
52 // Parse scale value.
53 const char* scale_value = _scale.value();
54 size_t scale = 0;
55 if (scale_value != NULL) {
56 if (strcasecmp("dynamic", scale_value) == 0) {
57 scale = 0;
58 } else {
59 scale = NMTUtil::scale_from_name(scale_value);
60 if (scale == 0) {
61 output()->print_cr("Invalid scale: \"%s\". Will use dynamic scaling.", scale_value);
62 }
63 }
64 }
65 // Parse flags.
66 int flags = 0;
67 if (_show_loaders.value()) flags |= MetaspaceUtils::rf_show_loaders;
68 if (_by_chunktype.value()) flags |= MetaspaceUtils::rf_break_down_by_chunktype;
69 if (_by_spacetype.value()) flags |= MetaspaceUtils::rf_break_down_by_spacetype;
70 if (_show_vslist.value()) flags |= MetaspaceUtils::rf_show_vslist;
71 if (_show_vsmap.value()) flags |= MetaspaceUtils::rf_show_vsmap;
72 if (_show_chunk_freelist.value()) flags |= MetaspaceUtils::rf_show_chunk_freelist;
73 VM_PrintMetadata op(output(), scale, flags);
74 VMThread::execute(&op);
75 }
76
|