hotspot/src/share/vm/gc/g1/g1EvacStats.hpp
author aharlap
Thu, 23 Feb 2017 12:50:49 -0500
changeset 46290 3c4c1591507d
parent 36390 a2d991d1d628
permissions -rw-r--r--
8151045: Remove code duplication in PLABStats/G1EvacStats::adjust_desired_plab_sz Summary: Move class specific code to the helper method Reviewed-by: kbarrett, tschatzl
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
32379
aa14adafaf0f 8073013: Add detailed information about PLAB memory usage
tschatzl
parents:
diff changeset
     1
/*
46290
3c4c1591507d 8151045: Remove code duplication in PLABStats/G1EvacStats::adjust_desired_plab_sz
aharlap
parents: 36390
diff changeset
     2
 * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
32379
aa14adafaf0f 8073013: Add detailed information about PLAB memory usage
tschatzl
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
aa14adafaf0f 8073013: Add detailed information about PLAB memory usage
tschatzl
parents:
diff changeset
     4
 *
aa14adafaf0f 8073013: Add detailed information about PLAB memory usage
tschatzl
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
aa14adafaf0f 8073013: Add detailed information about PLAB memory usage
tschatzl
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
aa14adafaf0f 8073013: Add detailed information about PLAB memory usage
tschatzl
parents:
diff changeset
     7
 * published by the Free Software Foundation.
aa14adafaf0f 8073013: Add detailed information about PLAB memory usage
tschatzl
parents:
diff changeset
     8
 *
aa14adafaf0f 8073013: Add detailed information about PLAB memory usage
tschatzl
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
aa14adafaf0f 8073013: Add detailed information about PLAB memory usage
tschatzl
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
aa14adafaf0f 8073013: Add detailed information about PLAB memory usage
tschatzl
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
aa14adafaf0f 8073013: Add detailed information about PLAB memory usage
tschatzl
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
aa14adafaf0f 8073013: Add detailed information about PLAB memory usage
tschatzl
parents:
diff changeset
    13
 * accompanied this code).
aa14adafaf0f 8073013: Add detailed information about PLAB memory usage
tschatzl
parents:
diff changeset
    14
 *
aa14adafaf0f 8073013: Add detailed information about PLAB memory usage
tschatzl
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
aa14adafaf0f 8073013: Add detailed information about PLAB memory usage
tschatzl
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
aa14adafaf0f 8073013: Add detailed information about PLAB memory usage
tschatzl
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
aa14adafaf0f 8073013: Add detailed information about PLAB memory usage
tschatzl
parents:
diff changeset
    18
 *
aa14adafaf0f 8073013: Add detailed information about PLAB memory usage
tschatzl
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
aa14adafaf0f 8073013: Add detailed information about PLAB memory usage
tschatzl
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
aa14adafaf0f 8073013: Add detailed information about PLAB memory usage
tschatzl
parents:
diff changeset
    21
 * questions.
aa14adafaf0f 8073013: Add detailed information about PLAB memory usage
tschatzl
parents:
diff changeset
    22
 *
aa14adafaf0f 8073013: Add detailed information about PLAB memory usage
tschatzl
parents:
diff changeset
    23
 */
aa14adafaf0f 8073013: Add detailed information about PLAB memory usage
tschatzl
parents:
diff changeset
    24
34230
b9c64b7c06c9 8141570: Fix Zero interpreter build for --disable-precompiled-headers
coleenp
parents: 32379
diff changeset
    25
#ifndef SHARE_VM_GC_G1_G1EVACSTATS_HPP
b9c64b7c06c9 8141570: Fix Zero interpreter build for --disable-precompiled-headers
coleenp
parents: 32379
diff changeset
    26
#define SHARE_VM_GC_G1_G1EVACSTATS_HPP
32379
aa14adafaf0f 8073013: Add detailed information about PLAB memory usage
tschatzl
parents:
diff changeset
    27
aa14adafaf0f 8073013: Add detailed information about PLAB memory usage
tschatzl
parents:
diff changeset
    28
#include "gc/shared/plab.hpp"
aa14adafaf0f 8073013: Add detailed information about PLAB memory usage
tschatzl
parents:
diff changeset
    29
aa14adafaf0f 8073013: Add detailed information about PLAB memory usage
tschatzl
parents:
diff changeset
    30
// Records various memory allocation statistics gathered during evacuation.
aa14adafaf0f 8073013: Add detailed information about PLAB memory usage
tschatzl
parents:
diff changeset
    31
class G1EvacStats : public PLABStats {
aa14adafaf0f 8073013: Add detailed information about PLAB memory usage
tschatzl
parents:
diff changeset
    32
 private:
aa14adafaf0f 8073013: Add detailed information about PLAB memory usage
tschatzl
parents:
diff changeset
    33
  size_t _region_end_waste; // Number of words wasted due to skipping to the next region.
aa14adafaf0f 8073013: Add detailed information about PLAB memory usage
tschatzl
parents:
diff changeset
    34
  uint   _regions_filled;   // Number of regions filled completely.
aa14adafaf0f 8073013: Add detailed information about PLAB memory usage
tschatzl
parents:
diff changeset
    35
  size_t _direct_allocated; // Number of words allocated directly into the regions.
aa14adafaf0f 8073013: Add detailed information about PLAB memory usage
tschatzl
parents:
diff changeset
    36
aa14adafaf0f 8073013: Add detailed information about PLAB memory usage
tschatzl
parents:
diff changeset
    37
  // Number of words in live objects remaining in regions that ultimately suffered an
aa14adafaf0f 8073013: Add detailed information about PLAB memory usage
tschatzl
parents:
diff changeset
    38
  // evacuation failure. This is used in the regions when the regions are made old regions.
aa14adafaf0f 8073013: Add detailed information about PLAB memory usage
tschatzl
parents:
diff changeset
    39
  size_t _failure_used;
aa14adafaf0f 8073013: Add detailed information about PLAB memory usage
tschatzl
parents:
diff changeset
    40
  // Number of words wasted in regions which failed evacuation. This is the sum of space
aa14adafaf0f 8073013: Add detailed information about PLAB memory usage
tschatzl
parents:
diff changeset
    41
  // for objects successfully copied out of the regions (now dead space) plus waste at the
aa14adafaf0f 8073013: Add detailed information about PLAB memory usage
tschatzl
parents:
diff changeset
    42
  // end of regions.
aa14adafaf0f 8073013: Add detailed information about PLAB memory usage
tschatzl
parents:
diff changeset
    43
  size_t _failure_waste;
aa14adafaf0f 8073013: Add detailed information about PLAB memory usage
tschatzl
parents:
diff changeset
    44
aa14adafaf0f 8073013: Add detailed information about PLAB memory usage
tschatzl
parents:
diff changeset
    45
  virtual void reset() {
aa14adafaf0f 8073013: Add detailed information about PLAB memory usage
tschatzl
parents:
diff changeset
    46
    PLABStats::reset();
aa14adafaf0f 8073013: Add detailed information about PLAB memory usage
tschatzl
parents:
diff changeset
    47
    _region_end_waste = 0;
aa14adafaf0f 8073013: Add detailed information about PLAB memory usage
tschatzl
parents:
diff changeset
    48
    _regions_filled = 0;
aa14adafaf0f 8073013: Add detailed information about PLAB memory usage
tschatzl
parents:
diff changeset
    49
    _direct_allocated = 0;
aa14adafaf0f 8073013: Add detailed information about PLAB memory usage
tschatzl
parents:
diff changeset
    50
    _failure_used = 0;
aa14adafaf0f 8073013: Add detailed information about PLAB memory usage
tschatzl
parents:
diff changeset
    51
    _failure_waste = 0;
aa14adafaf0f 8073013: Add detailed information about PLAB memory usage
tschatzl
parents:
diff changeset
    52
  }
aa14adafaf0f 8073013: Add detailed information about PLAB memory usage
tschatzl
parents:
diff changeset
    53
36390
a2d991d1d628 8141141: Young and Old gen PLAB stats are similar in output with -XX:+PrintPLAB
tschatzl
parents: 34230
diff changeset
    54
  virtual void log_plab_allocation();
a2d991d1d628 8141141: Young and Old gen PLAB stats are similar in output with -XX:+PrintPLAB
tschatzl
parents: 34230
diff changeset
    55
46290
3c4c1591507d 8151045: Remove code duplication in PLABStats/G1EvacStats::adjust_desired_plab_sz
aharlap
parents: 36390
diff changeset
    56
  virtual size_t compute_desired_plab_sz();
3c4c1591507d 8151045: Remove code duplication in PLABStats/G1EvacStats::adjust_desired_plab_sz
aharlap
parents: 36390
diff changeset
    57
32379
aa14adafaf0f 8073013: Add detailed information about PLAB memory usage
tschatzl
parents:
diff changeset
    58
 public:
36390
a2d991d1d628 8141141: Young and Old gen PLAB stats are similar in output with -XX:+PrintPLAB
tschatzl
parents: 34230
diff changeset
    59
  G1EvacStats(const char* description, size_t desired_plab_sz_, unsigned wt);
a2d991d1d628 8141141: Young and Old gen PLAB stats are similar in output with -XX:+PrintPLAB
tschatzl
parents: 34230
diff changeset
    60
a2d991d1d628 8141141: Young and Old gen PLAB stats are similar in output with -XX:+PrintPLAB
tschatzl
parents: 34230
diff changeset
    61
  ~G1EvacStats();
32379
aa14adafaf0f 8073013: Add detailed information about PLAB memory usage
tschatzl
parents:
diff changeset
    62
aa14adafaf0f 8073013: Add detailed information about PLAB memory usage
tschatzl
parents:
diff changeset
    63
  uint regions_filled() const { return _regions_filled; }
aa14adafaf0f 8073013: Add detailed information about PLAB memory usage
tschatzl
parents:
diff changeset
    64
  size_t region_end_waste() const { return _region_end_waste; }
aa14adafaf0f 8073013: Add detailed information about PLAB memory usage
tschatzl
parents:
diff changeset
    65
  size_t direct_allocated() const { return _direct_allocated; }
aa14adafaf0f 8073013: Add detailed information about PLAB memory usage
tschatzl
parents:
diff changeset
    66
aa14adafaf0f 8073013: Add detailed information about PLAB memory usage
tschatzl
parents:
diff changeset
    67
  // Amount of space in heapwords used in the failing regions when an evacuation failure happens.
aa14adafaf0f 8073013: Add detailed information about PLAB memory usage
tschatzl
parents:
diff changeset
    68
  size_t failure_used() const { return _failure_used; }
aa14adafaf0f 8073013: Add detailed information about PLAB memory usage
tschatzl
parents:
diff changeset
    69
  // Amount of space in heapwords wasted (unused) in the failing regions when an evacuation failure happens.
aa14adafaf0f 8073013: Add detailed information about PLAB memory usage
tschatzl
parents:
diff changeset
    70
  size_t failure_waste() const { return _failure_waste; }
aa14adafaf0f 8073013: Add detailed information about PLAB memory usage
tschatzl
parents:
diff changeset
    71
34230
b9c64b7c06c9 8141570: Fix Zero interpreter build for --disable-precompiled-headers
coleenp
parents: 32379
diff changeset
    72
  inline void add_direct_allocated(size_t value);
b9c64b7c06c9 8141570: Fix Zero interpreter build for --disable-precompiled-headers
coleenp
parents: 32379
diff changeset
    73
  inline void add_region_end_waste(size_t value);
b9c64b7c06c9 8141570: Fix Zero interpreter build for --disable-precompiled-headers
coleenp
parents: 32379
diff changeset
    74
  inline void add_failure_used_and_waste(size_t used, size_t waste);
32379
aa14adafaf0f 8073013: Add detailed information about PLAB memory usage
tschatzl
parents:
diff changeset
    75
};
aa14adafaf0f 8073013: Add detailed information about PLAB memory usage
tschatzl
parents:
diff changeset
    76
34230
b9c64b7c06c9 8141570: Fix Zero interpreter build for --disable-precompiled-headers
coleenp
parents: 32379
diff changeset
    77
#endif // SHARE_VM_GC_G1_G1EVACSTATS_HPP