Commit 9ec64963 authored by cbruni's avatar cbruni Committed by Commit bot

[counters] adding runtime call timers for GC

Adding an additional timer for the GC to make the other runtime call counters
more stable.

BUG=

Review URL: https://codereview.chromium.org/1825093002

Cr-Commit-Position: refs/heads/master@{#35033}
parent 7a05ddd4
......@@ -305,6 +305,7 @@ void RuntimeCallStats::Print(std::ostream& os) {
#undef PRINT_COUNTER
entries.Add(&this->ExternalCallback);
entries.Add(&this->GC);
entries.Add(&this->UnexpectedStubMiss);
entries.Print(os);
......@@ -319,6 +320,7 @@ void RuntimeCallStats::Reset() {
BUILTIN_LIST_C(RESET_COUNTER)
#undef RESET_COUNTER
this->ExternalCallback.Reset();
this->GC.Reset();
this->UnexpectedStubMiss.Reset();
}
......
......@@ -528,6 +528,7 @@ struct RuntimeCallStats {
RuntimeCallCounter("UnexpectedStubMiss");
// Counter for runtime callbacks into JavaScript.
RuntimeCallCounter ExternalCallback = RuntimeCallCounter("ExternalCallback");
RuntimeCallCounter GC = RuntimeCallCounter("GC");
#define CALL_RUNTIME_COUNTER(name, nargs, ressize) \
RuntimeCallCounter Runtime_##name = RuntimeCallCounter(#name);
FOR_EACH_INTRINSIC(CALL_RUNTIME_COUNTER)
......
......@@ -24,6 +24,13 @@ static intptr_t CountTotalHolesSize(Heap* heap) {
GCTracer::Scope::Scope(GCTracer* tracer, ScopeId scope)
: tracer_(tracer), scope_(scope) {
start_time_ = tracer_->heap_->MonotonicallyIncreasingTimeInMs();
// TODO(cbruni): remove once we fully moved to a trace-based system.
if (FLAG_runtime_call_stats) {
RuntimeCallStats* stats =
tracer_->heap_->isolate()->counters()->runtime_call_stats();
timer_.Initialize(&stats->GC, stats->current_timer());
stats->Enter(&timer_);
}
}
......@@ -31,6 +38,10 @@ GCTracer::Scope::~Scope() {
DCHECK(scope_ < NUMBER_OF_SCOPES); // scope_ is unsigned.
tracer_->current_.scopes[scope_] +=
tracer_->heap_->MonotonicallyIncreasingTimeInMs() - start_time_;
// TODO(cbruni): remove once we fully moved to a trace-based system.
if (FLAG_runtime_call_stats) {
tracer_->heap_->isolate()->counters()->runtime_call_stats()->Leave(&timer_);
}
}
......@@ -182,6 +193,13 @@ void GCTracer::Start(GarbageCollector collector, const char* gc_reason,
start_time, committed_memory);
heap_->isolate()->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* stats =
heap_->isolate()->counters()->runtime_call_stats();
timer_.Initialize(&stats->GC, stats->current_timer());
stats->Enter(&timer_);
}
}
......@@ -281,6 +299,10 @@ void GCTracer::Stop(GarbageCollector collector) {
longest_incremental_marking_finalization_step_ = 0.0;
cumulative_incremental_marking_finalization_steps_ = 0;
cumulative_incremental_marking_finalization_duration_ = 0.0;
// TODO(cbruni): remove once we fully moved to a trace-based system.
if (FLAG_runtime_call_stats) {
heap_->isolate()->counters()->runtime_call_stats()->Leave(&timer_);
}
}
......
......@@ -6,6 +6,7 @@
#define V8_HEAP_GC_TRACER_H_
#include "src/base/platform/platform.h"
#include "src/counters.h"
#include "src/globals.h"
namespace v8 {
......@@ -88,7 +89,6 @@ class RingBuffer {
enum ScavengeSpeedMode { kForAllObjects, kForSurvivedObjects };
// GCTracer collects and prints ONE line after each garbage collector
// invocation IFF --trace_gc is used.
// TODO(ernstm): Unit tests.
......@@ -152,6 +152,7 @@ class GCTracer {
GCTracer* tracer_;
ScopeId scope_;
double start_time_;
RuntimeCallTimer timer_;
DISALLOW_COPY_AND_ASSIGN(Scope);
};
......@@ -613,6 +614,9 @@ class GCTracer {
// Counts how many tracers were started without stopping.
int start_counter_;
// Separate timer used for --runtime_call_stats
RuntimeCallTimer timer_;
DISALLOW_COPY_AND_ASSIGN(GCTracer);
};
} // namespace internal
......
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