1 /* |
1 /* |
2 * Copyright 2001-2009 Sun Microsystems, Inc. All Rights Reserved. |
2 * Copyright 2001-2010 Sun Microsystems, Inc. All Rights Reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
39 size_t _summary_surv_rates_len; |
39 size_t _summary_surv_rates_len; |
40 size_t _summary_surv_rates_max_len; |
40 size_t _summary_surv_rates_max_len; |
41 |
41 |
42 int _all_regions_allocated; |
42 int _all_regions_allocated; |
43 size_t _region_num; |
43 size_t _region_num; |
44 size_t _scan_only_prefix; |
|
45 size_t _setup_seq_num; |
44 size_t _setup_seq_num; |
46 |
45 |
47 public: |
46 public: |
48 SurvRateGroup(G1CollectorPolicy* g1p, |
47 SurvRateGroup(G1CollectorPolicy* g1p, |
49 const char* name, |
48 const char* name, |
50 size_t summary_surv_rates_len); |
49 size_t summary_surv_rates_len); |
51 void reset(); |
50 void reset(); |
52 void start_adding_regions(); |
51 void start_adding_regions(); |
53 void stop_adding_regions(); |
52 void stop_adding_regions(); |
54 void record_scan_only_prefix(size_t scan_only_prefix); |
|
55 void record_surviving_words(int age_in_group, size_t surv_words); |
53 void record_surviving_words(int age_in_group, size_t surv_words); |
56 void all_surviving_words_recorded(bool propagate); |
54 void all_surviving_words_recorded(bool propagate); |
57 const char* name() { return _name; } |
55 const char* name() { return _name; } |
58 |
56 |
59 size_t region_num() { return _region_num; } |
57 size_t region_num() { return _region_num; } |
60 size_t scan_only_length() { return _scan_only_prefix; } |
|
61 double accum_surv_rate_pred(int age) { |
58 double accum_surv_rate_pred(int age) { |
62 assert(age >= 0, "must be"); |
59 assert(age >= 0, "must be"); |
63 if ((size_t)age < _stats_arrays_length) |
60 if ((size_t)age < _stats_arrays_length) |
64 return _accum_surv_rate_pred[age]; |
61 return _accum_surv_rate_pred[age]; |
65 else { |
62 else { |
80 return seq; |
77 return seq; |
81 } |
78 } |
82 |
79 |
83 int next_age_index(); |
80 int next_age_index(); |
84 int age_in_group(int age_index) { |
81 int age_in_group(int age_index) { |
85 int ret = (int) (_all_regions_allocated - age_index); |
82 int ret = (int) (_all_regions_allocated - age_index); |
86 assert( ret >= 0, "invariant" ); |
83 assert( ret >= 0, "invariant" ); |
87 return ret; |
84 return ret; |
88 } |
85 } |
89 int recalculate_age_index(int age_index) { |
|
90 int new_age_index = (int) _scan_only_prefix - age_in_group(age_index); |
|
91 guarantee( new_age_index >= 0, "invariant" ); |
|
92 return new_age_index; |
|
93 } |
|
94 void finished_recalculating_age_indexes() { |
86 void finished_recalculating_age_indexes() { |
95 _all_regions_allocated = (int) _scan_only_prefix; |
87 _all_regions_allocated = 0; |
96 } |
88 } |
97 |
89 |
98 #ifndef PRODUCT |
90 #ifndef PRODUCT |
99 void print(); |
91 void print(); |
100 void print_surv_rate_summary(); |
92 void print_surv_rate_summary(); |