src/share/vm/services/memoryService.hpp

Thu, 27 May 2010 19:08:38 -0700

author
trims
date
Thu, 27 May 2010 19:08:38 -0700
changeset 1907
c18cbe5936b8
parent 1524
db0d5eba9d20
child 2058
f6f3eef8a521
permissions
-rw-r--r--

6941466: Oracle rebranding changes for Hotspot repositories
Summary: Change all the Sun copyrights to Oracle copyright
Reviewed-by: ohair

     1 /*
     2  * Copyright (c) 2003, 2006, 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 // Forward declaration
    26 class MemoryPool;
    27 class MemoryManager;
    28 class GCMemoryManager;
    29 class CollectedHeap;
    30 class Generation;
    31 class DefNewGeneration;
    32 class PSYoungGen;
    33 class PSOldGen;
    34 class PSPermGen;
    35 class CodeHeap;
    36 class ContiguousSpace;
    37 class CompactibleFreeListSpace;
    38 class PermanentGenerationSpec;
    39 class GenCollectedHeap;
    40 class ParallelScavengeHeap;
    41 class CompactingPermGenGen;
    42 class CMSPermGenGen;
    43 class G1CollectedHeap;
    45 // VM Monitoring and Management Support
    47 class MemoryService : public AllStatic {
    48 private:
    49   enum {
    50     init_pools_list_size = 10,
    51     init_managers_list_size = 5
    52   };
    54   // index for minor and major generations
    55   enum {
    56     minor = 0,
    57     major = 1,
    58     n_gens = 2
    59   };
    61   static GrowableArray<MemoryPool*>*    _pools_list;
    62   static GrowableArray<MemoryManager*>* _managers_list;
    64   // memory managers for minor and major GC statistics
    65   static GCMemoryManager*               _major_gc_manager;
    66   static GCMemoryManager*               _minor_gc_manager;
    68   // Code heap memory pool
    69   static MemoryPool*                    _code_heap_pool;
    71   static void add_generation_memory_pool(Generation* gen,
    72                                          MemoryManager* major_mgr,
    73                                          MemoryManager* minor_mgr);
    74   static void add_generation_memory_pool(Generation* gen,
    75                                          MemoryManager* major_mgr) {
    76     add_generation_memory_pool(gen, major_mgr, NULL);
    77   }
    79   static void add_compact_perm_gen_memory_pool(CompactingPermGenGen* perm_gen,
    80                                                MemoryManager* mgr);
    81   static void add_cms_perm_gen_memory_pool(CMSPermGenGen* perm_gen,
    82                                            MemoryManager* mgr);
    84   static void add_psYoung_memory_pool(PSYoungGen* gen,
    85                                       MemoryManager* major_mgr,
    86                                       MemoryManager* minor_mgr);
    87   static void add_psOld_memory_pool(PSOldGen* gen,
    88                                     MemoryManager* mgr);
    89   static void add_psPerm_memory_pool(PSPermGen* perm,
    90                                      MemoryManager* mgr);
    92   static void add_g1YoungGen_memory_pool(G1CollectedHeap* g1h,
    93                                          MemoryManager* major_mgr,
    94                                          MemoryManager* minor_mgr);
    95   static void add_g1OldGen_memory_pool(G1CollectedHeap* g1h,
    96                                        MemoryManager* mgr);
    97   static void add_g1PermGen_memory_pool(G1CollectedHeap* g1h,
    98                                         MemoryManager* mgr);
   100   static MemoryPool* add_space(ContiguousSpace* space,
   101                                const char* name,
   102                                bool is_heap,
   103                                size_t max_size,
   104                                bool support_usage_threshold);
   105   static MemoryPool* add_survivor_spaces(DefNewGeneration* gen,
   106                                          const char* name,
   107                                          bool is_heap,
   108                                          size_t max_size,
   109                                          bool support_usage_threshold);
   110   static MemoryPool* add_gen(Generation* gen,
   111                              const char* name,
   112                              bool is_heap,
   113                              bool support_usage_threshold);
   114   static MemoryPool* add_cms_space(CompactibleFreeListSpace* space,
   115                                    const char* name,
   116                                    bool is_heap,
   117                                    size_t max_size,
   118                                    bool support_usage_threshold);
   120   static void add_gen_collected_heap_info(GenCollectedHeap* heap);
   121   static void add_parallel_scavenge_heap_info(ParallelScavengeHeap* heap);
   122   static void add_g1_heap_info(G1CollectedHeap* g1h);
   124 public:
   125   static void set_universe_heap(CollectedHeap* heap);
   126   static void add_code_heap_memory_pool(CodeHeap* heap);
   128   static MemoryPool*    get_memory_pool(instanceHandle pool);
   129   static MemoryManager* get_memory_manager(instanceHandle mgr);
   131   static const int num_memory_pools() {
   132     return _pools_list->length();
   133   }
   134   static const int num_memory_managers() {
   135     return _managers_list->length();
   136   }
   138   static MemoryPool* get_memory_pool(int index) {
   139     return _pools_list->at(index);
   140   }
   142   static MemoryManager* get_memory_manager(int index) {
   143     return _managers_list->at(index);
   144   }
   146   static void track_memory_usage();
   147   static void track_code_cache_memory_usage() {
   148     track_memory_pool_usage(_code_heap_pool);
   149   }
   150   static void track_memory_pool_usage(MemoryPool* pool);
   152   static void gc_begin(bool fullGC);
   153   static void gc_end(bool fullGC);
   155   static void oops_do(OopClosure* f);
   157   static bool get_verbose() { return PrintGC; }
   158   static bool set_verbose(bool verbose);
   160   // Create an instance of java/lang/management/MemoryUsage
   161   static Handle create_MemoryUsage_obj(MemoryUsage usage, TRAPS);
   162 };
   164 class TraceMemoryManagerStats : public StackObj {
   165 private:
   166   bool         _fullGC;
   167 public:
   168   TraceMemoryManagerStats(bool fullGC);
   169   TraceMemoryManagerStats(Generation::Name kind);
   170   ~TraceMemoryManagerStats();
   171 };

mercurial