Commit 1acb5db0 authored by Leszek Swirski's avatar Leszek Swirski Committed by V8 LUCI CQ

[test] Add perfetto initialisation to unittest runner

Bug: v8:12781
Change-Id: I1cf929e1d817ba81d25ba5095872b975c13f40d3
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3683319
Auto-Submit: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Reviewed-by: 's avatarCamillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80891}
parent 045a2b88
...@@ -11,6 +11,10 @@ ...@@ -11,6 +11,10 @@
#include "src/base/page-allocator.h" #include "src/base/page-allocator.h"
#include "testing/gmock/include/gmock/gmock.h" #include "testing/gmock/include/gmock/gmock.h"
#ifdef V8_USE_PERFETTO
#include "src/tracing/trace-event.h"
#endif // V8_USE_PERFETTO
namespace { namespace {
class CppGCEnvironment final : public ::testing::Environment { class CppGCEnvironment final : public ::testing::Environment {
...@@ -20,6 +24,13 @@ class CppGCEnvironment final : public ::testing::Environment { ...@@ -20,6 +24,13 @@ class CppGCEnvironment final : public ::testing::Environment {
// has to survive as long as the process, so it's ok to leak the allocator // has to survive as long as the process, so it's ok to leak the allocator
// here. // here.
cppgc::InitializeProcess(new v8::base::PageAllocator()); cppgc::InitializeProcess(new v8::base::PageAllocator());
#ifdef V8_USE_PERFETTO
// Set up the in-process perfetto backend.
perfetto::TracingInitArgs init_args;
init_args.backends = perfetto::BackendType::kInProcessBackend;
perfetto::Tracing::Initialize(init_args);
#endif // V8_USE_PERFETTO
} }
void TearDown() override { cppgc::ShutdownProcess(); } void TearDown() override { cppgc::ShutdownProcess(); }
......
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