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

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

Issue 727323004: Distinguish beween final incremental mark-compact and full mark-compact event in IdleNotification. (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 046ac2cd225766d3f3a422df495c1ac37e13a1d9..7f54fdc1822727c2c48b43dc2e326486ef284907 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 {
@@ -96,7 +97,7 @@ GCTracer::GCTracer(Heap* heap)
new_space_top_after_gc_(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_;
}
@@ -110,13 +111,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;
@@ -164,21 +170,30 @@ void GCTracer::Stop() {
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_);
}
@@ -381,15 +396,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;
@@ -404,11 +419,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;
@@ -420,15 +436,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;
@@ -462,8 +478,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