Commit 25326bf8 authored by machenbach's avatar machenbach Committed by Commit bot

Reland of [counters] adding runtime call timers for GC (patchset #1 id:1 of...

Reland of [counters] adding runtime call timers for GC (patchset #1 id:1 of https://codereview.chromium.org/1827563003/ )

Reason for revert:
Reverting doesn't help here :/ Will disable the test.

Original issue's description:
> Revert of [counters] adding runtime call timers for GC (patchset #4 id:60001 of https://codereview.chromium.org/1825093002/ )
>
> Reason for revert:
> [Sheriff] ASAN bot is really badass today:
> https://build.chromium.org/p/client.v8/builders/V8%20Linux64%20ASAN/builds/10844
>
> Original issue's description:
> > [counters] adding runtime call timers for GC
> >
> > Adding an additional timer for the GC to make the other runtime call counters
> > more stable.
> >
> > BUG=
> >
> > Committed: https://crrev.com/9ec649638d553a891b0356155f4f15f3a260c1af
> > Cr-Commit-Position: refs/heads/master@{#35033}
>
> TBR=ulan@chromium.org,cbruni@chromium.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=
>
> Committed: https://crrev.com/a1521c90d54bf4cdaaf4c6ae549d297d5779ac08
> Cr-Commit-Position: refs/heads/master@{#35034}

TBR=ulan@chromium.org,cbruni@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=

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

Cr-Commit-Position: refs/heads/master@{#35035}
parent a1521c90
......@@ -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