hotspot/src/share/vm/services/g1MemoryPool.hpp
author stefank
Fri, 13 Feb 2015 14:37:35 +0100
changeset 29081 c61eb4914428
parent 22234 da823d78ad65
child 30764 fec48bf5a827
permissions -rw-r--r--
8072911: Remove includes of oop.inline.hpp from .hpp files Reviewed-by: brutisso, coleenp, jwilhelm, simonis, dholmes
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4459
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
     1
/*
22234
da823d78ad65 8029233: Update copyright year to match last edit in jdk8 hotspot repository for 2013
mikael
parents: 15482
diff changeset
     2
 * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
4459
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
     4
 *
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
     7
 * published by the Free Software Foundation.
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
     8
 *
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    13
 * accompanied this code).
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    14
 *
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 4463
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 4463
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 4463
diff changeset
    21
 * questions.
4459
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    22
 *
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    23
 */
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    24
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6424
diff changeset
    25
#ifndef SHARE_VM_SERVICES_G1MEMORYPOOL_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6424
diff changeset
    26
#define SHARE_VM_SERVICES_G1MEMORYPOOL_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6424
diff changeset
    27
15482
470d0b0c09f1 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 13963
diff changeset
    28
#include "utilities/macros.hpp"
470d0b0c09f1 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 13963
diff changeset
    29
#if INCLUDE_ALL_GCS
10671
431ff8629f97 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 9338
diff changeset
    30
#include "gc_implementation/g1/g1MonitoringSupport.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6424
diff changeset
    31
#include "services/memoryPool.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6424
diff changeset
    32
#include "services/memoryUsage.hpp"
15482
470d0b0c09f1 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 13963
diff changeset
    33
#endif // INCLUDE_ALL_GCS
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6424
diff changeset
    34
4459
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    35
// This file contains the three classes that represent the memory
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    36
// pools of the G1 spaces: G1EdenPool, G1SurvivorPool, and
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    37
// G1OldGenPool. In G1, unlike our other GCs, we do not have a
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    38
// physical space for each of those spaces. Instead, we allocate
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    39
// regions for all three spaces out of a single pool of regions (that
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    40
// pool basically covers the entire heap). As a result, the eden,
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    41
// survivor, and old gen are considered logical spaces in G1, as each
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    42
// is a set of non-contiguous regions. This is also reflected in the
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    43
// way we map them to memory pools here. The easiest way to have done
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    44
// this would have been to map the entire G1 heap to a single memory
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    45
// pool. However, it's helpful to show how large the eden and survivor
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    46
// get, as this does affect the performance and behavior of G1. Which
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    47
// is why we introduce the three memory pools implemented here.
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    48
//
9338
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents: 7397
diff changeset
    49
// See comments in g1MonitoringSupport.hpp for additional details
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents: 7397
diff changeset
    50
// on this model.
4459
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    51
//
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    52
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    53
// This class is shared by the three G1 memory pool classes
10671
431ff8629f97 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 9338
diff changeset
    54
// (G1EdenPool, G1SurvivorPool, G1OldGenPool).
4459
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    55
class G1MemoryPoolSuper : public CollectedMemoryPool {
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    56
protected:
10671
431ff8629f97 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 9338
diff changeset
    57
  const static size_t _undefined_max = (size_t) -1;
431ff8629f97 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 9338
diff changeset
    58
  G1MonitoringSupport* _g1mm;
4463
699f80df7faa 6906565: G1: deal with compilation warning in g1MemoryPool.hpp
tonyp
parents: 4462
diff changeset
    59
4459
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    60
  // Would only be called from subclasses.
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    61
  G1MemoryPoolSuper(G1CollectedHeap* g1h,
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    62
                    const char* name,
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    63
                    size_t init_size,
10671
431ff8629f97 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 9338
diff changeset
    64
                    size_t max_size,
4459
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    65
                    bool support_usage_threshold);
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    66
};
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    67
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    68
// Memory pool that represents the G1 eden.
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    69
class G1EdenPool : public G1MemoryPoolSuper {
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    70
public:
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    71
  G1EdenPool(G1CollectedHeap* g1h);
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    72
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    73
  size_t used_in_bytes() {
10671
431ff8629f97 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 9338
diff changeset
    74
    return _g1mm->eden_space_used();
4459
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    75
  }
4463
699f80df7faa 6906565: G1: deal with compilation warning in g1MemoryPool.hpp
tonyp
parents: 4462
diff changeset
    76
  size_t max_size() const {
10671
431ff8629f97 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 9338
diff changeset
    77
    return _undefined_max;
4459
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    78
  }
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    79
  MemoryUsage get_memory_usage();
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    80
};
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    81
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    82
// Memory pool that represents the G1 survivor.
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    83
class G1SurvivorPool : public G1MemoryPoolSuper {
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    84
public:
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    85
  G1SurvivorPool(G1CollectedHeap* g1h);
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    86
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    87
  size_t used_in_bytes() {
10671
431ff8629f97 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 9338
diff changeset
    88
    return _g1mm->survivor_space_used();
4459
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    89
  }
4463
699f80df7faa 6906565: G1: deal with compilation warning in g1MemoryPool.hpp
tonyp
parents: 4462
diff changeset
    90
  size_t max_size() const {
10671
431ff8629f97 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 9338
diff changeset
    91
    return _undefined_max;
4459
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    92
  }
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    93
  MemoryUsage get_memory_usage();
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    94
};
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    95
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    96
// Memory pool that represents the G1 old gen.
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    97
class G1OldGenPool : public G1MemoryPoolSuper {
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    98
public:
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
    99
  G1OldGenPool(G1CollectedHeap* g1h);
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   100
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   101
  size_t used_in_bytes() {
10671
431ff8629f97 7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents: 9338
diff changeset
   102
    return _g1mm->old_space_used();
4459
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   103
  }
4463
699f80df7faa 6906565: G1: deal with compilation warning in g1MemoryPool.hpp
tonyp
parents: 4462
diff changeset
   104
  size_t max_size() const {
11579
6c94c23b3199 7078465: G1: Don't use the undefined value (-1) for the G1 old memory pool max size
tonyp
parents: 10671
diff changeset
   105
    return _g1mm->old_gen_max();
4459
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   106
  }
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   107
  MemoryUsage get_memory_usage();
eb506d590394 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
   108
};
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6424
diff changeset
   109
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6424
diff changeset
   110
#endif // SHARE_VM_SERVICES_G1MEMORYPOOL_HPP