GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — src,test: disable trace events tests when perfetto is enabled · nodejs/node@bc041dd

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • benchmark/misc
    • trace.js
  • src
    • debug_utils.h
    • tracing
      • agent_perfetto.cc
  • test
    • common
      • index.js
      • index.mjs
    • parallel
      • test-inspector-tracing-domain.js
      • test-module-print-timing.mjs
      • test-permission-fs-write-trace-events.js
      • test-trace-events-all.js
      • test-trace-events-api.js
      • test-trace-events-async-hooks-dynamic.js
      • test-trace-events-async-hooks-worker.js
      • test-trace-events-async-hooks.js
      • test-trace-events-binding.js
      • test-trace-events-bootstrap.js
      • test-trace-events-console.js
      • test-trace-events-dynamic-enable.js
      • test-trace-events-environment.js
      • test-trace-events-file-pattern.js
      • test-trace-events-fs-async.js
      • test-trace-events-fs-sync.js
      • test-trace-events-get-category-enabled-buffer.js
      • test-trace-events-http.js
      • test-trace-events-metadata.js
      • test-trace-events-net-abstract-socket.js
      • test-trace-events-net.js
      • test-trace-events-none.js
      • test-trace-events-process-exit.js
      • test-trace-events-promises.js
      • test-trace-events-threadpool.js
      • test-trace-events-v8.js
      • test-trace-events-vm.js
      • test-trace-events-worker-metadata-with-name.js
      • test-trace-events-worker-metadata.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎benchmark/misc/trace.js‎

Copy file name to clipboardExpand all lines: benchmark/misc/trace.js
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ const bench = common.createBenchmark(main, {
1414
});
1515

1616
const {
17-
TRACE_EVENT_PHASE_NESTABLE_ASYNC_BEGIN: kBeforeEvent,
17+
TRACE_EVENT_PHASE_BEGIN: kBeginEvent,
1818
} = common.binding('constants').trace;
1919

2020
function doTrace(n, trace) {
2121
bench.start();
2222
for (let i = 0; i < n; i++) {
23-
trace(kBeforeEvent, 'foo', 'test', 0, 'test');
23+
trace(kBeginEvent, 'foo', 'test', 0, 'test');
2424
}
2525
bench.end(n);
2626
}
Collapse file

‎src/debug_utils.h‎

Copy file name to clipboardExpand all lines: src/debug_utils.h
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ void NODE_EXTERN_PRIVATE FWrite(FILE* file, const std::string& str);
6161
V(MODULE) \
6262
V(MKSNAPSHOT) \
6363
V(SNAPSHOT_SERDES) \
64+
V(PERFETTO) \
6465
V(PERMISSION_MODEL) \
6566
V(PLATFORM_MINIMAL) \
6667
V(PLATFORM_VERBOSE) \
Collapse file

‎src/tracing/agent_perfetto.cc‎

Copy file name to clipboardExpand all lines: src/tracing/agent_perfetto.cc
+25Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,30 @@ std::set<std::string> flatten(
3030
return result;
3131
}
3232

33+
void perfetto_log_callback(perfetto::LogMessageCallbackArgs args) {
34+
const char* level_str = "UNKNOWN";
35+
switch (args.level) {
36+
case perfetto::base::kLogDebug:
37+
level_str = "DEBUG";
38+
break;
39+
case perfetto::base::kLogInfo:
40+
level_str = "INFO";
41+
break;
42+
case perfetto::base::kLogImportant:
43+
level_str = "IMPORTANT";
44+
break;
45+
case perfetto::base::kLogError:
46+
level_str = "ERROR";
47+
break;
48+
}
49+
per_process::Debug(DebugCategory::PERFETTO,
50+
"[%s] %s:%d: %s\n",
51+
level_str,
52+
args.filename,
53+
args.line,
54+
args.message);
55+
}
56+
3357
} // namespace
3458

3559
// Writes trace chunks to a file, rotating by size. It deliberately uses the
@@ -252,6 +276,7 @@ PerfettoTracingAgent::PerfettoTracingAgent() {
252276
// Set up the in-process backend that the tracing controller will connect
253277
// to.
254278
perfetto::TracingInitArgs init_args;
279+
init_args.log_message_callback = perfetto_log_callback;
255280
init_args.backends = perfetto::BackendType::kInProcessBackend;
256281
perfetto::Tracing::Initialize(init_args);
257282

Collapse file

‎test/common/index.js‎

Copy file name to clipboardExpand all lines: test/common/index.js
+15Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ const hasCrypto = Boolean(process.versions.openssl) &&
7171
const hasInspector = Boolean(process.features.inspector);
7272
const hasSQLite = Boolean(process.versions.sqlite);
7373
const hasFFI = Boolean(process.config.variables.node_use_ffi);
74+
const hasPerfetto = Boolean(process.config.variables.v8_use_perfetto);
7475

7576
const hasQuic = hasCrypto && !!process.features.quic;
7677

@@ -768,6 +769,18 @@ function skipIfFFIMissing() {
768769
}
769770
}
770771

772+
function skipIfPerfettoEnabled() {
773+
if (hasPerfetto) {
774+
skip('Perfetto is enabled');
775+
}
776+
}
777+
778+
function skipIfPerfettoDisabled() {
779+
if (!hasPerfetto) {
780+
skip('Perfetto is disabled');
781+
}
782+
}
783+
771784
function getArrayBufferViews(buf) {
772785
const { buffer, byteOffset, byteLength } = buf;
773786

@@ -1045,6 +1058,8 @@ const common = {
10451058
skipIfInspectorDisabled,
10461059
skipIfFFIMissing,
10471060
skipIfSQLiteMissing,
1061+
skipIfPerfettoEnabled,
1062+
skipIfPerfettoDisabled,
10481063
spawnPromisified,
10491064
sleepSync,
10501065
usesSharedLibrary,
Collapse file

‎test/common/index.mjs‎

Copy file name to clipboardExpand all lines: test/common/index.mjs
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ const {
5252
skipIfEslintMissing,
5353
skipIfInspectorDisabled,
5454
skipIfSQLiteMissing,
55+
skipIfPerfettoEnabled,
5556
spawnPromisified,
5657
sleepSync,
5758
} = common;
@@ -109,6 +110,7 @@ export {
109110
skipIfEslintMissing,
110111
skipIfInspectorDisabled,
111112
skipIfSQLiteMissing,
113+
skipIfPerfettoEnabled,
112114
spawnPromisified,
113115
sleepSync,
114116
};
Collapse file

‎test/parallel/test-inspector-tracing-domain.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-inspector-tracing-domain.js
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
const common = require('../common');
44

55
common.skipIfInspectorDisabled();
6+
common.skipIfPerfettoEnabled();
67

78
const { isMainThread } = require('worker_threads');
89

Collapse file

‎test/parallel/test-module-print-timing.mjs‎

Copy file name to clipboardExpand all lines: test/parallel/test-module-print-timing.mjs
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { isWindows } from '../common/index.mjs';
1+
import { isWindows, skipIfPerfettoEnabled } from '../common/index.mjs';
22
import assert from 'node:assert';
33
import { writeFileSync } from 'node:fs';
44
import { readFile } from 'node:fs/promises';
@@ -7,6 +7,7 @@ import tmpdir from '../common/tmpdir.js';
77
import { spawnSyncAndAssert } from '../common/child_process.js';
88
import fixtures from '../common/fixtures.js';
99

10+
skipIfPerfettoEnabled();
1011
tmpdir.refresh();
1112

1213
it('should print the timing information for cjs', () => {
Collapse file

‎test/parallel/test-permission-fs-write-trace-events.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-permission-fs-write-trace-events.js
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const common = require('../common');
55
const { spawnSyncAndExitWithoutError } = require('../common/child_process');
66
const { isMainThread } = require('worker_threads');
77

8+
common.skipIfPerfettoEnabled();
89
if (!isMainThread) {
910
common.skip('This test only works on a main thread');
1011
}
Collapse file

‎test/parallel/test-trace-events-all.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-trace-events-all.js
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ const assert = require('assert');
44
const cp = require('child_process');
55
const fs = require('fs');
66

7+
common.skipIfPerfettoEnabled();
8+
79
const CODE =
810
'setTimeout(() => { for (let i = 0; i < 100000; i++) { "test" + i } }, 1)';
911

Collapse file

‎test/parallel/test-trace-events-api.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-trace-events-api.js
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
const common = require('../common');
55
const { isMainThread } = require('worker_threads');
66

7+
common.skipIfPerfettoEnabled();
8+
79
if (!isMainThread) {
810
// https://github.com/nodejs/node/issues/22767
911
common.skip('This test only works on a main thread');

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.