OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #ifndef RUNTIME_VM_SCAVENGER_H_ | 5 #ifndef RUNTIME_VM_SCAVENGER_H_ |
6 #define RUNTIME_VM_SCAVENGER_H_ | 6 #define RUNTIME_VM_SCAVENGER_H_ |
7 | 7 |
8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
9 #include "platform/utils.h" | 9 #include "platform/utils.h" |
10 #include "vm/dart.h" | 10 #include "vm/dart.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 intptr_t promo_candidates_in_words, | 75 intptr_t promo_candidates_in_words, |
76 intptr_t promoted_in_words) | 76 intptr_t promoted_in_words) |
77 : start_micros_(start_micros), | 77 : start_micros_(start_micros), |
78 end_micros_(end_micros), | 78 end_micros_(end_micros), |
79 before_(before), | 79 before_(before), |
80 after_(after), | 80 after_(after), |
81 promo_candidates_in_words_(promo_candidates_in_words), | 81 promo_candidates_in_words_(promo_candidates_in_words), |
82 promoted_in_words_(promoted_in_words) {} | 82 promoted_in_words_(promoted_in_words) {} |
83 | 83 |
84 // Of all data before scavenge, what fraction was found to be garbage? | 84 // Of all data before scavenge, what fraction was found to be garbage? |
85 double GarbageFraction() const { | 85 // If this scavenge included growth, assume the extra capacity would become |
| 86 // garbage to give the scavenger a chance to stablize at the new capacity. |
| 87 double ExpectedGarbageFraction() const { |
86 intptr_t survived = after_.used_in_words + promoted_in_words_; | 88 intptr_t survived = after_.used_in_words + promoted_in_words_; |
87 return 1.0 - (survived / static_cast<double>(before_.used_in_words)); | 89 return 1.0 - (survived / static_cast<double>(after_.capacity_in_words)); |
88 } | 90 } |
89 | 91 |
90 // Fraction of promotion candidates that survived and was thereby promoted. | 92 // Fraction of promotion candidates that survived and was thereby promoted. |
91 // Returns zero if there were no promotion candidates. | 93 // Returns zero if there were no promotion candidates. |
92 double PromoCandidatesSuccessFraction() const { | 94 double PromoCandidatesSuccessFraction() const { |
93 return promo_candidates_in_words_ > 0 | 95 return promo_candidates_in_words_ > 0 |
94 ? promoted_in_words_ / | 96 ? promoted_in_words_ / |
95 static_cast<double>(promo_candidates_in_words_) | 97 static_cast<double>(promo_candidates_in_words_) |
96 : 0.0; | 98 : 0.0; |
97 } | 99 } |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 Mutex* space_lock_; | 343 Mutex* space_lock_; |
342 friend class ScavengerVisitor; | 344 friend class ScavengerVisitor; |
343 friend class ScavengerWeakVisitor; | 345 friend class ScavengerWeakVisitor; |
344 | 346 |
345 DISALLOW_COPY_AND_ASSIGN(Scavenger); | 347 DISALLOW_COPY_AND_ASSIGN(Scavenger); |
346 }; | 348 }; |
347 | 349 |
348 } // namespace dart | 350 } // namespace dart |
349 | 351 |
350 #endif // RUNTIME_VM_SCAVENGER_H_ | 352 #endif // RUNTIME_VM_SCAVENGER_H_ |
OLD | NEW |