GeezerVison is showing github.com — src,test: disable trace events tests when perfetto is enabled · nodejs/node@bc041dd
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: benchmark/misc/trace.js +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -14,13 +14,13 @@ const bench = common.createBenchmark(main, { | 14 | 14 | }); | 15 | 15 |
| 16 | 16 | const { | 17 | | - TRACE_EVENT_PHASE_NESTABLE_ASYNC_BEGIN: kBeforeEvent, | | 17 | + TRACE_EVENT_PHASE_BEGIN: kBeginEvent, | 18 | 18 | } = common.binding('constants').trace; | 19 | 19 |
| 20 | 20 | function doTrace(n, trace) { | 21 | 21 | bench.start(); | 22 | 22 | for (let i = 0; i < n; i++) { | 23 | | - trace(kBeforeEvent, 'foo', 'test', 0, 'test'); | | 23 | + trace(kBeginEvent, 'foo', 'test', 0, 'test'); | 24 | 24 | } | 25 | 25 | bench.end(n); | 26 | 26 | } | |
Collapse file Copy file name to clipboardExpand all lines: src/debug_utils.h +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -61,6 +61,7 @@ void NODE_EXTERN_PRIVATE FWrite(FILE* file, const std::string& str); | 61 | 61 | V(MODULE) \ | 62 | 62 | V(MKSNAPSHOT) \ | 63 | 63 | V(SNAPSHOT_SERDES) \ | | 64 | + V(PERFETTO) \ | 64 | 65 | V(PERMISSION_MODEL) \ | 65 | 66 | V(PLATFORM_MINIMAL) \ | 66 | 67 | V(PLATFORM_VERBOSE) \ | |
Collapse file Copy file name to clipboardExpand all lines: src/tracing/agent_perfetto.cc +25Lines changed: 25 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -30,6 +30,30 @@ std::set<std::string> flatten( | 30 | 30 | return result; | 31 | 31 | } | 32 | 32 |
| | 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 | + | 33 | 57 | } // namespace | 34 | 58 |
| 35 | 59 | // Writes trace chunks to a file, rotating by size. It deliberately uses the | @@ -252,6 +276,7 @@ PerfettoTracingAgent::PerfettoTracingAgent() { | 252 | 276 | // Set up the in-process backend that the tracing controller will connect | 253 | 277 | // to. | 254 | 278 | perfetto::TracingInitArgs init_args; | | 279 | + init_args.log_message_callback = perfetto_log_callback; | 255 | 280 | init_args.backends = perfetto::BackendType::kInProcessBackend; | 256 | 281 | perfetto::Tracing::Initialize(init_args); | 257 | 282 |
| |
Collapse file Copy file name to clipboardExpand all lines: test/common/index.js +15Lines changed: 15 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -71,6 +71,7 @@ const hasCrypto = Boolean(process.versions.openssl) && | 71 | 71 | const hasInspector = Boolean(process.features.inspector); | 72 | 72 | const hasSQLite = Boolean(process.versions.sqlite); | 73 | 73 | const hasFFI = Boolean(process.config.variables.node_use_ffi); | | 74 | +const hasPerfetto = Boolean(process.config.variables.v8_use_perfetto); | 74 | 75 |
| 75 | 76 | const hasQuic = hasCrypto && !!process.features.quic; | 76 | 77 |
| @@ -768,6 +769,18 @@ function skipIfFFIMissing() { | 768 | 769 | } | 769 | 770 | } | 770 | 771 |
| | 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 | + | 771 | 784 | function getArrayBufferViews(buf) { | 772 | 785 | const { buffer, byteOffset, byteLength } = buf; | 773 | 786 |
| @@ -1045,6 +1058,8 @@ const common = { | 1045 | 1058 | skipIfInspectorDisabled, | 1046 | 1059 | skipIfFFIMissing, | 1047 | 1060 | skipIfSQLiteMissing, | | 1061 | + skipIfPerfettoEnabled, | | 1062 | + skipIfPerfettoDisabled, | 1048 | 1063 | spawnPromisified, | 1049 | 1064 | sleepSync, | 1050 | 1065 | usesSharedLibrary, | |
Collapse file Copy file name to clipboardExpand all lines: test/common/index.mjs +2Lines changed: 2 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -52,6 +52,7 @@ const { | 52 | 52 | skipIfEslintMissing, | 53 | 53 | skipIfInspectorDisabled, | 54 | 54 | skipIfSQLiteMissing, | | 55 | + skipIfPerfettoEnabled, | 55 | 56 | spawnPromisified, | 56 | 57 | sleepSync, | 57 | 58 | } = common; | @@ -109,6 +110,7 @@ export { | 109 | 110 | skipIfEslintMissing, | 110 | 111 | skipIfInspectorDisabled, | 111 | 112 | skipIfSQLiteMissing, | | 113 | + skipIfPerfettoEnabled, | 112 | 114 | spawnPromisified, | 113 | 115 | sleepSync, | 114 | 116 | }; |
Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-inspector-tracing-domain.js +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 3 | 3 | const common = require('../common'); | 4 | 4 |
| 5 | 5 | common.skipIfInspectorDisabled(); | | 6 | +common.skipIfPerfettoEnabled(); | 6 | 7 |
| 7 | 8 | const { isMainThread } = require('worker_threads'); | 8 | 9 |
| |
Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-module-print-timing.mjs +2-1Lines changed: 2 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 1 | | -import { isWindows } from '../common/index.mjs'; | | 1 | +import { isWindows, skipIfPerfettoEnabled } from '../common/index.mjs'; | 2 | 2 | import assert from 'node:assert'; | 3 | 3 | import { writeFileSync } from 'node:fs'; | 4 | 4 | import { readFile } from 'node:fs/promises'; | @@ -7,6 +7,7 @@ import tmpdir from '../common/tmpdir.js'; | 7 | 7 | import { spawnSyncAndAssert } from '../common/child_process.js'; | 8 | 8 | import fixtures from '../common/fixtures.js'; | 9 | 9 |
| | 10 | +skipIfPerfettoEnabled(); | 10 | 11 | tmpdir.refresh(); | 11 | 12 |
| 12 | 13 | it('should print the timing information for cjs', () => { | |
Collapse file 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 number | Diff line number | Diff line change |
|---|
@@ -5,6 +5,7 @@ const common = require('../common'); | 5 | 5 | const { spawnSyncAndExitWithoutError } = require('../common/child_process'); | 6 | 6 | const { isMainThread } = require('worker_threads'); | 7 | 7 |
| | 8 | +common.skipIfPerfettoEnabled(); | 8 | 9 | if (!isMainThread) { | 9 | 10 | common.skip('This test only works on a main thread'); | 10 | 11 | } | |
Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-trace-events-all.js +2Lines changed: 2 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -4,6 +4,8 @@ const assert = require('assert'); | 4 | 4 | const cp = require('child_process'); | 5 | 5 | const fs = require('fs'); | 6 | 6 |
| | 7 | +common.skipIfPerfettoEnabled(); | | 8 | + | 7 | 9 | const CODE = | 8 | 10 | 'setTimeout(() => { for (let i = 0; i < 100000; i++) { "test" + i } }, 1)'; | 9 | 11 |
| |
Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-trace-events-api.js +2Lines changed: 2 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 4 | 4 | const common = require('../common'); | 5 | 5 | const { isMainThread } = require('worker_threads'); | 6 | 6 |
| | 7 | +common.skipIfPerfettoEnabled(); | | 8 | + | 7 | 9 | if (!isMainThread) { | 8 | 10 | // https://github.com/nodejs/node/issues/22767 | 9 | 11 | common.skip('This test only works on a main thread'); | |
|