hotspot/src/share/vm/gc/g1/hSpaceCounters.hpp
author stefank
Thu, 21 May 2015 09:23:00 +0200
changeset 30868 c1b24f26deed
parent 30764 fec48bf5a827
permissions -rw-r--r--
8080110: Remove usage of CollectedHeap::n_par_threads() from root processing Reviewed-by: jmasa, kbarrett
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
9338
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
     1
/*
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 27880
diff changeset
     2
 * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
9338
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
     4
 *
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
     7
 * published by the Free Software Foundation.
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
     8
 *
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
    13
 * accompanied this code).
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
    14
 *
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
    18
 *
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
    21
 * questions.
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
    22
 *
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
    23
 */
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
    24
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 27880
diff changeset
    25
#ifndef SHARE_VM_GC_G1_HSPACECOUNTERS_HPP
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 27880
diff changeset
    26
#define SHARE_VM_GC_G1_HSPACECOUNTERS_HPP
9338
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
    27
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 27880
diff changeset
    28
#include "gc/shared/generation.hpp"
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 27880
diff changeset
    29
#include "gc/shared/generationCounters.hpp"
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 27880
diff changeset
    30
#include "runtime/perfData.hpp"
15482
470d0b0c09f1 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 13963
diff changeset
    31
#include "utilities/macros.hpp"
9338
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
    32
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
    33
// A HSpaceCounter is a holder class for performance counters
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
    34
// that track a collections (logical spaces) in a heap;
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
    35
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
    36
class HeapSpaceUsedHelper;
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
    37
class G1SpaceMonitoringSupport;
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
    38
13195
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents: 9338
diff changeset
    39
class HSpaceCounters: public CHeapObj<mtGC> {
9338
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
    40
  friend class VMStructs;
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
    41
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
    42
 private:
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
    43
  PerfVariable*        _capacity;
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
    44
  PerfVariable*        _used;
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
    45
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
    46
  // Constant PerfData types don't need to retain a reference.
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
    47
  // However, it's a good idea to document them here.
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
    48
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
    49
  char*             _name_space;
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
    50
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
    51
 public:
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
    52
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
    53
  HSpaceCounters(const char* name, int ordinal, size_t max_size,
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
    54
                 size_t initial_capacity, GenerationCounters* gc);
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
    55
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
    56
  ~HSpaceCounters() {
27880
afb974a04396 8060074: os::free() takes MemoryTrackingLevel but doesn't need it
coleenp
parents: 19974
diff changeset
    57
    if (_name_space != NULL) FREE_C_HEAP_ARRAY(char, _name_space);
9338
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
    58
  }
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
    59
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
    60
  inline void update_capacity(size_t v) {
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
    61
    _capacity->set_value(v);
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
    62
  }
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
    63
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
    64
  inline void update_used(size_t v) {
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
    65
    _used->set_value(v);
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
    66
  }
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
    67
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
    68
  debug_only(
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
    69
    // for security reasons, we do not allow arbitrary reads from
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
    70
    // the counters as they may live in shared memory.
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
    71
    jlong used() {
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
    72
      return _used->get_value();
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
    73
    }
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
    74
    jlong capacity() {
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
    75
      return _used->get_value();
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
    76
    }
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
    77
  )
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
    78
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
    79
  inline void update_all(size_t capacity, size_t used) {
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
    80
    update_capacity(capacity);
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
    81
    update_used(used);
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
    82
  }
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
    83
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
    84
  const char* name_space() const        { return _name_space; }
05ee447bd420 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents:
diff changeset
    85
};
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 27880
diff changeset
    86
#endif // SHARE_VM_GC_G1_HSPACECOUNTERS_HPP