Skip to content

Commit 0611d44

Browse files
legendecasaduh95
authored andcommitted
src: rename legacy trace event headers
Signed-off-by: Chengzhong Wu <cwu631@bloomberg.net> PR-URL: #64565 Refs: nodejs/diagnostics#654 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ryuhei Shima <shimaryuhei@gmail.com>
1 parent 2897cc1 commit 0611d44

10 files changed

Lines changed: 801 additions & 738 deletions

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1572,7 +1572,7 @@ LINT_CPP_EXCLUDE ?=
15721572
LINT_CPP_EXCLUDE += src/node_root_certs.h
15731573
LINT_CPP_EXCLUDE += $(LINT_CPP_ADDON_DOC_FILES)
15741574
# These files were copied more or less verbatim from V8.
1575-
LINT_CPP_EXCLUDE += src/tracing/trace_event.h src/tracing/trace_event_common.h
1575+
LINT_CPP_EXCLUDE += src/tracing/trace_event_legacy.h src/tracing/trace_event_legacy_inl.h
15761576

15771577
# deps/ncrypto is included in this list, as it is maintained in
15781578
# this repository, and should be linted. Eventually it should move

node.gyp

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -199,10 +199,7 @@
199199
'src/timers.cc',
200200
'src/timer_wrap.cc',
201201
'src/tracing/agent.cc',
202-
'src/tracing/agent_legacy.cc',
203-
'src/tracing/node_trace_buffer.cc',
204-
'src/tracing/node_trace_writer.cc',
205-
'src/tracing/trace_event.cc',
202+
'src/tracing/trace_event_helper.cc',
206203
'src/tracing/traced_value.cc',
207204
'src/tty_wrap.cc',
208205
'src/udp_wrap.cc',
@@ -338,11 +335,8 @@
338335
'src/tcp_wrap.h',
339336
'src/timers.h',
340337
'src/tracing/agent.h',
341-
'src/tracing/agent_legacy.h',
342-
'src/tracing/node_trace_buffer.h',
343-
'src/tracing/node_trace_writer.h',
338+
'src/tracing/trace_event_helper.h',
344339
'src/tracing/trace_event.h',
345-
'src/tracing/trace_event_common.h',
346340
'src/tracing/traced_value.h',
347341
'src/timer_wrap.h',
348342
'src/timer_wrap-inl.h',
@@ -449,6 +443,18 @@
449443
'src/node_crypto.cc',
450444
'src/node_crypto.h',
451445
],
446+
'node_tracing_perfetto_sources': [
447+
],
448+
'node_tracing_legacy_sources': [
449+
'src/tracing/agent_legacy.cc',
450+
'src/tracing/agent_legacy.h',
451+
'src/tracing/node_trace_buffer.cc',
452+
'src/tracing/node_trace_buffer.h',
453+
'src/tracing/node_trace_writer.cc',
454+
'src/tracing/node_trace_writer.h',
455+
'src/tracing/trace_event_legacy_inl.h',
456+
'src/tracing/trace_event_legacy.h',
457+
],
452458
'node_cctest_openssl_sources': [
453459
'test/cctest/test_crypto_clienthello.cc',
454460
'test/cctest/test_node_crypto.cc',
@@ -952,6 +958,18 @@
952958
}],
953959
],
954960
}],
961+
[ 'v8_use_perfetto==1', {
962+
'sources': [
963+
'<@(node_tracing_perfetto_sources)',
964+
],
965+
'dependencies': [
966+
'deps/perfetto/perfetto.gyp:perfetto_sdk',
967+
],
968+
}, {
969+
'sources': [
970+
'<@(node_tracing_legacy_sources)',
971+
],
972+
}],
955973
[ 'v8_enable_inspector==1', {
956974
'includes' : [ 'src/inspector/node_inspector.gypi' ],
957975
}, {
@@ -1444,9 +1462,6 @@
14441462
'sources!': [ '<@(node_cctest_quic_sources)' ],
14451463
}],
14461464
[ 'v8_use_perfetto==1', {
1447-
'defines': [
1448-
'PERFETTO_ENABLE_LEGACY_TRACE_EVENTS=1'
1449-
],
14501465
'dependencies': [
14511466
'deps/perfetto/perfetto.gyp:perfetto_sdk',
14521467
],
@@ -1773,9 +1788,6 @@
17731788
],
17741789
}],
17751790
[ 'v8_use_perfetto==1', {
1776-
'defines': [
1777-
'PERFETTO_ENABLE_LEGACY_TRACE_EVENTS=1'
1778-
],
17791791
'dependencies': [
17801792
'deps/perfetto/perfetto.gyp:perfetto_sdk',
17811793
],

src/inspector_agent.cc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
#include "inspector/runtime_agent.h"
1515
#include "inspector/storage_agent.h"
1616
#include "inspector/target_agent.h"
17+
#ifndef V8_USE_PERFETTO
1718
#include "inspector/tracing_agent.h"
19+
#endif // V8_USE_PERFETTO
1820
#include "inspector/worker_agent.h"
1921
#include "inspector/worker_inspector.h"
2022
#include "inspector_io.h"
@@ -238,9 +240,11 @@ class ChannelImpl final : public v8_inspector::V8Inspector::Channel,
238240
StringView(),
239241
V8Inspector::ClientTrustLevel::kFullyTrusted);
240242
node_dispatcher_ = std::make_unique<UberDispatcher>(this);
243+
#ifndef V8_USE_PERFETTO
241244
tracing_agent_ =
242245
std::make_unique<protocol::TracingAgent>(env, main_thread_);
243246
tracing_agent_->Wire(node_dispatcher_.get());
247+
#endif // V8_USE_PERFETTO
244248
if (worker_manager) {
245249
worker_agent_ = std::make_unique<protocol::WorkerAgent>(worker_manager);
246250
worker_agent_->Wire(node_dispatcher_.get());
@@ -274,8 +278,10 @@ class ChannelImpl final : public v8_inspector::V8Inspector::Channel,
274278
}
275279

276280
~ChannelImpl() override {
281+
#ifndef V8_USE_PERFETTO
277282
tracing_agent_->disable();
278283
tracing_agent_.reset(); // Dispose before the dispatchers
284+
#endif // V8_USE_PERFETTO
279285
if (worker_agent_) {
280286
worker_agent_->disable();
281287
worker_agent_.reset(); // Dispose before the dispatchers
@@ -436,7 +442,9 @@ class ChannelImpl final : public v8_inspector::V8Inspector::Channel,
436442
}
437443

438444
std::unique_ptr<protocol::RuntimeAgent> runtime_agent_;
445+
#ifndef V8_USE_PERFETTO
439446
std::unique_ptr<protocol::TracingAgent> tracing_agent_;
447+
#endif
440448
std::unique_ptr<protocol::WorkerAgent> worker_agent_;
441449
std::shared_ptr<protocol::TargetAgent> target_agent_;
442450
std::unique_ptr<NetworkInspector> network_inspector_;

src/node_internals.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -317,15 +317,6 @@ class ThreadPoolWork {
317317
const char* type_;
318318
};
319319

320-
#define TRACING_CATEGORY_NODE "node"
321-
#define TRACING_CATEGORY_NODE1(one) \
322-
TRACING_CATEGORY_NODE "," \
323-
TRACING_CATEGORY_NODE "." #one
324-
#define TRACING_CATEGORY_NODE2(one, two) \
325-
TRACING_CATEGORY_NODE "," \
326-
TRACING_CATEGORY_NODE "." #one "," \
327-
TRACING_CATEGORY_NODE "." #one "." #two
328-
329320
// Functions defined in node.cc that are exposed via the bootstrapper object
330321

331322
#if defined(__POSIX__) && !defined(__ANDROID__) && !defined(__CloudABI__)

src/tracing/agent_legacy.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
// This is an implementation of the legacy V8 tracing agent
77
// defined in `libplatform/v8-tracing.h`.
88

9+
#ifdef V8_USE_PERFETTO
10+
#error Perfetto is enabled.
11+
#endif
12+
913
#include "libplatform/v8-tracing.h"
1014
#include "node_mutex.h"
1115
#include "tracing/agent.h"

0 commit comments

Comments
 (0)