hotspot/src/share/vm/services/diagnosticCommand.cpp
changeset 29071 73f45d04ad7a
parent 28836 d9c497544bf3
child 29074 fbd83ffd242b
equal deleted inserted replaced
29069:938c1c97ad3b 29071:73f45d04ad7a
     1 /*
     1 /*
     2  * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2011, 2015, 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.
    55   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<RunFinalizationDCmd>(full_export, true, false));
    55   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<RunFinalizationDCmd>(full_export, true, false));
    56 #if INCLUDE_SERVICES // Heap dumping/inspection supported
    56 #if INCLUDE_SERVICES // Heap dumping/inspection supported
    57   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<HeapDumpDCmd>(DCmd_Source_Internal | DCmd_Source_AttachAPI, true, false));
    57   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<HeapDumpDCmd>(DCmd_Source_Internal | DCmd_Source_AttachAPI, true, false));
    58   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassHistogramDCmd>(full_export, true, false));
    58   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassHistogramDCmd>(full_export, true, false));
    59   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassStatsDCmd>(full_export, true, false));
    59   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassStatsDCmd>(full_export, true, false));
       
    60   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassHierarchyDCmd>(full_export, true, false));
    60   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<SymboltableDCmd>(full_export, true, false));
    61   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<SymboltableDCmd>(full_export, true, false));
    61   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<StringtableDCmd>(full_export, true, false));
    62   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<StringtableDCmd>(full_export, true, false));
    62 #endif // INCLUDE_SERVICES
    63 #endif // INCLUDE_SERVICES
    63   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ThreadDumpDCmd>(full_export, true, false));
    64   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ThreadDumpDCmd>(full_export, true, false));
    64   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<RotateGCLogDCmd>(full_export, true, false));
    65   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<RotateGCLogDCmd>(full_export, true, false));
   693 void CodeCacheDCmd::execute(DCmdSource source, TRAPS) {
   694 void CodeCacheDCmd::execute(DCmdSource source, TRAPS) {
   694   VM_PrintCodeCache printCodeCacheOp(output());
   695   VM_PrintCodeCache printCodeCacheOp(output());
   695   VMThread::execute(&printCodeCacheOp);
   696   VMThread::execute(&printCodeCacheOp);
   696 }
   697 }
   697 
   698 
       
   699 #if INCLUDE_SERVICES
       
   700 ClassHierarchyDCmd::ClassHierarchyDCmd(outputStream* output, bool heap) :
       
   701                                        DCmdWithParser(output, heap),
       
   702   _print_interfaces("-i", "Inherited interfaces should be printed.", "BOOLEAN", false, "false"),
       
   703   _print_subclasses("-s", "If a classname is specified, print its subclasses. "
       
   704                     "Otherwise only its superclasses are printed.", "BOOLEAN", false, "false"),
       
   705   _classname("classname", "Name of class whose hierarchy should be printed. "
       
   706              "If not specified, all class hierarchies are printed.",
       
   707              "STRING", false) {
       
   708   _dcmdparser.add_dcmd_option(&_print_interfaces);
       
   709   _dcmdparser.add_dcmd_option(&_print_subclasses);
       
   710   _dcmdparser.add_dcmd_argument(&_classname);
       
   711 }
       
   712 
       
   713 void ClassHierarchyDCmd::execute(DCmdSource source, TRAPS) {
       
   714   VM_PrintClassHierarchy printClassHierarchyOp(output(), _print_interfaces.value(),
       
   715                                                _print_subclasses.value(), _classname.value());
       
   716   VMThread::execute(&printClassHierarchyOp);
       
   717 }
       
   718 
       
   719 int ClassHierarchyDCmd::num_arguments() {
       
   720   ResourceMark rm;
       
   721   ClassHierarchyDCmd* dcmd = new ClassHierarchyDCmd(NULL, false);
       
   722   if (dcmd != NULL) {
       
   723     DCmdMark mark(dcmd);
       
   724     return dcmd->_dcmdparser.num_arguments();
       
   725   } else {
       
   726     return 0;
       
   727   }
       
   728 }
       
   729 
       
   730 #endif