annotate src/share/vm/gc_implementation/g1/concurrentG1Refine.hpp @ 5167:dc5ea6e27195

8013895: G1: G1SummarizeRSetStats output on Linux needs improvement Summary: Fixed the output of G1SummarizeRSetStats: too small datatype for the number of concurrently processed cards, added concurrent remembered set thread time retrieval for Linux and Windows (BSD uses os::elapsedTime() now), and other cleanup. The information presented during VM operation is now relative to the previous output, not always cumulative if G1SummarizeRSetStatsPeriod > 0. At VM exit, the code prints a cumulative summary. Reviewed-by: johnc, jwilhelm
author tschatzl
date Thu, 19 Dec 2013 09:21:19 +0100
parents e341c460dcbf
children 935f879e4eb0
rev   line source
ysr@345 1 /*
johnc@4731 2 * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
ysr@345 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
ysr@345 4 *
ysr@345 5 * This code is free software; you can redistribute it and/or modify it
ysr@345 6 * under the terms of the GNU General Public License version 2 only, as
ysr@345 7 * published by the Free Software Foundation.
ysr@345 8 *
ysr@345 9 * This code is distributed in the hope that it will be useful, but WITHOUT
ysr@345 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
ysr@345 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
ysr@345 12 * version 2 for more details (a copy is included in the LICENSE file that
ysr@345 13 * accompanied this code).
ysr@345 14 *
ysr@345 15 * You should have received a copy of the GNU General Public License version
ysr@345 16 * 2 along with this work; if not, write to the Free Software Foundation,
ysr@345 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
ysr@345 18 *
trims@1563 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1563 20 * or visit www.oracle.com if you need additional information or have any
trims@1563 21 * questions.
ysr@345 22 *
ysr@345 23 */
ysr@345 24
stefank@1992 25 #ifndef SHARE_VM_GC_IMPLEMENTATION_G1_CONCURRENTG1REFINE_HPP
stefank@1992 26 #define SHARE_VM_GC_IMPLEMENTATION_G1_CONCURRENTG1REFINE_HPP
stefank@1992 27
johnc@4731 28 #include "gc_implementation/g1/g1HotCardCache.hpp"
stefank@1992 29 #include "memory/allocation.hpp"
stefank@1992 30 #include "runtime/thread.hpp"
stefank@1992 31 #include "utilities/globalDefinitions.hpp"
stefank@1992 32
ysr@345 33 // Forward decl
ysr@345 34 class ConcurrentG1RefineThread;
johnc@4731 35 class G1CollectedHeap;
johnc@4731 36 class G1HotCardCache;
ysr@345 37 class G1RemSet;
tschatzl@5167 38 class DirtyCardQueue;
ysr@345 39
zgu@4135 40 class ConcurrentG1Refine: public CHeapObj<mtGC> {
iveresov@842 41 ConcurrentG1RefineThread** _threads;
iveresov@842 42 int _n_threads;
iveresov@1185 43 int _n_worker_threads;
iveresov@1185 44 /*
iveresov@1185 45 * The value of the update buffer queue length falls into one of 3 zones:
iveresov@1185 46 * green, yellow, red. If the value is in [0, green) nothing is
iveresov@1185 47 * done, the buffers are left unprocessed to enable the caching effect of the
iveresov@1185 48 * dirtied cards. In the yellow zone [green, yellow) the concurrent refinement
iveresov@1185 49 * threads are gradually activated. In [yellow, red) all threads are
iveresov@1185 50 * running. If the length becomes red (max queue length) the mutators start
iveresov@1185 51 * processing the buffers.
iveresov@1185 52 *
tonyp@1369 53 * There are some interesting cases (when G1UseAdaptiveConcRefinement
tonyp@1369 54 * is turned off):
iveresov@1185 55 * 1) green = yellow = red = 0. In this case the mutator will process all
iveresov@1185 56 * buffers. Except for those that are created by the deferred updates
iveresov@1185 57 * machinery during a collection.
iveresov@1185 58 * 2) green = 0. Means no caching. Can be a good way to minimize the
iveresov@1185 59 * amount of time spent updating rsets during a collection.
iveresov@1185 60 */
iveresov@1185 61 int _green_zone;
iveresov@1185 62 int _yellow_zone;
iveresov@1185 63 int _red_zone;
iveresov@1185 64
iveresov@1185 65 int _thread_threshold_step;
iveresov@1185 66
johnc@4731 67 // We delay the refinement of 'hot' cards using the hot card cache.
johnc@4731 68 G1HotCardCache _hot_card_cache;
johnc@4731 69
iveresov@1185 70 // Reset the threshold step value based of the current zone boundaries.
iveresov@1185 71 void reset_threshold_step();
johnc@941 72
ysr@345 73 public:
johnc@4731 74 ConcurrentG1Refine(G1CollectedHeap* g1h);
ysr@345 75 ~ConcurrentG1Refine();
ysr@345 76
ysr@345 77 void init(); // Accomplish some initialization that has to wait.
iveresov@842 78 void stop();
ysr@345 79
iveresov@1185 80 void reinitialize_threads();
iveresov@1185 81
tschatzl@5167 82 // Iterate over all concurrent refinement threads
iveresov@842 83 void threads_do(ThreadClosure *tc);
ysr@345 84
tschatzl@5167 85 // Iterate over all worker refinement threads
tschatzl@5167 86 void worker_threads_do(ThreadClosure * tc);
tschatzl@5167 87
tschatzl@5167 88 // The RS sampling thread
tschatzl@5167 89 ConcurrentG1RefineThread * sampling_thread() const;
tschatzl@5167 90
iveresov@1185 91 static int thread_num();
tonyp@1078 92
tonyp@1078 93 void print_worker_threads_on(outputStream* st) const;
iveresov@1185 94
iveresov@1185 95 void set_green_zone(int x) { _green_zone = x; }
iveresov@1185 96 void set_yellow_zone(int x) { _yellow_zone = x; }
iveresov@1185 97 void set_red_zone(int x) { _red_zone = x; }
iveresov@1185 98
iveresov@1185 99 int green_zone() const { return _green_zone; }
iveresov@1185 100 int yellow_zone() const { return _yellow_zone; }
iveresov@1185 101 int red_zone() const { return _red_zone; }
iveresov@1185 102
iveresov@1185 103 int total_thread_num() const { return _n_threads; }
iveresov@1185 104 int worker_thread_num() const { return _n_worker_threads; }
iveresov@1185 105
iveresov@1185 106 int thread_threshold_step() const { return _thread_threshold_step; }
johnc@4731 107
johnc@4731 108 G1HotCardCache* hot_card_cache() { return &_hot_card_cache; }
ysr@345 109 };
stefank@1992 110
stefank@1992 111 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_CONCURRENTG1REFINE_HPP