[heap] Add tracing scope for the remaining backround GC tasks.

This add scope for
- concurrent array buffer free task,
- concurrent store buffer processing task,
- concurrent unmapper task

Bug: chromium:758183
Change-Id: I1be3185a9ec44033982f6a0bb05d2e9b02074f85
Reviewed-on: https://chromium-review.googlesource.com/811646
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Ulan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49922}
This commit is contained in:
Ulan Degenbaev 2017-12-06 19:46:53 +01:00 committed by Commit Bot
parent b8a316a8e1
commit 681bc9b79c
6 changed files with 51 additions and 2 deletions

View File

@ -357,6 +357,9 @@
F(SCAVENGER_SCAVENGE_WEAK)
#define TRACER_BACKGROUND_SCOPES(F) \
F(BACKGROUND_ARRAY_BUFFER_FREE) \
F(BACKGROUND_STORE_BUFFER) \
F(BACKGROUND_UNMAPPER) \
F(MC_BACKGROUND_EVACUATE_COPY) \
F(MC_BACKGROUND_EVACUATE_UPDATE_POINTERS) \
F(MC_BACKGROUND_MARKING) \

View File

@ -36,6 +36,9 @@ class ArrayBufferCollector::FreeingTask final : public CancelableTask {
private:
void RunInternal() final {
GCTracer::BackgroundScope scope(
heap_->tracer(),
GCTracer::BackgroundScope::BACKGROUND_ARRAY_BUFFER_FREE);
heap_->array_buffer_collector()->FreeAllocations();
}

View File

@ -325,6 +325,7 @@ void GCTracer::Stop(GarbageCollector collector) {
case Event::START:
UNREACHABLE();
}
FetchBackgroundGeneralCounters();
heap_->UpdateTotalGCTime(duration);
@ -500,6 +501,9 @@ void GCTracer::PrintNVP() const {
"scavenge.weak_global_handles.process=%.2f "
"scavenge.parallel=%.2f "
"background.scavenge.parallel=%.2f "
"background.array_buffer_free=%.2f "
"background.store_buffer=%.2f "
"background.unmapper=%.2f "
"incremental.steps_count=%d "
"incremental.steps_took=%.1f "
"scavenge_throughput=%.f "
@ -545,6 +549,9 @@ void GCTracer::PrintNVP() const {
.scopes[Scope::SCAVENGER_SCAVENGE_WEAK_GLOBAL_HANDLES_PROCESS],
current_.scopes[Scope::SCAVENGER_SCAVENGE_PARALLEL],
current_.scopes[Scope::SCAVENGER_BACKGROUND_SCAVENGE_PARALLEL],
current_.scopes[Scope::BACKGROUND_ARRAY_BUFFER_FREE],
current_.scopes[Scope::BACKGROUND_STORE_BUFFER],
current_.scopes[Scope::BACKGROUND_UNMAPPER],
current_.incremental_marking_scopes[GCTracer::Scope::MC_INCREMENTAL]
.steps,
current_.scopes[Scope::MC_INCREMENTAL],
@ -585,6 +592,9 @@ void GCTracer::PrintNVP() const {
"background.mark=%.2f "
"background.evacuate.copy=%.2f "
"background.evacuate.update_pointers=%.2f "
"background.array_buffer_free=%.2f "
"background.store_buffer=%.2f "
"background.unmapper=%.2f "
"update_marking_deque=%.2f "
"reset_liveness=%.2f\n",
duration, spent_in_mutator, "mmc", current_.reduce_memory,
@ -607,6 +617,9 @@ void GCTracer::PrintNVP() const {
current_.scopes[Scope::MINOR_MC_BACKGROUND_MARKING],
current_.scopes[Scope::MINOR_MC_BACKGROUND_EVACUATE_COPY],
current_.scopes[Scope::MINOR_MC_BACKGROUND_EVACUATE_UPDATE_POINTERS],
current_.scopes[Scope::BACKGROUND_ARRAY_BUFFER_FREE],
current_.scopes[Scope::BACKGROUND_STORE_BUFFER],
current_.scopes[Scope::BACKGROUND_UNMAPPER],
current_.scopes[Scope::MINOR_MC_MARKING_DEQUE],
current_.scopes[Scope::MINOR_MC_RESET_LIVENESS]);
break;
@ -682,6 +695,9 @@ void GCTracer::PrintNVP() const {
"background.sweep=%.1f "
"background.evacuate.copy=%.1f "
"background.evacuate.update_pointers=%.1f "
"background.array_buffer_free=%.2f "
"background.store_buffer=%.2f "
"background.unmapper=%.1f "
"total_size_before=%" PRIuS
" "
"total_size_after=%" PRIuS
@ -778,6 +794,9 @@ void GCTracer::PrintNVP() const {
current_.scopes[Scope::MC_BACKGROUND_SWEEPING],
current_.scopes[Scope::MC_BACKGROUND_EVACUATE_COPY],
current_.scopes[Scope::MC_BACKGROUND_EVACUATE_UPDATE_POINTERS],
current_.scopes[Scope::BACKGROUND_ARRAY_BUFFER_FREE],
current_.scopes[Scope::BACKGROUND_STORE_BUFFER],
current_.scopes[Scope::BACKGROUND_UNMAPPER],
current_.start_object_size, current_.end_object_size,
current_.start_holes_size, current_.end_holes_size,
allocated_since_last_gc, heap_->promoted_objects_size(),
@ -957,6 +976,13 @@ void GCTracer::FetchBackgroundMinorGCCounters() {
BackgroundScope::LAST_MINOR_GC_BACKGROUND_SCOPE);
}
void GCTracer::FetchBackgroundGeneralCounters() {
FetchBackgroundCounters(Scope::FIRST_GENERAL_BACKGROUND_SCOPE,
Scope::LAST_GENERAL_BACKGROUND_SCOPE,
BackgroundScope::FIRST_GENERAL_BACKGROUND_SCOPE,
BackgroundScope::LAST_GENERAL_BACKGROUND_SCOPE);
}
void GCTracer::FetchBackgroundCounters(int first_global_scope,
int last_global_scope,
int first_background_scope,

View File

@ -70,6 +70,8 @@ class V8_EXPORT_PRIVATE GCTracer {
FIRST_SCOPE = MC_INCREMENTAL,
NUMBER_OF_INCREMENTAL_SCOPES =
LAST_INCREMENTAL_SCOPE - FIRST_INCREMENTAL_SCOPE + 1,
FIRST_GENERAL_BACKGROUND_SCOPE = BACKGROUND_ARRAY_BUFFER_FREE,
LAST_GENERAL_BACKGROUND_SCOPE = BACKGROUND_UNMAPPER,
FIRST_MC_BACKGROUND_SCOPE = MC_BACKGROUND_EVACUATE_COPY,
LAST_MC_BACKGROUND_SCOPE = MC_BACKGROUND_SWEEPING,
FIRST_MINOR_GC_BACKGROUND_SCOPE = MINOR_MC_BACKGROUND_EVACUATE_COPY,
@ -97,6 +99,8 @@ class V8_EXPORT_PRIVATE GCTracer {
TRACER_BACKGROUND_SCOPES(DEFINE_SCOPE)
#undef DEFINE_SCOPE
NUMBER_OF_SCOPES,
FIRST_GENERAL_BACKGROUND_SCOPE = BACKGROUND_ARRAY_BUFFER_FREE,
LAST_GENERAL_BACKGROUND_SCOPE = BACKGROUND_UNMAPPER,
FIRST_MC_BACKGROUND_SCOPE = MC_BACKGROUND_EVACUATE_COPY,
LAST_MC_BACKGROUND_SCOPE = MC_BACKGROUND_SWEEPING,
FIRST_MINOR_GC_BACKGROUND_SCOPE = MINOR_MC_BACKGROUND_EVACUATE_COPY,
@ -359,6 +363,7 @@ class V8_EXPORT_PRIVATE GCTracer {
int last_background_scope);
void FetchBackgroundMinorGCCounters();
void FetchBackgroundMarkCompactCounters();
void FetchBackgroundGeneralCounters();
// Pointer to the heap that owns this tracer.
Heap* heap_;

View File

@ -12,6 +12,7 @@
#include "src/counters.h"
#include "src/heap/array-buffer-tracker.h"
#include "src/heap/concurrent-marking.h"
#include "src/heap/gc-tracer.h"
#include "src/heap/incremental-marking.h"
#include "src/heap/mark-compact.h"
#include "src/heap/slot-set.h"
@ -313,15 +314,20 @@ void MemoryAllocator::TearDown() {
class MemoryAllocator::Unmapper::UnmapFreeMemoryTask : public CancelableTask {
public:
explicit UnmapFreeMemoryTask(Isolate* isolate, Unmapper* unmapper)
: CancelableTask(isolate), unmapper_(unmapper) {}
: CancelableTask(isolate),
unmapper_(unmapper),
tracer_(isolate->heap()->tracer()) {}
private:
void RunInternal() override {
GCTracer::BackgroundScope scope(
tracer_, GCTracer::BackgroundScope::BACKGROUND_UNMAPPER);
unmapper_->PerformFreeMemoryOnQueuedChunks<FreeMode::kUncommitPooled>();
unmapper_->pending_unmapping_tasks_semaphore_.Signal();
}
Unmapper* const unmapper_;
GCTracer* const tracer_;
DISALLOW_COPY_AND_ASSIGN(UnmapFreeMemoryTask);
};

View File

@ -10,6 +10,7 @@
#include "src/base/platform/platform.h"
#include "src/cancelable-task.h"
#include "src/globals.h"
#include "src/heap/gc-tracer.h"
#include "src/heap/remembered-set.h"
#include "src/heap/slot-set.h"
@ -167,14 +168,19 @@ class StoreBuffer {
class Task : public CancelableTask {
public:
Task(Isolate* isolate, StoreBuffer* store_buffer)
: CancelableTask(isolate), store_buffer_(store_buffer) {}
: CancelableTask(isolate),
store_buffer_(store_buffer),
tracer_(isolate->heap()->tracer()) {}
virtual ~Task() {}
private:
void RunInternal() override {
GCTracer::BackgroundScope scope(
tracer_, GCTracer::BackgroundScope::BACKGROUND_STORE_BUFFER);
store_buffer_->ConcurrentlyProcessStoreBuffer();
}
StoreBuffer* store_buffer_;
GCTracer* tracer_;
DISALLOW_COPY_AND_ASSIGN(Task);
};