Commit e3f48a76 authored by Benedikt Meurer's avatar Benedikt Meurer Committed by V8 LUCI CQ

[inspector] Add "disabled-by-default-v8.inspector" events.

This sprinkles some more trace events in the disabled by default
"v8.inspector" category, to help with understanding performance
impact of stack trace capturing better.

Bug: chromium:1283162
Change-Id: I6085d587f241635fbb6934bef3adc95f58c5d2aa
Doc: https://bit.ly/v8-cheaper-inspector-stack-traces
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3364085Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
Auto-Submit: Benedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Cr-Commit-Position: refs/heads/main@{#78477}
parent e9440c45
This diff is collapsed.
......@@ -499,6 +499,10 @@ Response V8RuntimeAgentImpl::setMaxCallStackSizeToCapture(int size) {
return Response::ServerError(
"maxCallStackSizeToCapture should be non-negative");
}
TRACE_EVENT_WITH_FLOW1(
TRACE_DISABLED_BY_DEFAULT("v8.inspector"),
"V8RuntimeAgentImpl::setMaxCallStackSizeToCapture", this,
TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT, "size", size);
V8StackTraceImpl::maxCallStackSizeToCapture = size;
return Response::Success();
}
......@@ -846,6 +850,9 @@ void V8RuntimeAgentImpl::restore() {
Response V8RuntimeAgentImpl::enable() {
if (m_enabled) return Response::Success();
TRACE_EVENT_WITH_FLOW0(TRACE_DISABLED_BY_DEFAULT("v8.inspector"),
"V8RuntimeAgentImpl::enable", this,
TRACE_EVENT_FLAG_FLOW_OUT);
m_inspector->client()->beginEnsureAllContextsInGroup(
m_session->contextGroupId());
m_enabled = true;
......@@ -862,6 +869,9 @@ Response V8RuntimeAgentImpl::enable() {
Response V8RuntimeAgentImpl::disable() {
if (!m_enabled) return Response::Success();
TRACE_EVENT_WITH_FLOW0(TRACE_DISABLED_BY_DEFAULT("v8.inspector"),
"V8RuntimeAgentImpl::disable", this,
TRACE_EVENT_FLAG_FLOW_IN);
m_enabled = false;
m_state->setBoolean(V8RuntimeAgentImplState::runtimeEnabled, false);
m_state->remove(V8RuntimeAgentImplState::bindings);
......
......@@ -42,8 +42,10 @@ std::vector<std::shared_ptr<StackFrame>> toFramesVector(
DCHECK(debugger->isolate()->InContext());
int frameCount = std::min(v8StackTrace->GetFrameCount(), maxStackSize);
TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("v8.stack_trace"),
"SymbolizeStackTrace", "frameCount", frameCount);
TRACE_EVENT1(
TRACE_DISABLED_BY_DEFAULT("v8.inspector") "," TRACE_DISABLED_BY_DEFAULT(
"v8.stack_trace"),
"toFramesVector", "frameCount", frameCount);
std::vector<std::shared_ptr<StackFrame>> frames(frameCount);
for (int i = 0; i < frameCount; ++i) {
......@@ -257,8 +259,10 @@ std::unique_ptr<V8StackTraceImpl> V8StackTraceImpl::capture(
V8Debugger* debugger, int maxStackSize) {
DCHECK(debugger);
TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("v8.stack_trace"),
"V8StackTraceImpl::capture", "maxFrameCount", maxStackSize);
TRACE_EVENT1(
TRACE_DISABLED_BY_DEFAULT("v8.inspector") "," TRACE_DISABLED_BY_DEFAULT(
"v8.stack_trace"),
"V8StackTraceImpl::capture", "maxFrameCount", maxStackSize);
v8::Isolate* isolate = debugger->isolate();
v8::HandleScope handleScope(isolate);
......@@ -402,8 +406,10 @@ std::shared_ptr<AsyncStackTrace> AsyncStackTrace::capture(
bool skipTopFrame) {
DCHECK(debugger);
TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("v8.stack_trace"),
"AsyncStackTrace::capture", "maxFrameCount", maxStackSize);
TRACE_EVENT1(
TRACE_DISABLED_BY_DEFAULT("v8.inspector") "," TRACE_DISABLED_BY_DEFAULT(
"v8.stack_trace"),
"AsyncStackTrace::capture", "maxFrameCount", maxStackSize);
v8::Isolate* isolate = debugger->isolate();
v8::HandleScope handleScope(isolate);
......
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