1 /*
2 * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
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 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_G1COLLECTORPOLICY_HPP
26 #define SHARE_VM_GC_IMPLEMENTATION_G1_G1COLLECTORPOLICY_HPP
27
28 #include "gc_implementation/g1/collectionSetChooser.hpp"
29 #include "gc_implementation/g1/g1Allocator.hpp"
30 #include "gc_implementation/g1/g1MMUTracker.hpp"
31 #include "memory/collectorPolicy.hpp"
32
33 // A G1CollectorPolicy makes policy decisions that determine the
34 // characteristics of the collector. Examples include:
35 // * choice of collection set.
36 // * when to collect.
37
38 class HeapRegion;
39 class CollectionSetChooser;
40 class G1GCPhaseTimes;
41
42 // TraceYoungGenTime collects data on _both_ young and mixed evacuation pauses
43 // (the latter may contain non-young regions - i.e. regions that are
44 // technically in old) while TraceOldGenTime collects data about full GCs.
45 class TraceYoungGenTimeData : public CHeapObj<mtGC> {
46 private:
47 unsigned _young_pause_num;
48 unsigned _mixed_pause_num;
49
50 NumberSeq _all_stop_world_times_ms;
51 NumberSeq _all_yield_times_ms;
925
926 void update_max_gc_locker_expansion();
927
928 // Calculates survivor space parameters.
929 void update_survivors_policy();
930
931 virtual void post_heap_initialize();
932 };
933
934 // This should move to some place more general...
935
936 // If we have "n" measurements, and we've kept track of their "sum" and the
937 // "sum_of_squares" of the measurements, this returns the variance of the
938 // sequence.
939 inline double variance(int n, double sum_of_squares, double sum) {
940 double n_d = (double)n;
941 double avg = sum/n_d;
942 return (sum_of_squares - 2.0 * avg * sum + n_d * avg * avg) / n_d;
943 }
944
945 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1COLLECTORPOLICY_HPP
|
1 /*
2 * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
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 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_G1COLLECTORPOLICY_HPP
26 #define SHARE_VM_GC_G1_G1COLLECTORPOLICY_HPP
27
28 #include "gc/g1/collectionSetChooser.hpp"
29 #include "gc/g1/g1Allocator.hpp"
30 #include "gc/g1/g1MMUTracker.hpp"
31 #include "gc/shared/collectorPolicy.hpp"
32
33 // A G1CollectorPolicy makes policy decisions that determine the
34 // characteristics of the collector. Examples include:
35 // * choice of collection set.
36 // * when to collect.
37
38 class HeapRegion;
39 class CollectionSetChooser;
40 class G1GCPhaseTimes;
41
42 // TraceYoungGenTime collects data on _both_ young and mixed evacuation pauses
43 // (the latter may contain non-young regions - i.e. regions that are
44 // technically in old) while TraceOldGenTime collects data about full GCs.
45 class TraceYoungGenTimeData : public CHeapObj<mtGC> {
46 private:
47 unsigned _young_pause_num;
48 unsigned _mixed_pause_num;
49
50 NumberSeq _all_stop_world_times_ms;
51 NumberSeq _all_yield_times_ms;
925
926 void update_max_gc_locker_expansion();
927
928 // Calculates survivor space parameters.
929 void update_survivors_policy();
930
931 virtual void post_heap_initialize();
932 };
933
934 // This should move to some place more general...
935
936 // If we have "n" measurements, and we've kept track of their "sum" and the
937 // "sum_of_squares" of the measurements, this returns the variance of the
938 // sequence.
939 inline double variance(int n, double sum_of_squares, double sum) {
940 double n_d = (double)n;
941 double avg = sum/n_d;
942 return (sum_of_squares - 2.0 * avg * sum + n_d * avg * avg) / n_d;
943 }
944
945 #endif // SHARE_VM_GC_G1_G1COLLECTORPOLICY_HPP
|