[TurboFan] Add RuntimeStats counters for main thread TurboFan phases

Adds RuntimeStats counters for HeapBrokerInitialization, Serialize,
SerializeMetadata and Finalization phases. These happen only on main thread.
In a followup cl we will also add counters for other phases that could happen
on main thread or background thread.

Earlier RecompileSynchronous was used to measure the time spent in Concurrent,
non Concurrent and Concurrent finalize phases. This cl replaces them with
OptimizeConcurrent, OptimizeNonConcurrent and OptimizeConcurrentFinalize
counters. This cl also renames RecompileConcurrent to OptimizeBackground to
make it clear this measures the background component of optimization.

This also updates names of trace events to be in-sync with RuntimeStat counters.

Bug: v8:9684
Change-Id: Ifda81ce7ab1c659c2df53bab924c51c46f46939b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1924439
Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
Reviewed-by: Dan Elphick <delphick@chromium.org>
Reviewed-by: Georg Neis <neis@chromium.org>
Commit-Queue: Mythri Alle <mythria@chromium.org>
Cr-Commit-Position: refs/heads/master@{#65147}
This commit is contained in:
Mythri A 2019-11-25 11:04:50 +00:00 committed by Commit Bot
parent 0de9e73309
commit 84b3532463
4 changed files with 26 additions and 10 deletions

View File

@ -736,10 +736,10 @@ void InsertCodeIntoOptimizedCodeCache(
bool GetOptimizedCodeNow(OptimizedCompilationJob* job, Isolate* isolate) {
TimerEventScope<TimerEventRecompileSynchronous> timer(isolate);
RuntimeCallTimerScope runtimeTimer(
isolate, RuntimeCallCounterId::kRecompileSynchronous);
isolate, RuntimeCallCounterId::kOptimizeNonConcurrent);
OptimizedCompilationInfo* compilation_info = job->compilation_info();
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"),
"V8.RecompileSynchronous");
"V8.OptimizeNonConcurrent");
if (job->PrepareJob(isolate) != CompilationJob::SUCCEEDED ||
job->ExecuteJob() != CompilationJob::SUCCEEDED ||
@ -783,9 +783,9 @@ bool GetOptimizedCodeLater(OptimizedCompilationJob* job, Isolate* isolate) {
TimerEventScope<TimerEventRecompileSynchronous> timer(isolate);
RuntimeCallTimerScope runtimeTimer(
isolate, RuntimeCallCounterId::kRecompileSynchronous);
isolate, RuntimeCallCounterId::kOptimizeConcurrentPrepare);
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"),
"V8.RecompileSynchronous");
"V8.OptimizeConcurrentPrepare");
if (job->PrepareJob(isolate) != CompilationJob::SUCCEEDED) return false;
isolate->optimizing_compile_dispatcher()->QueueForOptimization(job);
@ -2298,9 +2298,9 @@ bool Compiler::FinalizeOptimizedCompilationJob(OptimizedCompilationJob* job,
TimerEventScope<TimerEventRecompileSynchronous> timer(isolate);
RuntimeCallTimerScope runtimeTimer(
isolate, RuntimeCallCounterId::kRecompileSynchronous);
isolate, RuntimeCallCounterId::kOptimizeConcurrentFinalize);
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"),
"V8.RecompileSynchronous");
"V8.OptimizeConcurrentFinalize");
Handle<SharedFunctionInfo> shared = compilation_info->shared_info();

View File

@ -65,11 +65,11 @@ class OptimizingCompileDispatcher::CompileTask : public CancelableTask {
worker_thread_runtime_call_stats_);
RuntimeCallTimerScope runtimeTimer(
runtime_call_stats_scope.Get(),
RuntimeCallCounterId::kRecompileConcurrent);
RuntimeCallCounterId::kOptimizeBackgroundDispatcherJob);
TimerEventScope<TimerEventRecompileConcurrent> timer(isolate_);
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"),
"V8.RecompileConcurrent");
"V8.OptimizeBackground");
if (dispatcher_->recompilation_delay_ != 0) {
base::OS::Sleep(base::TimeDelta::FromMilliseconds(

View File

@ -83,6 +83,7 @@
#include "src/diagnostics/disassembler.h"
#include "src/execution/isolate-inl.h"
#include "src/init/bootstrapper.h"
#include "src/logging/counters.h"
#include "src/objects/shared-function-info.h"
#include "src/parsing/parse-info.h"
#include "src/tracing/trace-event.h"
@ -1084,6 +1085,8 @@ PipelineCompilationJob::Status PipelineCompilationJob::ExecuteJobImpl() {
PipelineCompilationJob::Status PipelineCompilationJob::FinalizeJobImpl(
Isolate* isolate) {
RuntimeCallTimerScope runtimeTimer(
isolate, RuntimeCallCounterId::kOptimizeFinalizePipelineJob);
MaybeHandle<Code> maybe_code = pipeline_.FinalizeCode();
Handle<Code> code;
if (!maybe_code.ToHandle(&code)) {
@ -1384,6 +1387,9 @@ struct HeapBrokerInitializationPhase {
static const char* phase_name() { return "V8.TFHeapBrokerInitialization"; }
void Run(PipelineData* data, Zone* temp_zone) {
RuntimeCallTimerScope runtimeTimer(
data->isolate(),
RuntimeCallCounterId::kOptimizeHeapBrokerInitialization);
data->broker()->InitializeAndStartSerializing(data->native_context());
}
};
@ -1392,6 +1398,8 @@ struct CopyMetadataForConcurrentCompilePhase {
static const char* phase_name() { return "V8.TFSerializeMetadata"; }
void Run(PipelineData* data, Zone* temp_zone) {
RuntimeCallTimerScope runtimeTimer(
data->isolate(), RuntimeCallCounterId::kOptimizeSerializeMetadata);
GraphReducer graph_reducer(temp_zone, data->graph(),
&data->info()->tick_counter(),
data->jsgraph()->Dead());
@ -1410,6 +1418,8 @@ struct SerializationPhase {
static const char* phase_name() { return "V8.TFSerialization"; }
void Run(PipelineData* data, Zone* temp_zone) {
RuntimeCallTimerScope runtimeTimer(
data->isolate(), RuntimeCallCounterId::kOptimizeSerialize);
SerializerForBackgroundCompilationFlags flags;
if (data->info()->is_bailout_on_uninitialized()) {
flags |= SerializerForBackgroundCompilationFlag::kBailoutOnUninitialized;

View File

@ -968,15 +968,21 @@ class RuntimeCallTimer final {
V(NamedSetterCallback) \
V(Object_DeleteProperty) \
V(ObjectVerify) \
V(OptimizeBackgroundDispatcherJob) \
V(OptimizeCode) \
V(OptimizeConcurrentPrepare) \
V(OptimizeConcurrentFinalize) \
V(OptimizeFinalizePipelineJob) \
V(OptimizeHeapBrokerInitialization) \
V(OptimizeNonConcurrent) \
V(OptimizeSerialize) \
V(OptimizeSerializeMetadata) \
V(ParseEval) \
V(ParseFunction) \
V(PropertyCallback) \
V(PrototypeMap_TransitionToAccessorProperty) \
V(PrototypeMap_TransitionToDataProperty) \
V(PrototypeObject_DeleteProperty) \
V(RecompileConcurrent) \
V(RecompileSynchronous) \
V(ReconfigureToDataProperty) \
V(StringLengthGetter) \
V(TestCounter1) \