[heap] Add histogram counter for young generation handling

BUG=chromium:693413

Change-Id: I6c6bc62e7f2c702be2462e4b0c3704fabf44f9d2
Reviewed-on: https://chromium-review.googlesource.com/445156
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#43316}
This commit is contained in:
Michael Lippautz 2017-02-20 12:33:19 +01:00 committed by Commit Bot
parent f967d3e9de
commit 17ef406da1
5 changed files with 28 additions and 2 deletions

View File

@ -941,6 +941,7 @@ class RuntimeCallTimerScope {
HR(incremental_marking_reason, V8.GCIncrementalMarkingReason, 0, 21, 22) \
HR(mark_compact_reason, V8.GCMarkCompactReason, 0, 21, 22) \
HR(scavenge_reason, V8.GCScavengeReason, 0, 21, 22) \
HR(young_generation_handling, V8.YoungGenerationHandling, 0, 1, 2) \
/* Asm/Wasm. */ \
HR(wasm_functions_per_module, V8.WasmFunctionsPerModule, 1, 10000, 51)

View File

@ -140,6 +140,13 @@ void GCTracer::ResetForTesting() {
start_counter_ = 0;
}
void GCTracer::NotifyYoungGenerationHandling(
YoungGenerationHandling young_generation_handling) {
DCHECK(current_.type == Event::SCAVENGER || start_counter_ > 1);
heap_->isolate()->counters()->young_generation_handling()->AddSample(
static_cast<int>(young_generation_handling));
}
void GCTracer::Start(GarbageCollector collector,
GarbageCollectionReason gc_reason,
const char* collector_reason) {

View File

@ -236,6 +236,9 @@ class V8_EXPORT_PRIVATE GCTracer {
// Stop collecting data and print results.
void Stop(GarbageCollector collector);
void NotifyYoungGenerationHandling(
YoungGenerationHandling young_generation_handling);
// Sample and accumulate bytes allocated since the last GC.
void SampleAllocation(double current_ms, size_t new_space_counter_bytes,
size_t old_generation_counter_bytes);

View File

@ -1358,10 +1358,17 @@ bool Heap::PerformGarbageCollection(
MinorMarkCompact();
break;
case SCAVENGER:
if (fast_promotion_mode_ && CanExpandOldGeneration(new_space()->Size()))
if (fast_promotion_mode_ &&
CanExpandOldGeneration(new_space()->Size())) {
tracer()->NotifyYoungGenerationHandling(
YoungGenerationHandling::kFastPromotionDuringScavenge);
EvacuateYoungGeneration();
else
} else {
tracer()->NotifyYoungGenerationHandling(
YoungGenerationHandling::kRegularScavenge);
Scavenge();
}
break;
}

View File

@ -377,6 +377,14 @@ enum class GarbageCollectionReason {
// Also update src/tools/metrics/histograms/histograms.xml in chromium.
};
enum class YoungGenerationHandling {
kRegularScavenge = 0,
kFastPromotionDuringScavenge = 1,
// If you add new items here, then update the young_generation_handling in
// counters.h.
// Also update src/tools/metrics/histograms/histograms.xml in chromium.
};
// A queue of objects promoted during scavenge. Each object is accompanied by
// its size to avoid dereferencing a map pointer for scanning. The last page in
// to-space is used for the promotion queue. On conflict during scavenge, the