src/share/vm/gc_implementation/g1/concurrentMarkThread.hpp

Tue, 21 Aug 2012 14:10:39 -0700

author
johnc
date
Tue, 21 Aug 2012 14:10:39 -0700
changeset 3998
7383557659bd
parent 3463
d30fa85f9994
child 6876
710a3c8b516e
child 6906
581e70386ec9
permissions
-rw-r--r--

7185699: G1: Prediction model discrepancies
Summary: Correct the result value of G1CollectedHeap::pending_card_num(). Change the code that calculates the GC efficiency of a non-young heap region to use historical data from mixed GCs and the actual number of live bytes when predicting how long it would take to collect the region. Changes were also reviewed by Thomas Schatzl.
Reviewed-by: azeemj, brutisso

ysr@777 1 /*
johnc@3463 2 * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
ysr@777 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
ysr@777 4 *
ysr@777 5 * This code is free software; you can redistribute it and/or modify it
ysr@777 6 * under the terms of the GNU General Public License version 2 only, as
ysr@777 7 * published by the Free Software Foundation.
ysr@777 8 *
ysr@777 9 * This code is distributed in the hope that it will be useful, but WITHOUT
ysr@777 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
ysr@777 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
ysr@777 12 * version 2 for more details (a copy is included in the LICENSE file that
ysr@777 13 * accompanied this code).
ysr@777 14 *
ysr@777 15 * You should have received a copy of the GNU General Public License version
ysr@777 16 * 2 along with this work; if not, write to the Free Software Foundation,
ysr@777 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
ysr@777 18 *
trims@1907 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1907 20 * or visit www.oracle.com if you need additional information or have any
trims@1907 21 * questions.
ysr@777 22 *
ysr@777 23 */
ysr@777 24
stefank@2314 25 #ifndef SHARE_VM_GC_IMPLEMENTATION_G1_CONCURRENTMARKTHREAD_HPP
stefank@2314 26 #define SHARE_VM_GC_IMPLEMENTATION_G1_CONCURRENTMARKTHREAD_HPP
stefank@2314 27
stefank@2314 28 #include "gc_implementation/shared/concurrentGCThread.hpp"
stefank@2314 29
ysr@777 30 // The Concurrent Mark GC Thread (could be several in the future).
ysr@777 31 // This is copied from the Concurrent Mark Sweep GC Thread
ysr@777 32 // Still under construction.
ysr@777 33
ysr@777 34 class ConcurrentMark;
ysr@777 35
ysr@777 36 class ConcurrentMarkThread: public ConcurrentGCThread {
ysr@777 37 friend class VMStructs;
ysr@777 38
ysr@777 39 double _vtime_start; // Initial virtual time.
ysr@777 40 double _vtime_accum; // Accumulated virtual time.
ysr@777 41
ysr@777 42 double _vtime_mark_accum;
ysr@777 43
ysr@777 44 public:
ysr@777 45 virtual void run();
ysr@777 46
ysr@777 47 private:
ysr@777 48 ConcurrentMark* _cm;
tonyp@1794 49 volatile bool _started;
tonyp@1794 50 volatile bool _in_progress;
ysr@777 51
ysr@777 52 void sleepBeforeNextCycle();
ysr@777 53
ysr@777 54 static SurrogateLockerThread* _slt;
ysr@777 55
ysr@777 56 public:
ysr@777 57 // Constructor
ysr@777 58 ConcurrentMarkThread(ConcurrentMark* cm);
ysr@777 59
ysr@777 60 static void makeSurrogateLockerThread(TRAPS);
ysr@777 61 static SurrogateLockerThread* slt() { return _slt; }
ysr@777 62
ysr@777 63 // Printing
tonyp@1454 64 void print_on(outputStream* st) const;
tonyp@1454 65 void print() const;
ysr@777 66
ysr@777 67 // Total virtual time so far.
ysr@777 68 double vtime_accum();
ysr@777 69 // Marking virtual time so far
ysr@777 70 double vtime_mark_accum();
ysr@777 71
tonyp@1794 72 ConcurrentMark* cm() { return _cm; }
ysr@777 73
johnc@2195 74 void set_started() { assert(!_in_progress, "cycle in progress"); _started = true; }
johnc@2195 75 void clear_started() { assert(_in_progress, "must be starting a cycle"); _started = false; }
tonyp@1794 76 bool started() { return _started; }
ysr@777 77
johnc@2195 78 void set_in_progress() { assert(_started, "must be starting a cycle"); _in_progress = true; }
johnc@2195 79 void clear_in_progress() { assert(!_started, "must not be starting a new cycle"); _in_progress = false; }
tonyp@1794 80 bool in_progress() { return _in_progress; }
tonyp@1794 81
tonyp@1794 82 // This flag returns true from the moment a marking cycle is
tonyp@1794 83 // initiated (during the initial-mark pause when started() is set)
tonyp@1794 84 // to the moment when the cycle completes (just after the next
tonyp@1794 85 // marking bitmap has been cleared and in_progress() is
tonyp@1794 86 // cleared). While this flag is true we will not start another cycle
tonyp@1794 87 // so that cycles do not overlap. We cannot use just in_progress()
tonyp@1794 88 // as the CM thread might take some time to wake up before noticing
tonyp@1794 89 // that started() is set and set in_progress().
tonyp@1794 90 bool during_cycle() { return started() || in_progress(); }
ysr@777 91
ysr@777 92 // Yield for GC
ysr@777 93 void yield();
ysr@777 94
ysr@777 95 // shutdown
iveresov@1229 96 void stop();
ysr@777 97 };
stefank@2314 98
stefank@2314 99 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_CONCURRENTMARKTHREAD_HPP

mercurial