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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_VM_GC_IMPLEMENTATION_G1_G1MMUTRACKER_HPP
26 #define SHARE_VM_GC_IMPLEMENTATION_G1_G1MMUTRACKER_HPP
27
28 #include "memory/allocation.hpp"
29 #include "utilities/debug.hpp"
30
31 // Keeps track of the GC work and decides when it is OK to do GC work
32 // and for how long so that the MMU invariants are maintained.
33
34 /***** ALL TIMES ARE IN SECS!!!!!!! *****/
35
36 // this is the "interface"
37 class G1MMUTracker: public CHeapObj<mtGC> {
38 protected:
39 double _time_slice;
40 double _max_gc_time; // this is per time slice
41
42 public:
43 G1MMUTracker(double time_slice, double max_gc_time);
44
45 virtual void add_pause(double start, double end, bool gc_thread) = 0;
46 virtual double when_sec(double current_time, double pause_time) = 0;
114 int _tail_index;
115 int _no_entries;
116
117 inline int trim_index(int index) {
118 return (index + QueueLength) % QueueLength;
119 }
120
121 void remove_expired_entries(double current_time);
122 double calculate_gc_time(double current_time);
123
124 double when_internal(double current_time, double pause_time);
125
126 public:
127 G1MMUTrackerQueue(double time_slice, double max_gc_time);
128
129 virtual void add_pause(double start, double end, bool gc_thread);
130
131 virtual double when_sec(double current_time, double pause_time);
132 };
133
134 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1MMUTRACKER_HPP
|
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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_VM_GC_G1_G1MMUTRACKER_HPP
26 #define SHARE_VM_GC_G1_G1MMUTRACKER_HPP
27
28 #include "memory/allocation.hpp"
29 #include "utilities/debug.hpp"
30
31 // Keeps track of the GC work and decides when it is OK to do GC work
32 // and for how long so that the MMU invariants are maintained.
33
34 /***** ALL TIMES ARE IN SECS!!!!!!! *****/
35
36 // this is the "interface"
37 class G1MMUTracker: public CHeapObj<mtGC> {
38 protected:
39 double _time_slice;
40 double _max_gc_time; // this is per time slice
41
42 public:
43 G1MMUTracker(double time_slice, double max_gc_time);
44
45 virtual void add_pause(double start, double end, bool gc_thread) = 0;
46 virtual double when_sec(double current_time, double pause_time) = 0;
114 int _tail_index;
115 int _no_entries;
116
117 inline int trim_index(int index) {
118 return (index + QueueLength) % QueueLength;
119 }
120
121 void remove_expired_entries(double current_time);
122 double calculate_gc_time(double current_time);
123
124 double when_internal(double current_time, double pause_time);
125
126 public:
127 G1MMUTrackerQueue(double time_slice, double max_gc_time);
128
129 virtual void add_pause(double start, double end, bool gc_thread);
130
131 virtual double when_sec(double current_time, double pause_time);
132 };
133
134 #endif // SHARE_VM_GC_G1_G1MMUTRACKER_HPP
|