src/share/vm/services/memoryService.hpp

Mon, 12 Nov 2012 16:15:05 -0500

author
hseigel
date
Mon, 12 Nov 2012 16:15:05 -0500
changeset 4278
070d523b96a7
parent 4037
da91efe96a93
child 4825
dbd5837b342f
permissions
-rw-r--r--

8001471: Klass::cast() does nothing
Summary: Remove function Klass::cast() and calls to it.
Reviewed-by: dholmes, coleenp

     1 /*
     2  * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     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
     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  */
    25 #ifndef SHARE_VM_SERVICES_MEMORYSERVICE_HPP
    26 #define SHARE_VM_SERVICES_MEMORYSERVICE_HPP
    28 #include "memory/allocation.hpp"
    29 #include "memory/generation.hpp"
    30 #include "runtime/handles.hpp"
    31 #include "services/memoryUsage.hpp"
    32 #include "gc_interface/gcCause.hpp"
    34 // Forward declaration
    35 class MemoryPool;
    36 class MemoryManager;
    37 class GCMemoryManager;
    38 class CollectedHeap;
    39 class Generation;
    40 class DefNewGeneration;
    41 class PSYoungGen;
    42 class PSOldGen;
    43 class CodeHeap;
    44 class ContiguousSpace;
    45 class CompactibleFreeListSpace;
    46 class GenCollectedHeap;
    47 class ParallelScavengeHeap;
    48 class G1CollectedHeap;
    50 // VM Monitoring and Management Support
    52 class MemoryService : public AllStatic {
    53 private:
    54   enum {
    55     init_pools_list_size = 10,
    56     init_managers_list_size = 5
    57   };
    59   // index for minor and major generations
    60   enum {
    61     minor = 0,
    62     major = 1,
    63     n_gens = 2
    64   };
    66   static GrowableArray<MemoryPool*>*    _pools_list;
    67   static GrowableArray<MemoryManager*>* _managers_list;
    69   // memory managers for minor and major GC statistics
    70   static GCMemoryManager*               _major_gc_manager;
    71   static GCMemoryManager*               _minor_gc_manager;
    73   // Code heap memory pool
    74   static MemoryPool*                    _code_heap_pool;
    76   static void add_generation_memory_pool(Generation* gen,
    77                                          MemoryManager* major_mgr,
    78                                          MemoryManager* minor_mgr);
    79   static void add_generation_memory_pool(Generation* gen,
    80                                          MemoryManager* major_mgr) {
    81     add_generation_memory_pool(gen, major_mgr, NULL);
    82   }
    85   static void add_psYoung_memory_pool(PSYoungGen* gen,
    86                                       MemoryManager* major_mgr,
    87                                       MemoryManager* minor_mgr);
    88   static void add_psOld_memory_pool(PSOldGen* gen,
    89                                     MemoryManager* mgr);
    91   static void add_g1YoungGen_memory_pool(G1CollectedHeap* g1h,
    92                                          MemoryManager* major_mgr,
    93                                          MemoryManager* minor_mgr);
    94   static void add_g1OldGen_memory_pool(G1CollectedHeap* g1h,
    95                                        MemoryManager* mgr);
    97   static MemoryPool* add_space(ContiguousSpace* space,
    98                                const char* name,
    99                                bool is_heap,
   100                                size_t max_size,
   101                                bool support_usage_threshold);
   102   static MemoryPool* add_survivor_spaces(DefNewGeneration* gen,
   103                                          const char* name,
   104                                          bool is_heap,
   105                                          size_t max_size,
   106                                          bool support_usage_threshold);
   107   static MemoryPool* add_gen(Generation* gen,
   108                              const char* name,
   109                              bool is_heap,
   110                              bool support_usage_threshold);
   111   static MemoryPool* add_cms_space(CompactibleFreeListSpace* space,
   112                                    const char* name,
   113                                    bool is_heap,
   114                                    size_t max_size,
   115                                    bool support_usage_threshold);
   117   static void add_gen_collected_heap_info(GenCollectedHeap* heap);
   118   static void add_parallel_scavenge_heap_info(ParallelScavengeHeap* heap);
   119   static void add_g1_heap_info(G1CollectedHeap* g1h);
   121 public:
   122   static void set_universe_heap(CollectedHeap* heap);
   123   static void add_code_heap_memory_pool(CodeHeap* heap);
   125   static MemoryPool*    get_memory_pool(instanceHandle pool);
   126   static MemoryManager* get_memory_manager(instanceHandle mgr);
   128   static const int num_memory_pools() {
   129     return _pools_list->length();
   130   }
   131   static const int num_memory_managers() {
   132     return _managers_list->length();
   133   }
   135   static MemoryPool* get_memory_pool(int index) {
   136     return _pools_list->at(index);
   137   }
   139   static MemoryManager* get_memory_manager(int index) {
   140     return _managers_list->at(index);
   141   }
   143   static void track_memory_usage();
   144   static void track_code_cache_memory_usage() {
   145     track_memory_pool_usage(_code_heap_pool);
   146   }
   147   static void track_memory_pool_usage(MemoryPool* pool);
   149   static void gc_begin(bool fullGC, bool recordGCBeginTime,
   150                        bool recordAccumulatedGCTime,
   151                        bool recordPreGCUsage, bool recordPeakUsage);
   152   static void gc_end(bool fullGC, bool recordPostGCUsage,
   153                      bool recordAccumulatedGCTime,
   154                      bool recordGCEndTime, bool countCollection,
   155                      GCCause::Cause cause);
   158   static void oops_do(OopClosure* f);
   160   static bool get_verbose() { return PrintGC; }
   161   static bool set_verbose(bool verbose);
   163   // Create an instance of java/lang/management/MemoryUsage
   164   static Handle create_MemoryUsage_obj(MemoryUsage usage, TRAPS);
   166   static const GCMemoryManager* get_minor_gc_manager() {
   167       return _minor_gc_manager;
   168   }
   170   static const GCMemoryManager* get_major_gc_manager() {
   171       return _major_gc_manager;
   172   }
   173 };
   175 class TraceMemoryManagerStats : public StackObj {
   176 private:
   177   bool         _fullGC;
   178   bool         _recordGCBeginTime;
   179   bool         _recordPreGCUsage;
   180   bool         _recordPeakUsage;
   181   bool         _recordPostGCUsage;
   182   bool         _recordAccumulatedGCTime;
   183   bool         _recordGCEndTime;
   184   bool         _countCollection;
   185   GCCause::Cause _cause;
   186 public:
   187   TraceMemoryManagerStats() {}
   188   TraceMemoryManagerStats(bool fullGC,
   189                           GCCause::Cause cause,
   190                           bool recordGCBeginTime = true,
   191                           bool recordPreGCUsage = true,
   192                           bool recordPeakUsage = true,
   193                           bool recordPostGCUsage = true,
   194                           bool recordAccumulatedGCTime = true,
   195                           bool recordGCEndTime = true,
   196                           bool countCollection = true);
   198   void initialize(bool fullGC,
   199                   GCCause::Cause cause,
   200                   bool recordGCBeginTime,
   201                   bool recordPreGCUsage,
   202                   bool recordPeakUsage,
   203                   bool recordPostGCUsage,
   204                   bool recordAccumulatedGCTime,
   205                   bool recordGCEndTime,
   206                   bool countCollection);
   208   TraceMemoryManagerStats(Generation::Name kind, GCCause::Cause cause);
   209   ~TraceMemoryManagerStats();
   210 };
   212 #endif // SHARE_VM_SERVICES_MEMORYSERVICE_HPP

mercurial