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

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

Issue 2310143002: [heap] Introduce enum of garbage collection reasons. (Closed)
Patch Set: rebase Created 4 years, 3 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 | « src/heap/gc-tracer.h ('k') | src/heap/heap.h » ('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 98be41d3693be9e79c2faf20e077f7d13093668f..a2061393e211ddfc63b60a2c248d0296c28ece1a 100644
--- a/src/heap/gc-tracer.cc
+++ b/src/heap/gc-tracer.cc
@@ -57,7 +57,7 @@ const char* GCTracer::Scope::Name(ScopeId id) {
return "(unknown)";
}
-GCTracer::Event::Event(Type type, const char* gc_reason,
+GCTracer::Event::Event(Type type, GarbageCollectionReason gc_reason,
const char* collector_reason)
: type(type),
gc_reason(gc_reason),
@@ -110,7 +110,7 @@ const char* GCTracer::Event::TypeName(bool short_name) const {
GCTracer::GCTracer(Heap* heap)
: heap_(heap),
- current_(Event::START, nullptr, nullptr),
+ current_(Event::START, GarbageCollectionReason::kUnknown, nullptr),
previous_(current_),
previous_incremental_mark_compactor_event_(current_),
cumulative_incremental_marking_bytes_(0),
@@ -130,7 +130,7 @@ GCTracer::GCTracer(Heap* heap)
}
void GCTracer::ResetForTesting() {
- current_ = Event(Event::START, NULL, NULL);
+ current_ = Event(Event::START, GarbageCollectionReason::kTesting, nullptr);
current_.end_time = heap_->MonotonicallyIncreasingTimeInMs();
previous_ = previous_incremental_mark_compactor_event_ = current_;
cumulative_incremental_marking_bytes_ = 0.0;
@@ -162,7 +162,8 @@ void GCTracer::ResetForTesting() {
start_counter_ = 0;
}
-void GCTracer::Start(GarbageCollector collector, const char* gc_reason,
+void GCTracer::Start(GarbageCollector collector,
+ GarbageCollectionReason gc_reason,
const char* collector_reason) {
start_counter_++;
if (start_counter_ != 1) return;
@@ -411,7 +412,6 @@ void GCTracer::Output(const char* format, ...) const {
heap_->AddToRingBuffer(buffer.start());
}
-
void GCTracer::Print() const {
double duration = current_.end_time - current_.start_time;
const size_t kIncrementalStatsSize = 128;
@@ -443,7 +443,7 @@ void GCTracer::Print() const {
static_cast<double>(current_.end_object_size) / MB,
static_cast<double>(current_.end_memory_size) / MB, duration,
TotalExternalTime(), incremental_buffer,
- current_.gc_reason != nullptr ? current_.gc_reason : "",
+ Heap::GarbageCollectionReasonToString(current_.gc_reason),
current_.collector_reason != nullptr ? current_.collector_reason : "");
}
« no previous file with comments | « src/heap/gc-tracer.h ('k') | src/heap/heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698