Mercurial > hg > graal-jvmci-8
annotate src/share/vm/gc_implementation/g1/g1MMUTracker.hpp @ 1019:035d2e036a9b
6885041: G1: inconsistent thread dump
Summary: When G1 is enabled, thread dumps are inconsistent as the info for some of the G1 threads is not formatted properly.
Reviewed-by: ysr, johnc
author | tonyp |
---|---|
date | Fri, 02 Oct 2009 16:12:07 -0400 |
parents | e1fdf4fd34dc |
children | 3fc996d4edd2 |
rev | line source |
---|---|
342 | 1 /* |
579 | 2 * Copyright 2001-2009 Sun Microsystems, Inc. All Rights Reserved. |
342 | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | |
5 * This code is free software; you can redistribute it and/or modify it | |
6 * under the terms of the GNU General Public License version 2 only, as | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, | |
20 * CA 95054 USA or visit www.sun.com if you need additional information or | |
21 * have any questions. | |
22 * | |
23 */ | |
24 | |
25 // Keeps track of the GC work and decides when it is OK to do GC work | |
26 // and for how long so that the MMU invariants are maintained. | |
27 | |
28 /***** ALL TIMES ARE IN SECS!!!!!!! *****/ | |
29 | |
30 // this is the "interface" | |
549
fe3d7c11b4b7
6700941: G1: allocation spec missing for some G1 classes
apetrusenko
parents:
342
diff
changeset
|
31 class G1MMUTracker: public CHeapObj { |
342 | 32 protected: |
33 double _time_slice; | |
34 double _max_gc_time; // this is per time slice | |
35 | |
36 public: | |
37 G1MMUTracker(double time_slice, double max_gc_time); | |
38 | |
39 virtual void add_pause(double start, double end, bool gc_thread) = 0; | |
40 virtual double longest_pause(double current_time) = 0; | |
41 virtual double when_sec(double current_time, double pause_time) = 0; | |
42 | |
43 double max_gc_time() { | |
936 | 44 return _max_gc_time; |
342 | 45 } |
46 | |
47 inline bool now_max_gc(double current_time) { | |
48 return when_sec(current_time, max_gc_time()) < 0.00001; | |
49 } | |
50 | |
51 inline double when_max_gc_sec(double current_time) { | |
52 return when_sec(current_time, max_gc_time()); | |
53 } | |
54 | |
55 inline jlong when_max_gc_ms(double current_time) { | |
56 double when = when_max_gc_sec(current_time); | |
57 return (jlong) (when * 1000.0); | |
58 } | |
59 | |
60 inline jlong when_ms(double current_time, double pause_time) { | |
61 double when = when_sec(current_time, pause_time); | |
62 return (jlong) (when * 1000.0); | |
63 } | |
64 }; | |
65 | |
549
fe3d7c11b4b7
6700941: G1: allocation spec missing for some G1 classes
apetrusenko
parents:
342
diff
changeset
|
66 class G1MMUTrackerQueueElem VALUE_OBJ_CLASS_SPEC { |
342 | 67 private: |
68 double _start_time; | |
69 double _end_time; | |
70 | |
71 public: | |
72 inline double start_time() { return _start_time; } | |
73 inline double end_time() { return _end_time; } | |
74 inline double duration() { return _end_time - _start_time; } | |
75 | |
76 G1MMUTrackerQueueElem() { | |
77 _start_time = 0.0; | |
78 _end_time = 0.0; | |
79 } | |
80 | |
81 G1MMUTrackerQueueElem(double start_time, double end_time) { | |
82 _start_time = start_time; | |
83 _end_time = end_time; | |
84 } | |
85 }; | |
86 | |
87 // this is an implementation of the MMUTracker using a (fixed-size) queue | |
88 // that keeps track of all the recent pause times | |
89 class G1MMUTrackerQueue: public G1MMUTracker { | |
90 private: | |
91 enum PrivateConstants { | |
92 QueueLength = 64 | |
93 }; | |
94 | |
95 // The array keeps track of all the pauses that fall within a time | |
96 // slice (the last time slice during which pauses took place). | |
97 // The data structure implemented is a circular queue. | |
98 // Head "points" to the most recent addition, tail to the oldest one. | |
99 // The array is of fixed size and I don't think we'll need more than | |
100 // two or three entries with the current behaviour of G1 pauses. | |
101 // If the array is full, an easy fix is to look for the pauses with | |
102 // the shortest gap between them and concolidate them. | |
103 | |
104 G1MMUTrackerQueueElem _array[QueueLength]; | |
105 int _head_index; | |
106 int _tail_index; | |
107 int _no_entries; | |
108 | |
109 inline int trim_index(int index) { | |
110 return (index + QueueLength) % QueueLength; | |
111 } | |
112 | |
113 void remove_expired_entries(double current_time); | |
114 double calculate_gc_time(double current_time); | |
115 | |
116 double longest_pause_internal(double current_time); | |
117 double when_internal(double current_time, double pause_time); | |
118 | |
119 public: | |
120 G1MMUTrackerQueue(double time_slice, double max_gc_time); | |
121 | |
122 virtual void add_pause(double start, double end, bool gc_thread); | |
123 | |
124 virtual double longest_pause(double current_time); | |
125 virtual double when_sec(double current_time, double pause_time); | |
126 }; |