src/hotspot/share/gc/g1/g1RemSetSummary.cpp
author tschatzl
Wed, 18 Apr 2018 11:36:48 +0200
changeset 49806 2d62570a615c
parent 49751 c3a10df652c0
child 51332 c25572739e7c
permissions -rw-r--r--
8200426: Make G1 code use _g1h members Summary: Consistently use _g1h member names for cached G1CollectedHeap* variables. Reviewed-by: sangheki, sjohanss
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
17854
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
     1
/*
49392
2956d0ece7a9 8199282: Remove ValueObj class for allocation subclassing for gc code
coleenp
parents: 48969
diff changeset
     2
 * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
17854
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
     4
 *
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
     7
 * published by the Free Software Foundation.
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
     8
 *
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
    13
 * accompanied this code).
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
    14
 *
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
    18
 *
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
    21
 * questions.
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
    22
 *
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
    23
 */
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
    24
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
    25
#include "precompiled.hpp"
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 26846
diff changeset
    26
#include "gc/g1/g1CollectedHeap.inline.hpp"
47789
a77a7d3bc4f6 8149127: Rename g1/concurrentMarkThread.* to g1/g1ConcurrentMarkThread.*
tschatzl
parents: 47216
diff changeset
    27
#include "gc/g1/g1ConcurrentRefine.hpp"
a77a7d3bc4f6 8149127: Rename g1/concurrentMarkThread.* to g1/g1ConcurrentMarkThread.*
tschatzl
parents: 47216
diff changeset
    28
#include "gc/g1/g1ConcurrentRefineThread.hpp"
47885
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents: 47790
diff changeset
    29
#include "gc/g1/g1RemSet.hpp"
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 26846
diff changeset
    30
#include "gc/g1/g1RemSetSummary.hpp"
38172
90f405aac699 8155524: HotCardCache shouldn't be part of ConcurrentG1Refine
kbarrett
parents: 35929
diff changeset
    31
#include "gc/g1/g1YoungRemSetSamplingThread.hpp"
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 26846
diff changeset
    32
#include "gc/g1/heapRegion.hpp"
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 26846
diff changeset
    33
#include "gc/g1/heapRegionRemSet.hpp"
35190
8a4918d9f9ae 8145673: G1RemSetSummary.hpp uses FREE_C_HEAP_ARRAY
tschatzl
parents: 35061
diff changeset
    34
#include "memory/allocation.inline.hpp"
17854
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
    35
#include "runtime/thread.inline.hpp"
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
    36
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
    37
class GetRSThreadVTimeClosure : public ThreadClosure {
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
    38
private:
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
    39
  G1RemSetSummary* _summary;
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
    40
  uint _counter;
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
    41
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
    42
public:
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
    43
  GetRSThreadVTimeClosure(G1RemSetSummary * summary) : ThreadClosure(), _summary(summary), _counter(0) {
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
    44
    assert(_summary != NULL, "just checking");
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
    45
  }
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
    46
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
    47
  virtual void do_thread(Thread* t) {
47789
a77a7d3bc4f6 8149127: Rename g1/concurrentMarkThread.* to g1/g1ConcurrentMarkThread.*
tschatzl
parents: 47216
diff changeset
    48
    G1ConcurrentRefineThread* crt = (G1ConcurrentRefineThread*) t;
17854
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
    49
    _summary->set_rs_thread_vtime(_counter, crt->vtime_accum());
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
    50
    _counter++;
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
    51
  }
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
    52
};
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
    53
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
    54
void G1RemSetSummary::update() {
46652
ab8716d193bb 8183226: Remembered set summarization accesses not fully initialized java thread DCQS
tschatzl
parents: 46614
diff changeset
    55
  _num_conc_refined_cards = _rem_set->num_conc_refined_cards();
49751
c3a10df652c0 8201316: Move G1-related static members from JavaThread to G1BarrierSet
pliden
parents: 49392
diff changeset
    56
  DirtyCardQueueSet& dcqs = G1BarrierSet::dirty_card_queue_set();
17854
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
    57
  _num_processed_buf_mutator = dcqs.processed_buffers_mut();
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
    58
  _num_processed_buf_rs_threads = dcqs.processed_buffers_rs_thread();
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
    59
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
    60
  _num_coarsenings = HeapRegionRemSet::n_coarsenings();
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
    61
47790
4925ee84b4ac 8140255: Move the management of G1YoungRemSetSamplingThread from G1ConcurrentRefine
tschatzl
parents: 47789
diff changeset
    62
  G1CollectedHeap* g1h = G1CollectedHeap::heap();
4925ee84b4ac 8140255: Move the management of G1YoungRemSetSamplingThread from G1ConcurrentRefine
tschatzl
parents: 47789
diff changeset
    63
  G1ConcurrentRefine* cg1r = g1h->concurrent_refine();
17854
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
    64
  if (_rs_threads_vtimes != NULL) {
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
    65
    GetRSThreadVTimeClosure p(this);
47790
4925ee84b4ac 8140255: Move the management of G1YoungRemSetSamplingThread from G1ConcurrentRefine
tschatzl
parents: 47789
diff changeset
    66
    cg1r->threads_do(&p);
17854
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
    67
  }
47790
4925ee84b4ac 8140255: Move the management of G1YoungRemSetSamplingThread from G1ConcurrentRefine
tschatzl
parents: 47789
diff changeset
    68
  set_sampling_thread_vtime(g1h->sampling_thread()->vtime_accum());
17854
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
    69
}
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
    70
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
    71
void G1RemSetSummary::set_rs_thread_vtime(uint thread, double value) {
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
    72
  assert(_rs_threads_vtimes != NULL, "just checking");
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
    73
  assert(thread < _num_vtimes, "just checking");
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
    74
  _rs_threads_vtimes[thread] = value;
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
    75
}
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
    76
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
    77
double G1RemSetSummary::rs_thread_vtime(uint thread) const {
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
    78
  assert(_rs_threads_vtimes != NULL, "just checking");
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
    79
  assert(thread < _num_vtimes, "just checking");
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
    80
  return _rs_threads_vtimes[thread];
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
    81
}
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
    82
35190
8a4918d9f9ae 8145673: G1RemSetSummary.hpp uses FREE_C_HEAP_ARRAY
tschatzl
parents: 35061
diff changeset
    83
G1RemSetSummary::G1RemSetSummary() :
46652
ab8716d193bb 8183226: Remembered set summarization accesses not fully initialized java thread DCQS
tschatzl
parents: 46614
diff changeset
    84
  _rem_set(NULL),
46614
ae1105fff9e4 8179677: Let G1Remset::_conc_refined_cards only count number of cards concurrently refined
tschatzl
parents: 38205
diff changeset
    85
  _num_conc_refined_cards(0),
35190
8a4918d9f9ae 8145673: G1RemSetSummary.hpp uses FREE_C_HEAP_ARRAY
tschatzl
parents: 35061
diff changeset
    86
  _num_processed_buf_mutator(0),
8a4918d9f9ae 8145673: G1RemSetSummary.hpp uses FREE_C_HEAP_ARRAY
tschatzl
parents: 35061
diff changeset
    87
  _num_processed_buf_rs_threads(0),
8a4918d9f9ae 8145673: G1RemSetSummary.hpp uses FREE_C_HEAP_ARRAY
tschatzl
parents: 35061
diff changeset
    88
  _num_coarsenings(0),
48103
26dbe08d1c17 8190426: Lazily initialize refinement threads with UseDynamicNumberOfGCThreads
tschatzl
parents: 47885
diff changeset
    89
  _num_vtimes(G1ConcurrentRefine::max_num_threads()),
46652
ab8716d193bb 8183226: Remembered set summarization accesses not fully initialized java thread DCQS
tschatzl
parents: 46614
diff changeset
    90
  _rs_threads_vtimes(NEW_C_HEAP_ARRAY(double, _num_vtimes, mtGC)),
35190
8a4918d9f9ae 8145673: G1RemSetSummary.hpp uses FREE_C_HEAP_ARRAY
tschatzl
parents: 35061
diff changeset
    91
  _sampling_thread_vtime(0.0f) {
46652
ab8716d193bb 8183226: Remembered set summarization accesses not fully initialized java thread DCQS
tschatzl
parents: 46614
diff changeset
    92
ab8716d193bb 8183226: Remembered set summarization accesses not fully initialized java thread DCQS
tschatzl
parents: 46614
diff changeset
    93
  memset(_rs_threads_vtimes, 0, sizeof(double) * _num_vtimes);
ab8716d193bb 8183226: Remembered set summarization accesses not fully initialized java thread DCQS
tschatzl
parents: 46614
diff changeset
    94
}
ab8716d193bb 8183226: Remembered set summarization accesses not fully initialized java thread DCQS
tschatzl
parents: 46614
diff changeset
    95
ab8716d193bb 8183226: Remembered set summarization accesses not fully initialized java thread DCQS
tschatzl
parents: 46614
diff changeset
    96
G1RemSetSummary::G1RemSetSummary(G1RemSet* rem_set) :
ab8716d193bb 8183226: Remembered set summarization accesses not fully initialized java thread DCQS
tschatzl
parents: 46614
diff changeset
    97
  _rem_set(rem_set),
ab8716d193bb 8183226: Remembered set summarization accesses not fully initialized java thread DCQS
tschatzl
parents: 46614
diff changeset
    98
  _num_conc_refined_cards(0),
ab8716d193bb 8183226: Remembered set summarization accesses not fully initialized java thread DCQS
tschatzl
parents: 46614
diff changeset
    99
  _num_processed_buf_mutator(0),
ab8716d193bb 8183226: Remembered set summarization accesses not fully initialized java thread DCQS
tschatzl
parents: 46614
diff changeset
   100
  _num_processed_buf_rs_threads(0),
ab8716d193bb 8183226: Remembered set summarization accesses not fully initialized java thread DCQS
tschatzl
parents: 46614
diff changeset
   101
  _num_coarsenings(0),
48103
26dbe08d1c17 8190426: Lazily initialize refinement threads with UseDynamicNumberOfGCThreads
tschatzl
parents: 47885
diff changeset
   102
  _num_vtimes(G1ConcurrentRefine::max_num_threads()),
46652
ab8716d193bb 8183226: Remembered set summarization accesses not fully initialized java thread DCQS
tschatzl
parents: 46614
diff changeset
   103
  _rs_threads_vtimes(NEW_C_HEAP_ARRAY(double, _num_vtimes, mtGC)),
ab8716d193bb 8183226: Remembered set summarization accesses not fully initialized java thread DCQS
tschatzl
parents: 46614
diff changeset
   104
  _sampling_thread_vtime(0.0f) {
ab8716d193bb 8183226: Remembered set summarization accesses not fully initialized java thread DCQS
tschatzl
parents: 46614
diff changeset
   105
  update();
35190
8a4918d9f9ae 8145673: G1RemSetSummary.hpp uses FREE_C_HEAP_ARRAY
tschatzl
parents: 35061
diff changeset
   106
}
8a4918d9f9ae 8145673: G1RemSetSummary.hpp uses FREE_C_HEAP_ARRAY
tschatzl
parents: 35061
diff changeset
   107
8a4918d9f9ae 8145673: G1RemSetSummary.hpp uses FREE_C_HEAP_ARRAY
tschatzl
parents: 35061
diff changeset
   108
G1RemSetSummary::~G1RemSetSummary() {
8a4918d9f9ae 8145673: G1RemSetSummary.hpp uses FREE_C_HEAP_ARRAY
tschatzl
parents: 35061
diff changeset
   109
  if (_rs_threads_vtimes) {
8a4918d9f9ae 8145673: G1RemSetSummary.hpp uses FREE_C_HEAP_ARRAY
tschatzl
parents: 35061
diff changeset
   110
    FREE_C_HEAP_ARRAY(double, _rs_threads_vtimes);
8a4918d9f9ae 8145673: G1RemSetSummary.hpp uses FREE_C_HEAP_ARRAY
tschatzl
parents: 35061
diff changeset
   111
  }
8a4918d9f9ae 8145673: G1RemSetSummary.hpp uses FREE_C_HEAP_ARRAY
tschatzl
parents: 35061
diff changeset
   112
}
8a4918d9f9ae 8145673: G1RemSetSummary.hpp uses FREE_C_HEAP_ARRAY
tschatzl
parents: 35061
diff changeset
   113
17854
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
   114
void G1RemSetSummary::set(G1RemSetSummary* other) {
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
   115
  assert(other != NULL, "just checking");
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
   116
  assert(_num_vtimes == other->_num_vtimes, "just checking");
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
   117
46614
ae1105fff9e4 8179677: Let G1Remset::_conc_refined_cards only count number of cards concurrently refined
tschatzl
parents: 38205
diff changeset
   118
  _num_conc_refined_cards = other->num_conc_refined_cards();
17854
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
   119
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
   120
  _num_processed_buf_mutator = other->num_processed_buf_mutator();
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
   121
  _num_processed_buf_rs_threads = other->num_processed_buf_rs_threads();
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
   122
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
   123
  _num_coarsenings = other->_num_coarsenings;
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
   124
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
   125
  memcpy(_rs_threads_vtimes, other->_rs_threads_vtimes, sizeof(double) * _num_vtimes);
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
   126
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
   127
  set_sampling_thread_vtime(other->sampling_thread_vtime());
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
   128
}
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
   129
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
   130
void G1RemSetSummary::subtract_from(G1RemSetSummary* other) {
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
   131
  assert(other != NULL, "just checking");
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
   132
  assert(_num_vtimes == other->_num_vtimes, "just checking");
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
   133
46614
ae1105fff9e4 8179677: Let G1Remset::_conc_refined_cards only count number of cards concurrently refined
tschatzl
parents: 38205
diff changeset
   134
  _num_conc_refined_cards = other->num_conc_refined_cards() - _num_conc_refined_cards;
17854
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
   135
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
   136
  _num_processed_buf_mutator = other->num_processed_buf_mutator() - _num_processed_buf_mutator;
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
   137
  _num_processed_buf_rs_threads = other->num_processed_buf_rs_threads() - _num_processed_buf_rs_threads;
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
   138
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
   139
  _num_coarsenings = other->num_coarsenings() - _num_coarsenings;
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
   140
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
   141
  for (uint i = 0; i < _num_vtimes; i++) {
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
   142
    set_rs_thread_vtime(i, other->rs_thread_vtime(i) - rs_thread_vtime(i));
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
   143
  }
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
   144
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
   145
  _sampling_thread_vtime = other->sampling_thread_vtime() - _sampling_thread_vtime;
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
   146
}
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
   147
49392
2956d0ece7a9 8199282: Remove ValueObj class for allocation subclassing for gc code
coleenp
parents: 48969
diff changeset
   148
class RegionTypeCounter {
20305
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   149
private:
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   150
  const char* _name;
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   151
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   152
  size_t _rs_mem_size;
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   153
  size_t _cards_occupied;
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   154
  size_t _amount;
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   155
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   156
  size_t _code_root_mem_size;
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   157
  size_t _code_root_elems;
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   158
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   159
  double rs_mem_size_percent_of(size_t total) {
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   160
    return percent_of(_rs_mem_size, total);
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   161
  }
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   162
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   163
  double cards_occupied_percent_of(size_t total) {
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   164
    return percent_of(_cards_occupied, total);
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   165
  }
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   166
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   167
  double code_root_mem_size_percent_of(size_t total) {
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   168
    return percent_of(_code_root_mem_size, total);
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   169
  }
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   170
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   171
  double code_root_elems_percent_of(size_t total) {
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   172
    return percent_of(_code_root_elems, total);
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   173
  }
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   174
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   175
  size_t amount() const { return _amount; }
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   176
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   177
public:
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   178
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   179
  RegionTypeCounter(const char* name) : _name(name), _rs_mem_size(0), _cards_occupied(0),
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   180
    _amount(0), _code_root_mem_size(0), _code_root_elems(0) { }
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   181
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   182
  void add(size_t rs_mem_size, size_t cards_occupied, size_t code_root_mem_size,
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   183
    size_t code_root_elems) {
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   184
    _rs_mem_size += rs_mem_size;
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   185
    _cards_occupied += cards_occupied;
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   186
    _code_root_mem_size += code_root_mem_size;
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   187
    _code_root_elems += code_root_elems;
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   188
    _amount++;
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   189
  }
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   190
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   191
  size_t rs_mem_size() const { return _rs_mem_size; }
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   192
  size_t cards_occupied() const { return _cards_occupied; }
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   193
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   194
  size_t code_root_mem_size() const { return _code_root_mem_size; }
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   195
  size_t code_root_elems() const { return _code_root_elems; }
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   196
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   197
  void print_rs_mem_info_on(outputStream * out, size_t total) {
38205
138a5e6e9cde 8054326: Confusing message in "Current rem set statistics"
csahu
parents: 38172
diff changeset
   198
    out->print_cr("    " SIZE_FORMAT_W(8) "%s (%5.1f%%) by " SIZE_FORMAT " %s regions",
138a5e6e9cde 8054326: Confusing message in "Current rem set statistics"
csahu
parents: 38172
diff changeset
   199
        byte_size_in_proper_unit(rs_mem_size()),
138a5e6e9cde 8054326: Confusing message in "Current rem set statistics"
csahu
parents: 38172
diff changeset
   200
        proper_unit_for_byte_size(rs_mem_size()),
138a5e6e9cde 8054326: Confusing message in "Current rem set statistics"
csahu
parents: 38172
diff changeset
   201
        rs_mem_size_percent_of(total), amount(), _name);
20305
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   202
  }
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   203
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   204
  void print_cards_occupied_info_on(outputStream * out, size_t total) {
31592
43f48e165466 8081202: Hotspot compile warning: "Invalid suffix on literal; C++11 requires a space between literal and identifier"
bpittore
parents: 30764
diff changeset
   205
    out->print_cr("     " SIZE_FORMAT_W(8) " (%5.1f%%) entries by " SIZE_FORMAT " %s regions",
21117
89fa6b136f85 8026848: -XX:+G1SummarizeRSetStats can result in wrong exit code and crash
sjohanss
parents: 20310
diff changeset
   206
        cards_occupied(), cards_occupied_percent_of(total), amount(), _name);
20305
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   207
  }
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   208
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   209
  void print_code_root_mem_info_on(outputStream * out, size_t total) {
38205
138a5e6e9cde 8054326: Confusing message in "Current rem set statistics"
csahu
parents: 38172
diff changeset
   210
    out->print_cr("    " SIZE_FORMAT_W(8) "%s (%5.1f%%) by " SIZE_FORMAT " %s regions",
138a5e6e9cde 8054326: Confusing message in "Current rem set statistics"
csahu
parents: 38172
diff changeset
   211
        byte_size_in_proper_unit(code_root_mem_size()),
138a5e6e9cde 8054326: Confusing message in "Current rem set statistics"
csahu
parents: 38172
diff changeset
   212
        proper_unit_for_byte_size(code_root_mem_size()),
138a5e6e9cde 8054326: Confusing message in "Current rem set statistics"
csahu
parents: 38172
diff changeset
   213
        code_root_mem_size_percent_of(total), amount(), _name);
20305
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   214
  }
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   215
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   216
  void print_code_root_elems_info_on(outputStream * out, size_t total) {
31592
43f48e165466 8081202: Hotspot compile warning: "Invalid suffix on literal; C++11 requires a space between literal and identifier"
bpittore
parents: 30764
diff changeset
   217
    out->print_cr("     " SIZE_FORMAT_W(8) " (%5.1f%%) elements by " SIZE_FORMAT " %s regions",
21117
89fa6b136f85 8026848: -XX:+G1SummarizeRSetStats can result in wrong exit code and crash
sjohanss
parents: 20310
diff changeset
   218
        code_root_elems(), code_root_elems_percent_of(total), amount(), _name);
20305
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   219
  }
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   220
};
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   221
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   222
17854
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
   223
class HRRSStatsIter: public HeapRegionClosure {
20305
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   224
private:
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   225
  RegionTypeCounter _young;
35929
2783e5e132e3 8148960: Humongous mis-spelled in log output
brutisso
parents: 35190
diff changeset
   226
  RegionTypeCounter _humongous;
20305
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   227
  RegionTypeCounter _free;
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   228
  RegionTypeCounter _old;
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   229
  RegionTypeCounter _all;
19339
d247781beec7 7145569: G1: optimize nmethods scanning
johnc
parents: 17854
diff changeset
   230
d247781beec7 7145569: G1: optimize nmethods scanning
johnc
parents: 17854
diff changeset
   231
  size_t _max_rs_mem_sz;
d247781beec7 7145569: G1: optimize nmethods scanning
johnc
parents: 17854
diff changeset
   232
  HeapRegion* _max_rs_mem_sz_region;
d247781beec7 7145569: G1: optimize nmethods scanning
johnc
parents: 17854
diff changeset
   233
20305
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   234
  size_t total_rs_mem_sz() const            { return _all.rs_mem_size(); }
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   235
  size_t total_cards_occupied() const       { return _all.cards_occupied(); }
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   236
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   237
  size_t max_rs_mem_sz() const              { return _max_rs_mem_sz; }
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   238
  HeapRegion* max_rs_mem_sz_region() const  { return _max_rs_mem_sz_region; }
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   239
19339
d247781beec7 7145569: G1: optimize nmethods scanning
johnc
parents: 17854
diff changeset
   240
  size_t _max_code_root_mem_sz;
d247781beec7 7145569: G1: optimize nmethods scanning
johnc
parents: 17854
diff changeset
   241
  HeapRegion* _max_code_root_mem_sz_region;
20305
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   242
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   243
  size_t total_code_root_mem_sz() const     { return _all.code_root_mem_size(); }
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   244
  size_t total_code_root_elems() const      { return _all.code_root_elems(); }
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   245
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   246
  size_t max_code_root_mem_sz() const       { return _max_code_root_mem_sz; }
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   247
  HeapRegion* max_code_root_mem_sz_region() const { return _max_code_root_mem_sz_region; }
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   248
17854
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
   249
public:
35929
2783e5e132e3 8148960: Humongous mis-spelled in log output
brutisso
parents: 35190
diff changeset
   250
  HRRSStatsIter() : _all("All"), _young("Young"), _humongous("Humongous"),
20305
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   251
    _free("Free"), _old("Old"), _max_code_root_mem_sz_region(NULL), _max_rs_mem_sz_region(NULL),
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   252
    _max_rs_mem_sz(0), _max_code_root_mem_sz(0)
17854
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
   253
  {}
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
   254
48969
jwilhelm
parents: 48890
diff changeset
   255
  bool do_heap_region(HeapRegion* r) {
19339
d247781beec7 7145569: G1: optimize nmethods scanning
johnc
parents: 17854
diff changeset
   256
    HeapRegionRemSet* hrrs = r->rem_set();
d247781beec7 7145569: G1: optimize nmethods scanning
johnc
parents: 17854
diff changeset
   257
d247781beec7 7145569: G1: optimize nmethods scanning
johnc
parents: 17854
diff changeset
   258
    // HeapRegionRemSet::mem_size() includes the
d247781beec7 7145569: G1: optimize nmethods scanning
johnc
parents: 17854
diff changeset
   259
    // size of the strong code roots
d247781beec7 7145569: G1: optimize nmethods scanning
johnc
parents: 17854
diff changeset
   260
    size_t rs_mem_sz = hrrs->mem_size();
d247781beec7 7145569: G1: optimize nmethods scanning
johnc
parents: 17854
diff changeset
   261
    if (rs_mem_sz > _max_rs_mem_sz) {
d247781beec7 7145569: G1: optimize nmethods scanning
johnc
parents: 17854
diff changeset
   262
      _max_rs_mem_sz = rs_mem_sz;
d247781beec7 7145569: G1: optimize nmethods scanning
johnc
parents: 17854
diff changeset
   263
      _max_rs_mem_sz_region = r;
17854
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
   264
    }
20305
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   265
    size_t occupied_cards = hrrs->occupied();
19339
d247781beec7 7145569: G1: optimize nmethods scanning
johnc
parents: 17854
diff changeset
   266
    size_t code_root_mem_sz = hrrs->strong_code_roots_mem_size();
20305
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   267
    if (code_root_mem_sz > max_code_root_mem_sz()) {
26422
4ee5901e205e 8048268: G1 Code Root Migration performs poorly
mgerdin
parents: 21117
diff changeset
   268
      _max_code_root_mem_sz = code_root_mem_sz;
19339
d247781beec7 7145569: G1: optimize nmethods scanning
johnc
parents: 17854
diff changeset
   269
      _max_code_root_mem_sz_region = r;
d247781beec7 7145569: G1: optimize nmethods scanning
johnc
parents: 17854
diff changeset
   270
    }
20305
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   271
    size_t code_root_elems = hrrs->strong_code_roots_list_length();
19339
d247781beec7 7145569: G1: optimize nmethods scanning
johnc
parents: 17854
diff changeset
   272
20305
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   273
    RegionTypeCounter* current = NULL;
26696
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents: 26422
diff changeset
   274
    if (r->is_free()) {
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents: 26422
diff changeset
   275
      current = &_free;
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents: 26422
diff changeset
   276
    } else if (r->is_young()) {
20305
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   277
      current = &_young;
26846
7d4376f8560e 8058495: G1: normalize names for isHumongous() and friends
tonyp
parents: 26696
diff changeset
   278
    } else if (r->is_humongous()) {
35929
2783e5e132e3 8148960: Humongous mis-spelled in log output
brutisso
parents: 35190
diff changeset
   279
      current = &_humongous;
26696
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents: 26422
diff changeset
   280
    } else if (r->is_old()) {
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents: 26422
diff changeset
   281
      current = &_old;
20305
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   282
    } else {
26696
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents: 26422
diff changeset
   283
      ShouldNotReachHere();
20305
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   284
    }
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   285
    current->add(rs_mem_sz, occupied_cards, code_root_mem_sz, code_root_elems);
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   286
    _all.add(rs_mem_sz, occupied_cards, code_root_mem_sz, code_root_elems);
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   287
17854
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
   288
    return false;
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
   289
  }
20305
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   290
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   291
  void print_summary_on(outputStream* out) {
35929
2783e5e132e3 8148960: Humongous mis-spelled in log output
brutisso
parents: 35190
diff changeset
   292
    RegionTypeCounter* counters[] = { &_young, &_humongous, &_free, &_old, NULL };
20305
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   293
35061
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 34299
diff changeset
   294
    out->print_cr(" Current rem set statistics");
38205
138a5e6e9cde 8054326: Confusing message in "Current rem set statistics"
csahu
parents: 38172
diff changeset
   295
    out->print_cr("  Total per region rem sets sizes = " SIZE_FORMAT "%s."
138a5e6e9cde 8054326: Confusing message in "Current rem set statistics"
csahu
parents: 38172
diff changeset
   296
                  " Max = " SIZE_FORMAT "%s.",
138a5e6e9cde 8054326: Confusing message in "Current rem set statistics"
csahu
parents: 38172
diff changeset
   297
                  byte_size_in_proper_unit(total_rs_mem_sz()),
138a5e6e9cde 8054326: Confusing message in "Current rem set statistics"
csahu
parents: 38172
diff changeset
   298
                  proper_unit_for_byte_size(total_rs_mem_sz()),
138a5e6e9cde 8054326: Confusing message in "Current rem set statistics"
csahu
parents: 38172
diff changeset
   299
                  byte_size_in_proper_unit(max_rs_mem_sz()),
138a5e6e9cde 8054326: Confusing message in "Current rem set statistics"
csahu
parents: 38172
diff changeset
   300
                  proper_unit_for_byte_size(max_rs_mem_sz()));
20305
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   301
    for (RegionTypeCounter** current = &counters[0]; *current != NULL; current++) {
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   302
      (*current)->print_rs_mem_info_on(out, total_rs_mem_sz());
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   303
    }
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   304
38205
138a5e6e9cde 8054326: Confusing message in "Current rem set statistics"
csahu
parents: 38172
diff changeset
   305
    out->print_cr("   Static structures = " SIZE_FORMAT "%s,"
138a5e6e9cde 8054326: Confusing message in "Current rem set statistics"
csahu
parents: 38172
diff changeset
   306
                  " free_lists = " SIZE_FORMAT "%s.",
138a5e6e9cde 8054326: Confusing message in "Current rem set statistics"
csahu
parents: 38172
diff changeset
   307
                  byte_size_in_proper_unit(HeapRegionRemSet::static_mem_size()),
138a5e6e9cde 8054326: Confusing message in "Current rem set statistics"
csahu
parents: 38172
diff changeset
   308
                  proper_unit_for_byte_size(HeapRegionRemSet::static_mem_size()),
138a5e6e9cde 8054326: Confusing message in "Current rem set statistics"
csahu
parents: 38172
diff changeset
   309
                  byte_size_in_proper_unit(HeapRegionRemSet::fl_mem_size()),
138a5e6e9cde 8054326: Confusing message in "Current rem set statistics"
csahu
parents: 38172
diff changeset
   310
                  proper_unit_for_byte_size(HeapRegionRemSet::fl_mem_size()));
20305
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   311
31592
43f48e165466 8081202: Hotspot compile warning: "Invalid suffix on literal; C++11 requires a space between literal and identifier"
bpittore
parents: 30764
diff changeset
   312
    out->print_cr("    " SIZE_FORMAT " occupied cards represented.",
20305
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   313
                  total_cards_occupied());
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   314
    for (RegionTypeCounter** current = &counters[0]; *current != NULL; current++) {
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   315
      (*current)->print_cards_occupied_info_on(out, total_cards_occupied());
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   316
    }
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   317
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   318
    // Largest sized rem set region statistics
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   319
    HeapRegionRemSet* rem_set = max_rs_mem_sz_region()->rem_set();
31592
43f48e165466 8081202: Hotspot compile warning: "Invalid suffix on literal; C++11 requires a space between literal and identifier"
bpittore
parents: 30764
diff changeset
   320
    out->print_cr("    Region with largest rem set = " HR_FORMAT ", "
38205
138a5e6e9cde 8054326: Confusing message in "Current rem set statistics"
csahu
parents: 38172
diff changeset
   321
                  "size = " SIZE_FORMAT "%s, occupied = " SIZE_FORMAT "%s.",
20305
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   322
                  HR_FORMAT_PARAMS(max_rs_mem_sz_region()),
38205
138a5e6e9cde 8054326: Confusing message in "Current rem set statistics"
csahu
parents: 38172
diff changeset
   323
                  byte_size_in_proper_unit(rem_set->mem_size()),
138a5e6e9cde 8054326: Confusing message in "Current rem set statistics"
csahu
parents: 38172
diff changeset
   324
                  proper_unit_for_byte_size(rem_set->mem_size()),
138a5e6e9cde 8054326: Confusing message in "Current rem set statistics"
csahu
parents: 38172
diff changeset
   325
                  byte_size_in_proper_unit(rem_set->occupied()),
138a5e6e9cde 8054326: Confusing message in "Current rem set statistics"
csahu
parents: 38172
diff changeset
   326
                  proper_unit_for_byte_size(rem_set->occupied()));
20305
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   327
    // Strong code root statistics
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   328
    HeapRegionRemSet* max_code_root_rem_set = max_code_root_mem_sz_region()->rem_set();
38205
138a5e6e9cde 8054326: Confusing message in "Current rem set statistics"
csahu
parents: 38172
diff changeset
   329
    out->print_cr("  Total heap region code root sets sizes = " SIZE_FORMAT "%s."
138a5e6e9cde 8054326: Confusing message in "Current rem set statistics"
csahu
parents: 38172
diff changeset
   330
                  "  Max = " SIZE_FORMAT "%s.",
138a5e6e9cde 8054326: Confusing message in "Current rem set statistics"
csahu
parents: 38172
diff changeset
   331
                  byte_size_in_proper_unit(total_code_root_mem_sz()),
138a5e6e9cde 8054326: Confusing message in "Current rem set statistics"
csahu
parents: 38172
diff changeset
   332
                  proper_unit_for_byte_size(total_code_root_mem_sz()),
138a5e6e9cde 8054326: Confusing message in "Current rem set statistics"
csahu
parents: 38172
diff changeset
   333
                  byte_size_in_proper_unit(max_code_root_rem_set->strong_code_roots_mem_size()),
138a5e6e9cde 8054326: Confusing message in "Current rem set statistics"
csahu
parents: 38172
diff changeset
   334
                  proper_unit_for_byte_size(max_code_root_rem_set->strong_code_roots_mem_size()));
20305
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   335
    for (RegionTypeCounter** current = &counters[0]; *current != NULL; current++) {
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   336
      (*current)->print_code_root_mem_info_on(out, total_code_root_mem_sz());
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   337
    }
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   338
31592
43f48e165466 8081202: Hotspot compile warning: "Invalid suffix on literal; C++11 requires a space between literal and identifier"
bpittore
parents: 30764
diff changeset
   339
    out->print_cr("    " SIZE_FORMAT " code roots represented.",
20305
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   340
                  total_code_root_elems());
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   341
    for (RegionTypeCounter** current = &counters[0]; *current != NULL; current++) {
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   342
      (*current)->print_code_root_elems_info_on(out, total_code_root_elems());
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   343
    }
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   344
31592
43f48e165466 8081202: Hotspot compile warning: "Invalid suffix on literal; C++11 requires a space between literal and identifier"
bpittore
parents: 30764
diff changeset
   345
    out->print_cr("    Region with largest amount of code roots = " HR_FORMAT ", "
38205
138a5e6e9cde 8054326: Confusing message in "Current rem set statistics"
csahu
parents: 38172
diff changeset
   346
                  "size = " SIZE_FORMAT "%s, num_elems = " SIZE_FORMAT ".",
20305
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   347
                  HR_FORMAT_PARAMS(max_code_root_mem_sz_region()),
38205
138a5e6e9cde 8054326: Confusing message in "Current rem set statistics"
csahu
parents: 38172
diff changeset
   348
                  byte_size_in_proper_unit(max_code_root_rem_set->strong_code_roots_mem_size()),
138a5e6e9cde 8054326: Confusing message in "Current rem set statistics"
csahu
parents: 38172
diff changeset
   349
                  proper_unit_for_byte_size(max_code_root_rem_set->strong_code_roots_mem_size()),
138a5e6e9cde 8054326: Confusing message in "Current rem set statistics"
csahu
parents: 38172
diff changeset
   350
                  max_code_root_rem_set->strong_code_roots_list_length());
20305
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   351
  }
17854
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
   352
};
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
   353
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
   354
void G1RemSetSummary::print_on(outputStream* out) {
35061
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 34299
diff changeset
   355
  out->print_cr(" Recent concurrent refinement statistics");
46614
ae1105fff9e4 8179677: Let G1Remset::_conc_refined_cards only count number of cards concurrently refined
tschatzl
parents: 38205
diff changeset
   356
  out->print_cr("  Processed " SIZE_FORMAT " cards concurrently", num_conc_refined_cards());
31592
43f48e165466 8081202: Hotspot compile warning: "Invalid suffix on literal; C++11 requires a space between literal and identifier"
bpittore
parents: 30764
diff changeset
   357
  out->print_cr("  Of " SIZE_FORMAT " completed buffers:", num_processed_buf_total());
43f48e165466 8081202: Hotspot compile warning: "Invalid suffix on literal; C++11 requires a space between literal and identifier"
bpittore
parents: 30764
diff changeset
   358
  out->print_cr("     " SIZE_FORMAT_W(8) " (%5.1f%%) by concurrent RS threads.",
17854
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
   359
                num_processed_buf_total(),
20305
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   360
                percent_of(num_processed_buf_rs_threads(), num_processed_buf_total()));
31592
43f48e165466 8081202: Hotspot compile warning: "Invalid suffix on literal; C++11 requires a space between literal and identifier"
bpittore
parents: 30764
diff changeset
   361
  out->print_cr("     " SIZE_FORMAT_W(8) " (%5.1f%%) by mutator threads.",
17854
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
   362
                num_processed_buf_mutator(),
20305
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   363
                percent_of(num_processed_buf_mutator(), num_processed_buf_total()));
31592
43f48e165466 8081202: Hotspot compile warning: "Invalid suffix on literal; C++11 requires a space between literal and identifier"
bpittore
parents: 30764
diff changeset
   364
  out->print_cr("  Did " SIZE_FORMAT " coarsenings.", num_coarsenings());
17854
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
   365
  out->print_cr("  Concurrent RS threads times (s)");
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
   366
  out->print("     ");
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
   367
  for (uint i = 0; i < _num_vtimes; i++) {
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
   368
    out->print("    %5.2f", rs_thread_vtime(i));
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
   369
  }
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
   370
  out->cr();
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
   371
  out->print_cr("  Concurrent sampling threads times (s)");
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
   372
  out->print_cr("         %5.2f", sampling_thread_vtime());
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
   373
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
   374
  HRRSStatsIter blk;
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
   375
  G1CollectedHeap::heap()->heap_region_iterate(&blk);
20305
af013cf4a5e6 8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents: 19339
diff changeset
   376
  blk.print_summary_on(out);
17854
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
diff changeset
   377
}