Skip to content

Commit 2564344

Browse files
legendecasnodejs-github-bot
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 7df69d5 commit 2564344

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
@@ -200,10 +200,7 @@
200200
'src/timers.cc',
201201
'src/timer_wrap.cc',
202202
'src/tracing/agent.cc',
203-
'src/tracing/agent_legacy.cc',
204-
'src/tracing/node_trace_buffer.cc',
205-
'src/tracing/node_trace_writer.cc',
206-
'src/tracing/trace_event.cc',
203+
'src/tracing/trace_event_helper.cc',
207204
'src/tracing/traced_value.cc',
208205
'src/tty_wrap.cc',
209206
'src/udp_wrap.cc',
@@ -339,11 +336,8 @@
339336
'src/tcp_wrap.h',
340337
'src/timers.h',
341338
'src/tracing/agent.h',
342-
'src/tracing/agent_legacy.h',
343-
'src/tracing/node_trace_buffer.h',
344-
'src/tracing/node_trace_writer.h',
339+
'src/tracing/trace_event_helper.h',
345340
'src/tracing/trace_event.h',
346-
'src/tracing/trace_event_common.h',
347341
'src/tracing/traced_value.h',
348342
'src/timer_wrap.h',
349343
'src/timer_wrap-inl.h',
@@ -460,6 +454,18 @@
460454
'src/node_crypto.cc',
461455
'src/node_crypto.h',
462456
],
457+
'node_tracing_perfetto_sources': [
458+
],
459+
'node_tracing_legacy_sources': [
460+
'src/tracing/agent_legacy.cc',
461+
'src/tracing/agent_legacy.h',
462+
'src/tracing/node_trace_buffer.cc',
463+
'src/tracing/node_trace_buffer.h',
464+
'src/tracing/node_trace_writer.cc',
465+
'src/tracing/node_trace_writer.h',
466+
'src/tracing/trace_event_legacy_inl.h',
467+
'src/tracing/trace_event_legacy.h',
468+
],
463469
'node_cctest_openssl_sources': [
464470
'test/cctest/test_crypto_clienthello.cc',
465471
'test/cctest/test_node_crypto.cc',
@@ -963,6 +969,18 @@
963969
}],
964970
],
965971
}],
972+
[ 'v8_use_perfetto==1', {
973+
'sources': [
974+
'<@(node_tracing_perfetto_sources)',
975+
],
976+
'dependencies': [
977+
'deps/perfetto/perfetto.gyp:perfetto_sdk',
978+
],
979+
}, {
980+
'sources': [
981+
'<@(node_tracing_legacy_sources)',
982+
],
983+
}],
966984
[ 'v8_enable_inspector==1', {
967985
'includes' : [ 'src/inspector/node_inspector.gypi' ],
968986
}, {
@@ -1463,9 +1481,6 @@
14631481
'sources!': [ '<@(node_cctest_quic_sources)' ],
14641482
}],
14651483
[ 'v8_use_perfetto==1', {
1466-
'defines': [
1467-
'PERFETTO_ENABLE_LEGACY_TRACE_EVENTS=1'
1468-
],
14691484
'dependencies': [
14701485
'deps/perfetto/perfetto.gyp:perfetto_sdk',
14711486
],
@@ -1792,9 +1807,6 @@
17921807
],
17931808
}],
17941809
[ 'v8_use_perfetto==1', {
1795-
'defines': [
1796-
'PERFETTO_ENABLE_LEGACY_TRACE_EVENTS=1'
1797-
],
17981810
'dependencies': [
17991811
'deps/perfetto/perfetto.gyp:perfetto_sdk',
18001812
],

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)