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 // A G1CollectorPolicy makes policy decisions that determine the 26 // characteristics of the collector. Examples include: 27 // * choice of collection set. 28 // * when to collect. 29 30 class HeapRegion; 31 class CollectionSetChooser; 32 33 // Yes, this is a bit unpleasant... but it saves replicating the same thing 34 // over and over again and introducing subtle problems through small typos and 35 // cutting and pasting mistakes. The macros below introduces a number 36 // sequnce into the following two classes and the methods that access it. 37 38 #define define_num_seq(name) \ 39 private: \ 40 NumberSeq _all_##name##_times_ms; \ 41 public: \ 42 void record_##name##_time_ms(double ms) { \ 43 _all_##name##_times_ms.add(ms); \ 44 } \ 1270 void note_change_in_marked_bytes(HeapRegion* r) { } 1271 #ifndef PRODUCT 1272 bool assertMarkedBytesDataOK(); 1273 #endif 1274 }; 1275 1276 // This should move to some place more general... 1277 1278 // If we have "n" measurements, and we've kept track of their "sum" and the 1279 // "sum_of_squares" of the measurements, this returns the variance of the 1280 // sequence. 1281 inline double variance(int n, double sum_of_squares, double sum) { 1282 double n_d = (double)n; 1283 double avg = sum/n_d; 1284 return (sum_of_squares - 2.0 * avg * sum + n_d * avg * avg) / n_d; 1285 } 1286 1287 // Local Variables: *** 1288 // c-indentation-style: gnu *** 1289 // End: *** | 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/g1MMUTracker.hpp" 30 #include "memory/collectorPolicy.hpp" 31 32 // A G1CollectorPolicy makes policy decisions that determine the 33 // characteristics of the collector. Examples include: 34 // * choice of collection set. 35 // * when to collect. 36 37 class HeapRegion; 38 class CollectionSetChooser; 39 40 // Yes, this is a bit unpleasant... but it saves replicating the same thing 41 // over and over again and introducing subtle problems through small typos and 42 // cutting and pasting mistakes. The macros below introduces a number 43 // sequnce into the following two classes and the methods that access it. 44 45 #define define_num_seq(name) \ 46 private: \ 47 NumberSeq _all_##name##_times_ms; \ 48 public: \ 49 void record_##name##_time_ms(double ms) { \ 50 _all_##name##_times_ms.add(ms); \ 51 } \ 1277 void note_change_in_marked_bytes(HeapRegion* r) { } 1278 #ifndef PRODUCT 1279 bool assertMarkedBytesDataOK(); 1280 #endif 1281 }; 1282 1283 // This should move to some place more general... 1284 1285 // If we have "n" measurements, and we've kept track of their "sum" and the 1286 // "sum_of_squares" of the measurements, this returns the variance of the 1287 // sequence. 1288 inline double variance(int n, double sum_of_squares, double sum) { 1289 double n_d = (double)n; 1290 double avg = sum/n_d; 1291 return (sum_of_squares - 2.0 * avg * sum + n_d * avg * avg) / n_d; 1292 } 1293 1294 // Local Variables: *** 1295 // c-indentation-style: gnu *** 1296 // End: *** 1297 1298 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1COLLECTORPOLICY_HPP |