Reland Add V8.Execute histogram to measure time spent executing JS code.

Adds a V8.Execute histogram to measure the amount of time spent executing
JS code.

BUG=v8:4865
LOG=N

Review-Url: https://codereview.chromium.org/1976963002
Cr-Commit-Position: refs/heads/master@{#36245}
This commit is contained in:
rmcilroy 2016-05-13 07:44:13 -07:00 committed by Commit bot
parent df4b916e00
commit 48a1c5667a
2 changed files with 47 additions and 40 deletions

View File

@ -1783,6 +1783,7 @@ Local<Value> UnboundScript::GetSourceMappingURL() {
MaybeLocal<Value> Script::Run(Local<Context> context) {
PREPARE_FOR_EXECUTION_WITH_CALLBACK(context, "v8::Script::Run()", Value)
i::HistogramTimerScope execute_timer(isolate->counters()->execute(), true);
i::AggregatingHistogramTimerScope timer(isolate->counters()->compile_lazy());
i::TimerEventScope<i::TimerEventExecute> timer_scope(isolate);
TRACE_EVENT0("v8", "V8.Execute");
@ -4379,6 +4380,7 @@ MaybeLocal<Value> Object::CallAsFunction(Local<Context> context,
Local<Value> argv[]) {
PREPARE_FOR_EXECUTION_WITH_CALLBACK(context, "v8::Object::CallAsFunction()",
Value);
i::HistogramTimerScope execute_timer(isolate->counters()->execute(), true);
i::TimerEventScope<i::TimerEventExecute> timer_scope(isolate);
TRACE_EVENT0("v8", "V8.Execute");
auto self = Utils::OpenHandle(this);
@ -4406,6 +4408,7 @@ MaybeLocal<Value> Object::CallAsConstructor(Local<Context> context, int argc,
Local<Value> argv[]) {
PREPARE_FOR_EXECUTION_WITH_CALLBACK(context,
"v8::Object::CallAsConstructor()", Value);
i::HistogramTimerScope execute_timer(isolate->counters()->execute(), true);
i::TimerEventScope<i::TimerEventExecute> timer_scope(isolate);
TRACE_EVENT0("v8", "V8.Execute");
auto self = Utils::OpenHandle(this);
@ -4456,6 +4459,7 @@ MaybeLocal<Object> Function::NewInstance(Local<Context> context, int argc,
v8::Local<v8::Value> argv[]) const {
PREPARE_FOR_EXECUTION_WITH_CALLBACK(context, "v8::Function::NewInstance()",
Object);
i::HistogramTimerScope execute_timer(isolate->counters()->execute(), true);
i::TimerEventScope<i::TimerEventExecute> timer_scope(isolate);
TRACE_EVENT0("v8", "V8.Execute");
auto self = Utils::OpenHandle(this);
@ -4480,6 +4484,7 @@ MaybeLocal<v8::Value> Function::Call(Local<Context> context,
v8::Local<v8::Value> recv, int argc,
v8::Local<v8::Value> argv[]) {
PREPARE_FOR_EXECUTION_WITH_CALLBACK(context, "v8::Function::Call()", Value);
i::HistogramTimerScope execute_timer(isolate->counters()->execute(), true);
i::TimerEventScope<i::TimerEventExecute> timer_scope(isolate);
TRACE_EVENT0("v8", "V8.Execute");
auto self = Utils::OpenHandle(this);

View File

@ -670,46 +670,48 @@ class RuntimeCallTimerScope {
/* Asm/Wasm. */ \
HR(wasm_functions_per_module, V8.WasmFunctionsPerModule, 1, 10000, 51)
#define HISTOGRAM_TIMER_LIST(HT) \
/* Garbage collection timers. */ \
HT(gc_compactor, V8.GCCompactor, 10000, MILLISECOND) \
HT(gc_finalize, V8.GCFinalizeMC, 10000, MILLISECOND) \
HT(gc_finalize_reduce_memory, V8.GCFinalizeMCReduceMemory, 10000, \
MILLISECOND) \
HT(gc_scavenger, V8.GCScavenger, 10000, MILLISECOND) \
HT(gc_context, V8.GCContext, 10000, \
MILLISECOND) /* GC context cleanup time */ \
HT(gc_idle_notification, V8.GCIdleNotification, 10000, MILLISECOND) \
HT(gc_incremental_marking, V8.GCIncrementalMarking, 10000, MILLISECOND) \
HT(gc_incremental_marking_start, V8.GCIncrementalMarkingStart, 10000, \
MILLISECOND) \
HT(gc_incremental_marking_finalize, V8.GCIncrementalMarkingFinalize, 10000, \
MILLISECOND) \
HT(gc_low_memory_notification, V8.GCLowMemoryNotification, 10000, \
MILLISECOND) \
/* Parsing timers. */ \
HT(parse, V8.ParseMicroSeconds, 1000000, MICROSECOND) \
HT(parse_lazy, V8.ParseLazyMicroSeconds, 1000000, MICROSECOND) \
HT(pre_parse, V8.PreParseMicroSeconds, 1000000, MICROSECOND) \
/* Compilation times. */ \
HT(compile, V8.CompileMicroSeconds, 1000000, MICROSECOND) \
HT(compile_eval, V8.CompileEvalMicroSeconds, 1000000, MICROSECOND) \
/* Serialization as part of compilation (code caching) */ \
HT(compile_serialize, V8.CompileSerializeMicroSeconds, 100000, MICROSECOND) \
HT(compile_deserialize, V8.CompileDeserializeMicroSeconds, 1000000, \
MICROSECOND) \
/* Total compilation time incl. caching/parsing */ \
HT(compile_script, V8.CompileScriptMicroSeconds, 1000000, MICROSECOND) \
/* Asm/Wasm */ \
HT(wasm_instantiate_module_time, V8.WasmInstantiateModuleMicroSeconds, \
1000000, MICROSECOND) \
HT(wasm_decode_module_time, V8.WasmDecodeModuleMicroSeconds, 1000000, \
MICROSECOND) \
HT(wasm_decode_function_time, V8.WasmDecodeFunctionMicroSeconds, 1000000, \
MICROSECOND) \
HT(wasm_compile_module_time, V8.WasmCompileModuleMicroSeconds, 1000000, \
MICROSECOND) \
HT(wasm_compile_function_time, V8.WasmCompileFunctionMicroSeconds, 1000000, \
#define HISTOGRAM_TIMER_LIST(HT) \
/* Garbage collection timers. */ \
HT(gc_compactor, V8.GCCompactor, 10000, MILLISECOND) \
HT(gc_finalize, V8.GCFinalizeMC, 10000, MILLISECOND) \
HT(gc_finalize_reduce_memory, V8.GCFinalizeMCReduceMemory, 10000, \
MILLISECOND) \
HT(gc_scavenger, V8.GCScavenger, 10000, MILLISECOND) \
HT(gc_context, V8.GCContext, 10000, \
MILLISECOND) /* GC context cleanup time */ \
HT(gc_idle_notification, V8.GCIdleNotification, 10000, MILLISECOND) \
HT(gc_incremental_marking, V8.GCIncrementalMarking, 10000, MILLISECOND) \
HT(gc_incremental_marking_start, V8.GCIncrementalMarkingStart, 10000, \
MILLISECOND) \
HT(gc_incremental_marking_finalize, V8.GCIncrementalMarkingFinalize, 10000, \
MILLISECOND) \
HT(gc_low_memory_notification, V8.GCLowMemoryNotification, 10000, \
MILLISECOND) \
/* Parsing timers. */ \
HT(parse, V8.ParseMicroSeconds, 1000000, MICROSECOND) \
HT(parse_lazy, V8.ParseLazyMicroSeconds, 1000000, MICROSECOND) \
HT(pre_parse, V8.PreParseMicroSeconds, 1000000, MICROSECOND) \
/* Compilation times. */ \
HT(compile, V8.CompileMicroSeconds, 1000000, MICROSECOND) \
HT(compile_eval, V8.CompileEvalMicroSeconds, 1000000, MICROSECOND) \
/* Serialization as part of compilation (code caching) */ \
HT(compile_serialize, V8.CompileSerializeMicroSeconds, 100000, MICROSECOND) \
HT(compile_deserialize, V8.CompileDeserializeMicroSeconds, 1000000, \
MICROSECOND) \
/* Total compilation time incl. caching/parsing */ \
HT(compile_script, V8.CompileScriptMicroSeconds, 1000000, MICROSECOND) \
/* Total JavaScript execution time (including callbacks and runtime calls */ \
HT(execute, V8.Execute, 1000000, MICROSECOND) \
/* Asm/Wasm */ \
HT(wasm_instantiate_module_time, V8.WasmInstantiateModuleMicroSeconds, \
1000000, MICROSECOND) \
HT(wasm_decode_module_time, V8.WasmDecodeModuleMicroSeconds, 1000000, \
MICROSECOND) \
HT(wasm_decode_function_time, V8.WasmDecodeFunctionMicroSeconds, 1000000, \
MICROSECOND) \
HT(wasm_compile_module_time, V8.WasmCompileModuleMicroSeconds, 1000000, \
MICROSECOND) \
HT(wasm_compile_function_time, V8.WasmCompileFunctionMicroSeconds, 1000000, \
MICROSECOND)
#define AGGREGATABLE_HISTOGRAM_TIMER_LIST(AHT) \