Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1181)

Unified Diff: runtime/vm/scavenger.h

Issue 3000113002: WIP: idle scavenge (Closed)
Patch Set: . Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/vm/scavenger.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/scavenger.h
diff --git a/runtime/vm/scavenger.h b/runtime/vm/scavenger.h
index 954919ef9be2a5085c994595d4ef35da0528097c..1180f3471027d5b912c49018088acb646ef05f82 100644
--- a/runtime/vm/scavenger.h
+++ b/runtime/vm/scavenger.h
@@ -98,6 +98,8 @@ class ScavengeStats {
int64_t DurationMicros() const { return end_micros_ - start_micros_; }
+ intptr_t UsedBefore() const { return before_.used_in_words * kWordSize; }
+
private:
int64_t start_micros_;
int64_t end_micros_;
@@ -214,6 +216,29 @@ class Scavenger {
return usage;
}
+ intptr_t ScavengeRateInBytesPerMicro() const {
+ intptr_t total_used = 0;
+ intptr_t total_micros = 0;
+ for (intptr_t i = 0; i < stats_history_.Size(); i++) {
+ total_used += stats_history_.Get(i).UsedBefore();
+ total_micros += stats_history_.Get(i).DurationMicros();
+ }
+ intptr_t scavenge_rate;
+ if (total_micros != 0) {
+ scavenge_rate = total_used / total_micros;
+ } else {
+ scavenge_rate = 400; // Conservative initial guess.
+ }
+ if (scavenge_rate == 0) {
+ scavenge_rate = 1;
+ }
+ return scavenge_rate;
+ }
+
+ intptr_t EstimatedScavengeTime() const {
+ return UsedInWords() * kWordSize / ScavengeRateInBytesPerMicro();
+ }
+
void VisitObjects(ObjectVisitor* visitor) const;
void VisitObjectPointers(ObjectPointerVisitor* visitor) const;
@@ -330,7 +355,7 @@ class Scavenger {
int64_t gc_time_micros_;
intptr_t collections_;
- static const int kStatsHistoryCapacity = 2;
+ static const int kStatsHistoryCapacity = 8;
RingBuffer<ScavengeStats, kStatsHistoryCapacity> stats_history_;
// The total size of external data associated with objects in this scavenger.
« no previous file with comments | « no previous file | runtime/vm/scavenger.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698