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

Unified Diff: src/heap/gc-tracer.cc

Issue 765743002: Re-land: Distinguish beween final incremental mark-compact and full mark-compact event in IdleNotif… (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years, 1 month 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 | « src/heap/gc-tracer.h ('k') | src/heap/heap.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/gc-tracer.cc
diff --git a/src/heap/gc-tracer.cc b/src/heap/gc-tracer.cc
index c2f6ab6c9d04bde61c42df5d26f580731ca77ab5..93686ba85cbba178adc618153d6208d42e136b47 100644
--- a/src/heap/gc-tracer.cc
+++ b/src/heap/gc-tracer.cc
@@ -68,6 +68,7 @@ const char* GCTracer::Event::TypeName(bool short_name) const {
return "Scavenge";
}
case MARK_COMPACTOR:
+ case INCREMENTAL_MARK_COMPACTOR:
if (short_name) {
return "ms";
} else {
@@ -97,7 +98,7 @@ GCTracer::GCTracer(Heap* heap)
start_counter_(0) {
current_ = Event(Event::START, NULL, NULL);
current_.end_time = base::OS::TimeCurrentMillis();
- previous_ = previous_mark_compactor_event_ = current_;
+ previous_ = previous_incremental_mark_compactor_event_ = current_;
}
@@ -114,13 +115,18 @@ void GCTracer::Start(GarbageCollector collector, const char* gc_reason,
reinterpret_cast<intptr_t>((heap_->new_space()->top()) -
new_space_top_after_gc_));
}
- if (current_.type == Event::MARK_COMPACTOR)
- previous_mark_compactor_event_ = current_;
+ if (current_.type == Event::INCREMENTAL_MARK_COMPACTOR)
+ previous_incremental_mark_compactor_event_ = current_;
if (collector == SCAVENGER) {
current_ = Event(Event::SCAVENGER, gc_reason, collector_reason);
- } else {
- current_ = Event(Event::MARK_COMPACTOR, gc_reason, collector_reason);
+ } else if (collector == MARK_COMPACTOR) {
+ if (heap_->incremental_marking()->IsMarking()) {
+ current_ =
+ Event(Event::INCREMENTAL_MARK_COMPACTOR, gc_reason, collector_reason);
+ } else {
+ current_ = Event(Event::MARK_COMPACTOR, gc_reason, collector_reason);
+ }
}
current_.start_time = start_time;
@@ -158,9 +164,10 @@ void GCTracer::Stop(GarbageCollector collector) {
}
DCHECK(start_counter_ >= 0);
- DCHECK(
- (collector == SCAVENGER && current_.type == Event::SCAVENGER) ||
- (collector == MARK_COMPACTOR && current_.type == Event::MARK_COMPACTOR));
+ DCHECK((collector == SCAVENGER && current_.type == Event::SCAVENGER) ||
+ (collector == MARK_COMPACTOR &&
+ (current_.type == Event::MARK_COMPACTOR ||
+ current_.type == Event::INCREMENTAL_MARK_COMPACTOR)));
current_.end_time = base::OS::TimeCurrentMillis();
current_.end_object_size = heap_->SizeOfObjects();
@@ -183,21 +190,30 @@ void GCTracer::Stop(GarbageCollector collector) {
current_.cumulative_pure_incremental_marking_duration -
previous_.cumulative_pure_incremental_marking_duration;
scavenger_events_.push_front(current_);
- } else {
+ } else if (current_.type == Event::INCREMENTAL_MARK_COMPACTOR) {
current_.incremental_marking_steps =
current_.cumulative_incremental_marking_steps -
- previous_mark_compactor_event_.cumulative_incremental_marking_steps;
+ previous_incremental_mark_compactor_event_
+ .cumulative_incremental_marking_steps;
current_.incremental_marking_bytes =
current_.cumulative_incremental_marking_bytes -
- previous_mark_compactor_event_.cumulative_incremental_marking_bytes;
+ previous_incremental_mark_compactor_event_
+ .cumulative_incremental_marking_bytes;
current_.incremental_marking_duration =
current_.cumulative_incremental_marking_duration -
- previous_mark_compactor_event_.cumulative_incremental_marking_duration;
+ previous_incremental_mark_compactor_event_
+ .cumulative_incremental_marking_duration;
current_.pure_incremental_marking_duration =
current_.cumulative_pure_incremental_marking_duration -
- previous_mark_compactor_event_
+ previous_incremental_mark_compactor_event_
.cumulative_pure_incremental_marking_duration;
longest_incremental_marking_step_ = 0.0;
+ incremental_mark_compactor_events_.push_front(current_);
+ } else {
+ DCHECK(current_.incremental_marking_bytes == 0);
+ DCHECK(current_.incremental_marking_duration == 0);
+ DCHECK(current_.pure_incremental_marking_duration == 0);
+ DCHECK(longest_incremental_marking_step_ == 0.0);
mark_compactor_events_.push_front(current_);
}
@@ -400,15 +416,15 @@ double GCTracer::MeanIncrementalMarkingDuration() const {
// We haven't completed an entire round of incremental marking, yet.
// Use data from GCTracer instead of data from event buffers.
- if (mark_compactor_events_.empty()) {
+ if (incremental_mark_compactor_events_.empty()) {
return cumulative_incremental_marking_duration_ /
cumulative_incremental_marking_steps_;
}
int steps = 0;
double durations = 0.0;
- EventBuffer::const_iterator iter = mark_compactor_events_.begin();
- while (iter != mark_compactor_events_.end()) {
+ EventBuffer::const_iterator iter = incremental_mark_compactor_events_.begin();
+ while (iter != incremental_mark_compactor_events_.end()) {
steps += iter->incremental_marking_steps;
durations += iter->incremental_marking_duration;
++iter;
@@ -423,11 +439,12 @@ double GCTracer::MeanIncrementalMarkingDuration() const {
double GCTracer::MaxIncrementalMarkingDuration() const {
// We haven't completed an entire round of incremental marking, yet.
// Use data from GCTracer instead of data from event buffers.
- if (mark_compactor_events_.empty()) return longest_incremental_marking_step_;
+ if (incremental_mark_compactor_events_.empty())
+ return longest_incremental_marking_step_;
double max_duration = 0.0;
- EventBuffer::const_iterator iter = mark_compactor_events_.begin();
- while (iter != mark_compactor_events_.end())
+ EventBuffer::const_iterator iter = incremental_mark_compactor_events_.begin();
+ while (iter != incremental_mark_compactor_events_.end())
max_duration = Max(iter->longest_incremental_marking_step, max_duration);
return max_duration;
@@ -439,15 +456,15 @@ intptr_t GCTracer::IncrementalMarkingSpeedInBytesPerMillisecond() const {
// We haven't completed an entire round of incremental marking, yet.
// Use data from GCTracer instead of data from event buffers.
- if (mark_compactor_events_.empty()) {
+ if (incremental_mark_compactor_events_.empty()) {
return static_cast<intptr_t>(cumulative_incremental_marking_bytes_ /
cumulative_pure_incremental_marking_duration_);
}
intptr_t bytes = 0;
double durations = 0.0;
- EventBuffer::const_iterator iter = mark_compactor_events_.begin();
- while (iter != mark_compactor_events_.end()) {
+ EventBuffer::const_iterator iter = incremental_mark_compactor_events_.begin();
+ while (iter != incremental_mark_compactor_events_.end()) {
bytes += iter->incremental_marking_bytes;
durations += iter->pure_incremental_marking_duration;
++iter;
@@ -481,8 +498,24 @@ intptr_t GCTracer::MarkCompactSpeedInBytesPerMillisecond() const {
EventBuffer::const_iterator iter = mark_compactor_events_.begin();
while (iter != mark_compactor_events_.end()) {
bytes += iter->start_object_size;
- durations += iter->end_time - iter->start_time +
- iter->pure_incremental_marking_duration;
+ durations += iter->end_time - iter->start_time;
+ ++iter;
+ }
+
+ if (durations == 0.0) return 0;
+
+ return static_cast<intptr_t>(bytes / durations);
+}
+
+
+intptr_t GCTracer::FinalIncrementalMarkCompactSpeedInBytesPerMillisecond()
+ const {
+ intptr_t bytes = 0;
+ double durations = 0.0;
+ EventBuffer::const_iterator iter = incremental_mark_compactor_events_.begin();
+ while (iter != incremental_mark_compactor_events_.end()) {
+ bytes += iter->start_object_size;
+ durations += iter->end_time - iter->start_time;
++iter;
}
« no previous file with comments | « src/heap/gc-tracer.h ('k') | src/heap/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698