Commit 07f97271 authored by Sara Tang's avatar Sara Tang Committed by Commit Bot

[diagnostics] Only conditionally enable ETWJITInterface

While testing the perf for v8-etw, I noticed that the runtime flag
didn't completely guard from event emission. This change fixes that.

Bug: v8:11043
Change-Id: Iee919e6030214e18173c93e4426d6437aed08235
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2757894Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Reviewed-by: 's avatarCamillo Bruni <cbruni@chromium.org>
Commit-Queue: Sara Tang <sartang@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#73424}
parent bfc10de8
......@@ -8135,7 +8135,7 @@ void Isolate::Initialize(Isolate* isolate,
}
#endif // ENABLE_GDB_JIT_INTERFACE
#if defined(V8_TARGET_OS_WIN) && defined(V8_ENABLE_SYSTEM_INSTRUMENTATION)
if (code_event_handler == nullptr) {
if (code_event_handler == nullptr && i::FLAG_enable_system_instrumentation) {
code_event_handler = i::ETWJITInterface::EventHandler;
}
#endif // defined(V8_TARGET_OS_WIN)
......
......@@ -4536,13 +4536,16 @@ int Shell::Main(int argc, char* argv[]) {
std::unique_ptr<platform::tracing::TracingController> tracing;
if (options.trace_enabled && !i::FLAG_verify_predictable) {
tracing = std::make_unique<platform::tracing::TracingController>();
const char* trace_path =
options.trace_path ? options.trace_path : "v8_trace.json";
trace_file.open(trace_path);
if (!trace_file.good()) {
printf("Cannot open trace file '%s' for writing: %s.\n", trace_path,
strerror(errno));
return 1;
if (!options.enable_system_instrumentation) {
const char* trace_path =
options.trace_path ? options.trace_path : "v8_trace.json";
trace_file.open(trace_path);
if (!trace_file.good()) {
printf("Cannot open trace file '%s' for writing: %s.\n", trace_path,
strerror(errno));
return 1;
}
}
#ifdef V8_USE_PERFETTO
......
......@@ -1880,6 +1880,9 @@ DEFINE_BOOL(interpreted_frames_native_stack, false,
"profilers).")
#endif
DEFINE_BOOL(enable_system_instrumentation, false,
"Enable platform-specific profiling.")
//
// Disassembler only flags
//
......
......@@ -176,15 +176,19 @@ void V8::InitializePlatform(v8::Platform* platform) {
v8::base::SetPrintStackTrace(platform_->GetStackTracePrinter());
v8::tracing::TracingCategoryObserver::SetUp();
#if defined(V8_TARGET_OS_WIN) && defined(V8_ENABLE_SYSTEM_INSTRUMENTATION)
// TODO(sartang@microsoft.com): Move to platform specific diagnostics object
v8::internal::ETWJITInterface::Register();
if (FLAG_enable_system_instrumentation) {
// TODO(sartang@microsoft.com): Move to platform specific diagnostics object
v8::internal::ETWJITInterface::Register();
}
#endif
}
void V8::ShutdownPlatform() {
CHECK(platform_);
#if defined(V8_TARGET_OS_WIN) && defined(V8_ENABLE_SYSTEM_INSTRUMENTATION)
v8::internal::ETWJITInterface::Unregister();
if (FLAG_enable_system_instrumentation) {
v8::internal::ETWJITInterface::Unregister();
}
#endif
v8::tracing::TracingCategoryObserver::TearDown();
v8::base::SetPrintStackTrace(nullptr);
......
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