src/share/vm/services/psMemoryPool.hpp

Thu, 12 Mar 2009 18:16:36 -0700

author
trims
date
Thu, 12 Mar 2009 18:16:36 -0700
changeset 1063
7bb995fbd3c0
parent 435
a61af66fc99e
child 1907
c18cbe5936b8
permissions
-rw-r--r--

Merge

     1 /*
     2  * Copyright (c) 2007 Sun Microsystems, Inc.  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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    20  * CA 95054 USA or visit www.sun.com if you need additional information or
    21  * have any questions.
    22  *
    23  */
    25 class PSGenerationPool : public CollectedMemoryPool {
    26 private:
    27   PSOldGen* _gen;
    29 public:
    30   PSGenerationPool(PSOldGen* pool, const char* name, PoolType type, bool support_usage_threshold);
    31   PSGenerationPool(PSPermGen* pool, const char* name, PoolType type, bool support_usage_threshold);
    33   MemoryUsage get_memory_usage();
    34   size_t used_in_bytes()              { return _gen->used_in_bytes(); }
    35   size_t max_size() const             { return _gen->reserved().byte_size(); }
    36 };
    38 class EdenMutableSpacePool : public CollectedMemoryPool {
    39 private:
    40   PSYoungGen*   _gen;
    41   MutableSpace* _space;
    43 public:
    44   EdenMutableSpacePool(PSYoungGen* gen,
    45                        MutableSpace* space,
    46                        const char* name,
    47                        PoolType type,
    48                        bool support_usage_threshold);
    50   MutableSpace* space()                     { return _space; }
    51   MemoryUsage get_memory_usage();
    52   size_t used_in_bytes()                    { return space()->used_in_bytes(); }
    53   size_t max_size() const {
    54     // Eden's max_size = max_size of Young Gen - the current committed size of survivor spaces
    55     return _gen->max_size() - _gen->from_space()->capacity_in_bytes() - _gen->to_space()->capacity_in_bytes();
    56   }
    57 };
    59 class SurvivorMutableSpacePool : public CollectedMemoryPool {
    60 private:
    61   PSYoungGen*   _gen;
    63 public:
    64   SurvivorMutableSpacePool(PSYoungGen* gen,
    65                            const char* name,
    66                            PoolType type,
    67                            bool support_usage_threshold);
    69   MemoryUsage get_memory_usage();
    71   size_t used_in_bytes() {
    72     return _gen->from_space()->used_in_bytes();
    73   }
    74   size_t committed_in_bytes() {
    75     return _gen->from_space()->capacity_in_bytes();
    76   }
    77   size_t max_size() const {
    78     // Return current committed size of the from-space
    79     return _gen->from_space()->capacity_in_bytes();
    80   }
    81 };

mercurial