Commit 681bc9b7 authored by Ulan Degenbaev's avatar Ulan Degenbaev Committed by Commit Bot

[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/811646Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Commit-Queue: Ulan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49922}
parent b8a316a8
...@@ -357,6 +357,9 @@ ...@@ -357,6 +357,9 @@
F(SCAVENGER_SCAVENGE_WEAK) F(SCAVENGER_SCAVENGE_WEAK)
#define TRACER_BACKGROUND_SCOPES(F) \ #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_COPY) \
F(MC_BACKGROUND_EVACUATE_UPDATE_POINTERS) \ F(MC_BACKGROUND_EVACUATE_UPDATE_POINTERS) \
F(MC_BACKGROUND_MARKING) \ F(MC_BACKGROUND_MARKING) \
......
...@@ -36,6 +36,9 @@ class ArrayBufferCollector::FreeingTask final : public CancelableTask { ...@@ -36,6 +36,9 @@ class ArrayBufferCollector::FreeingTask final : public CancelableTask {
private: private:
void RunInternal() final { void RunInternal() final {
GCTracer::BackgroundScope scope(
heap_->tracer(),
GCTracer::BackgroundScope::BACKGROUND_ARRAY_BUFFER_FREE);
heap_->array_buffer_collector()->FreeAllocations(); heap_->array_buffer_collector()->FreeAllocations();
} }
......
...@@ -325,6 +325,7 @@ void GCTracer::Stop(GarbageCollector collector) { ...@@ -325,6 +325,7 @@ void GCTracer::Stop(GarbageCollector collector) {
case Event::START: case Event::START:
UNREACHABLE(); UNREACHABLE();
} }
FetchBackgroundGeneralCounters();
heap_->UpdateTotalGCTime(duration); heap_->UpdateTotalGCTime(duration);
...@@ -500,6 +501,9 @@ void GCTracer::PrintNVP() const { ...@@ -500,6 +501,9 @@ void GCTracer::PrintNVP() const {
"scavenge.weak_global_handles.process=%.2f " "scavenge.weak_global_handles.process=%.2f "
"scavenge.parallel=%.2f " "scavenge.parallel=%.2f "
"background.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_count=%d "
"incremental.steps_took=%.1f " "incremental.steps_took=%.1f "
"scavenge_throughput=%.f " "scavenge_throughput=%.f "
...@@ -545,6 +549,9 @@ void GCTracer::PrintNVP() const { ...@@ -545,6 +549,9 @@ void GCTracer::PrintNVP() const {
.scopes[Scope::SCAVENGER_SCAVENGE_WEAK_GLOBAL_HANDLES_PROCESS], .scopes[Scope::SCAVENGER_SCAVENGE_WEAK_GLOBAL_HANDLES_PROCESS],
current_.scopes[Scope::SCAVENGER_SCAVENGE_PARALLEL], current_.scopes[Scope::SCAVENGER_SCAVENGE_PARALLEL],
current_.scopes[Scope::SCAVENGER_BACKGROUND_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] current_.incremental_marking_scopes[GCTracer::Scope::MC_INCREMENTAL]
.steps, .steps,
current_.scopes[Scope::MC_INCREMENTAL], current_.scopes[Scope::MC_INCREMENTAL],
...@@ -585,6 +592,9 @@ void GCTracer::PrintNVP() const { ...@@ -585,6 +592,9 @@ void GCTracer::PrintNVP() const {
"background.mark=%.2f " "background.mark=%.2f "
"background.evacuate.copy=%.2f " "background.evacuate.copy=%.2f "
"background.evacuate.update_pointers=%.2f " "background.evacuate.update_pointers=%.2f "
"background.array_buffer_free=%.2f "
"background.store_buffer=%.2f "
"background.unmapper=%.2f "
"update_marking_deque=%.2f " "update_marking_deque=%.2f "
"reset_liveness=%.2f\n", "reset_liveness=%.2f\n",
duration, spent_in_mutator, "mmc", current_.reduce_memory, duration, spent_in_mutator, "mmc", current_.reduce_memory,
...@@ -607,6 +617,9 @@ void GCTracer::PrintNVP() const { ...@@ -607,6 +617,9 @@ void GCTracer::PrintNVP() const {
current_.scopes[Scope::MINOR_MC_BACKGROUND_MARKING], current_.scopes[Scope::MINOR_MC_BACKGROUND_MARKING],
current_.scopes[Scope::MINOR_MC_BACKGROUND_EVACUATE_COPY], current_.scopes[Scope::MINOR_MC_BACKGROUND_EVACUATE_COPY],
current_.scopes[Scope::MINOR_MC_BACKGROUND_EVACUATE_UPDATE_POINTERS], 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_MARKING_DEQUE],
current_.scopes[Scope::MINOR_MC_RESET_LIVENESS]); current_.scopes[Scope::MINOR_MC_RESET_LIVENESS]);
break; break;
...@@ -682,6 +695,9 @@ void GCTracer::PrintNVP() const { ...@@ -682,6 +695,9 @@ void GCTracer::PrintNVP() const {
"background.sweep=%.1f " "background.sweep=%.1f "
"background.evacuate.copy=%.1f " "background.evacuate.copy=%.1f "
"background.evacuate.update_pointers=%.1f " "background.evacuate.update_pointers=%.1f "
"background.array_buffer_free=%.2f "
"background.store_buffer=%.2f "
"background.unmapper=%.1f "
"total_size_before=%" PRIuS "total_size_before=%" PRIuS
" " " "
"total_size_after=%" PRIuS "total_size_after=%" PRIuS
...@@ -778,6 +794,9 @@ void GCTracer::PrintNVP() const { ...@@ -778,6 +794,9 @@ void GCTracer::PrintNVP() const {
current_.scopes[Scope::MC_BACKGROUND_SWEEPING], current_.scopes[Scope::MC_BACKGROUND_SWEEPING],
current_.scopes[Scope::MC_BACKGROUND_EVACUATE_COPY], current_.scopes[Scope::MC_BACKGROUND_EVACUATE_COPY],
current_.scopes[Scope::MC_BACKGROUND_EVACUATE_UPDATE_POINTERS], 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_object_size, current_.end_object_size,
current_.start_holes_size, current_.end_holes_size, current_.start_holes_size, current_.end_holes_size,
allocated_since_last_gc, heap_->promoted_objects_size(), allocated_since_last_gc, heap_->promoted_objects_size(),
...@@ -957,6 +976,13 @@ void GCTracer::FetchBackgroundMinorGCCounters() { ...@@ -957,6 +976,13 @@ void GCTracer::FetchBackgroundMinorGCCounters() {
BackgroundScope::LAST_MINOR_GC_BACKGROUND_SCOPE); 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, void GCTracer::FetchBackgroundCounters(int first_global_scope,
int last_global_scope, int last_global_scope,
int first_background_scope, int first_background_scope,
......
...@@ -70,6 +70,8 @@ class V8_EXPORT_PRIVATE GCTracer { ...@@ -70,6 +70,8 @@ class V8_EXPORT_PRIVATE GCTracer {
FIRST_SCOPE = MC_INCREMENTAL, FIRST_SCOPE = MC_INCREMENTAL,
NUMBER_OF_INCREMENTAL_SCOPES = NUMBER_OF_INCREMENTAL_SCOPES =
LAST_INCREMENTAL_SCOPE - FIRST_INCREMENTAL_SCOPE + 1, 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, FIRST_MC_BACKGROUND_SCOPE = MC_BACKGROUND_EVACUATE_COPY,
LAST_MC_BACKGROUND_SCOPE = MC_BACKGROUND_SWEEPING, LAST_MC_BACKGROUND_SCOPE = MC_BACKGROUND_SWEEPING,
FIRST_MINOR_GC_BACKGROUND_SCOPE = MINOR_MC_BACKGROUND_EVACUATE_COPY, FIRST_MINOR_GC_BACKGROUND_SCOPE = MINOR_MC_BACKGROUND_EVACUATE_COPY,
...@@ -97,6 +99,8 @@ class V8_EXPORT_PRIVATE GCTracer { ...@@ -97,6 +99,8 @@ class V8_EXPORT_PRIVATE GCTracer {
TRACER_BACKGROUND_SCOPES(DEFINE_SCOPE) TRACER_BACKGROUND_SCOPES(DEFINE_SCOPE)
#undef DEFINE_SCOPE #undef DEFINE_SCOPE
NUMBER_OF_SCOPES, 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, FIRST_MC_BACKGROUND_SCOPE = MC_BACKGROUND_EVACUATE_COPY,
LAST_MC_BACKGROUND_SCOPE = MC_BACKGROUND_SWEEPING, LAST_MC_BACKGROUND_SCOPE = MC_BACKGROUND_SWEEPING,
FIRST_MINOR_GC_BACKGROUND_SCOPE = MINOR_MC_BACKGROUND_EVACUATE_COPY, FIRST_MINOR_GC_BACKGROUND_SCOPE = MINOR_MC_BACKGROUND_EVACUATE_COPY,
...@@ -359,6 +363,7 @@ class V8_EXPORT_PRIVATE GCTracer { ...@@ -359,6 +363,7 @@ class V8_EXPORT_PRIVATE GCTracer {
int last_background_scope); int last_background_scope);
void FetchBackgroundMinorGCCounters(); void FetchBackgroundMinorGCCounters();
void FetchBackgroundMarkCompactCounters(); void FetchBackgroundMarkCompactCounters();
void FetchBackgroundGeneralCounters();
// Pointer to the heap that owns this tracer. // Pointer to the heap that owns this tracer.
Heap* heap_; Heap* heap_;
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "src/counters.h" #include "src/counters.h"
#include "src/heap/array-buffer-tracker.h" #include "src/heap/array-buffer-tracker.h"
#include "src/heap/concurrent-marking.h" #include "src/heap/concurrent-marking.h"
#include "src/heap/gc-tracer.h"
#include "src/heap/incremental-marking.h" #include "src/heap/incremental-marking.h"
#include "src/heap/mark-compact.h" #include "src/heap/mark-compact.h"
#include "src/heap/slot-set.h" #include "src/heap/slot-set.h"
...@@ -313,15 +314,20 @@ void MemoryAllocator::TearDown() { ...@@ -313,15 +314,20 @@ void MemoryAllocator::TearDown() {
class MemoryAllocator::Unmapper::UnmapFreeMemoryTask : public CancelableTask { class MemoryAllocator::Unmapper::UnmapFreeMemoryTask : public CancelableTask {
public: public:
explicit UnmapFreeMemoryTask(Isolate* isolate, Unmapper* unmapper) explicit UnmapFreeMemoryTask(Isolate* isolate, Unmapper* unmapper)
: CancelableTask(isolate), unmapper_(unmapper) {} : CancelableTask(isolate),
unmapper_(unmapper),
tracer_(isolate->heap()->tracer()) {}
private: private:
void RunInternal() override { void RunInternal() override {
GCTracer::BackgroundScope scope(
tracer_, GCTracer::BackgroundScope::BACKGROUND_UNMAPPER);
unmapper_->PerformFreeMemoryOnQueuedChunks<FreeMode::kUncommitPooled>(); unmapper_->PerformFreeMemoryOnQueuedChunks<FreeMode::kUncommitPooled>();
unmapper_->pending_unmapping_tasks_semaphore_.Signal(); unmapper_->pending_unmapping_tasks_semaphore_.Signal();
} }
Unmapper* const unmapper_; Unmapper* const unmapper_;
GCTracer* const tracer_;
DISALLOW_COPY_AND_ASSIGN(UnmapFreeMemoryTask); DISALLOW_COPY_AND_ASSIGN(UnmapFreeMemoryTask);
}; };
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "src/base/platform/platform.h" #include "src/base/platform/platform.h"
#include "src/cancelable-task.h" #include "src/cancelable-task.h"
#include "src/globals.h" #include "src/globals.h"
#include "src/heap/gc-tracer.h"
#include "src/heap/remembered-set.h" #include "src/heap/remembered-set.h"
#include "src/heap/slot-set.h" #include "src/heap/slot-set.h"
...@@ -167,14 +168,19 @@ class StoreBuffer { ...@@ -167,14 +168,19 @@ class StoreBuffer {
class Task : public CancelableTask { class Task : public CancelableTask {
public: public:
Task(Isolate* isolate, StoreBuffer* store_buffer) Task(Isolate* isolate, StoreBuffer* store_buffer)
: CancelableTask(isolate), store_buffer_(store_buffer) {} : CancelableTask(isolate),
store_buffer_(store_buffer),
tracer_(isolate->heap()->tracer()) {}
virtual ~Task() {} virtual ~Task() {}
private: private:
void RunInternal() override { void RunInternal() override {
GCTracer::BackgroundScope scope(
tracer_, GCTracer::BackgroundScope::BACKGROUND_STORE_BUFFER);
store_buffer_->ConcurrentlyProcessStoreBuffer(); store_buffer_->ConcurrentlyProcessStoreBuffer();
} }
StoreBuffer* store_buffer_; StoreBuffer* store_buffer_;
GCTracer* tracer_;
DISALLOW_COPY_AND_ASSIGN(Task); DISALLOW_COPY_AND_ASSIGN(Task);
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment