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

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

Issue 2322453002: [heap] Add histogram counters to track GC reasons. (Closed)
Patch Set: Add comment 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/counters.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 a2061393e211ddfc63b60a2c248d0296c28ece1a..706d3546a2c5d574d7224e118395ca5c81ff6691 100644
--- a/src/heap/gc-tracer.cc
+++ b/src/heap/gc-tracer.cc
@@ -205,10 +205,17 @@ void GCTracer::Start(GarbageCollector collector,
int committed_memory = static_cast<int>(heap_->CommittedMemory() / KB);
int used_memory = static_cast<int>(current_.start_object_size / KB);
- heap_->isolate()->counters()->aggregated_memory_heap_committed()->AddSample(
- start_time, committed_memory);
- heap_->isolate()->counters()->aggregated_memory_heap_used()->AddSample(
- start_time, used_memory);
+
+ Counters* counters = heap_->isolate()->counters();
+
+ if (collector == SCAVENGER) {
+ counters->scavenge_reason()->AddSample(static_cast<int>(gc_reason));
+ } else {
+ counters->mark_compact_reason()->AddSample(static_cast<int>(gc_reason));
+ }
+ counters->aggregated_memory_heap_committed()->AddSample(start_time,
+ committed_memory);
+ counters->aggregated_memory_heap_used()->AddSample(start_time, used_memory);
// TODO(cbruni): remove once we fully moved to a trace-based system.
if (FLAG_runtime_call_stats) {
RuntimeCallStats::Enter(heap_->isolate()->counters()->runtime_call_stats(),
« no previous file with comments | « src/counters.h ('k') | src/heap/heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698