Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,13 @@ jobs:
include:
- runner: ubuntu-24.04
system: x86_64-linux
perfetto: true
- runner: ubuntu-24.04-arm
system: aarch64-linux
- runner: macos-15-intel
system: x86_64-darwin
- runner: macos-latest
system: aarch64-darwin
name: '${{ matrix.system }}: with shared libraries${{ matrix.perfetto && '' and perfetto'' || '''' }}'
name: '${{ matrix.system }}: with shared libraries'
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
Expand Down Expand Up @@ -121,7 +120,6 @@ jobs:
--pure --keep TAR_DIR --keep FLAKY_TESTS \
--keep SCCACHE_GHA_ENABLED --keep SCCACHE_GHA_RW_MODE \
--keep ACTIONS_CACHE_SERVICE_V2 --keep ACTIONS_RESULTS_URL --keep ACTIONS_RUNTIME_TOKEN \
--arg withPerfetto ${{ matrix.perfetto || false }} \
--arg ccache '(import <nixpkgs> {}).sccache' \
--run '
make build-ci -j4 V=1 && sccache --stop-server
Expand All @@ -137,7 +135,6 @@ jobs:
nix-shell \
-I nixpkgs=./tools/nix/pkgs.nix \
--pure --keep SCCACHE_LOCAL_RW_MODE \
--arg withPerfetto ${{ matrix.perfetto || false }} \
--arg ccache '(import <nixpkgs> {}).sccache' \
--run '
make build-ci -j4 V=1
Expand Down
73 changes: 0 additions & 73 deletions .github/workflows/test-linux-perfetto.yml

This file was deleted.

5 changes: 1 addition & 4 deletions .github/workflows/test-shared.yml
Original file line number Diff line number Diff line change
Expand Up @@ -153,21 +153,18 @@ jobs:
include:
- runner: ubuntu-24.04
system: x86_64-linux
# Exercise the trace-event code against a perfetto-enabled V8.
perfetto: true
# built separately in build-aarch64-linux-v8
# - runner: ubuntu-24.04-arm
# system: aarch64-linux
- runner: macos-15-intel
system: x86_64-darwin
- runner: macos-latest
system: aarch64-darwin
name: '${{ matrix.system }}: with shared libraries${{ matrix.perfetto && '' and perfetto'' || '''' }}'
name: '${{ matrix.system }}: with shared libraries'
uses: $/.github/workflows/build-shared.yml
with:
runner: ${{ matrix.runner }}
with-sccache: ${{ github.base_ref == 'main' || github.ref_name == 'main' }}
extra-nix-flags: ${{ matrix.perfetto && '--arg withPerfetto true' || '' }}
secrets:
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}

Expand Down
31 changes: 17 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -320,8 +320,23 @@ v8: ## Build deps/v8.
export PATH="$(NO_BIN_OVERRIDE_PATH)" && \
tools/make-v8.sh $(V8_ARCH).$(BUILDTYPE_LOWER) $(V8_BUILD_OPTIONS)

ifneq ($(V8_USE_PERFETTO),0)
TRACE_PROCESSOR_SHELL_PATH ?= tools/perfetto/trace_processor_shell

# The downloaded copy has to match the vendored perfetto, so a version bump
# re-downloads it. An overridden path is a build we do not manage and may not
# be writable, so it gets no prerequisite and is left alone once it exists.
ifeq ($(TRACE_PROCESSOR_SHELL_PATH),tools/perfetto/trace_processor_shell)
TRACE_PROCESSOR_SHELL_DEPS = deps/perfetto/VERSION
endif

$(TRACE_PROCESSOR_SHELL_PATH): $(TRACE_PROCESSOR_SHELL_DEPS)
@tools/perfetto/get_trace_processor $@

endif # </V8_USE_PERFETTO != 0>

.PHONY: jstest
jstest: build-addons build-js-native-api-tests build-node-api-tests build-sqlite-tests build-ffi-tests ## Run addon tests and JS tests.
jstest: build-addons build-js-native-api-tests build-node-api-tests build-sqlite-tests build-ffi-tests $(TRACE_PROCESSOR_SHELL_PATH) ## Run addon tests and JS tests.
$(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) \
$(TEST_CI_ARGS) \
--skip-tests=$(CI_SKIP_TESTS) \
Expand All @@ -339,18 +354,6 @@ coverage-run-js: ## Run JavaScript tests with coverage.
TEST_CI_ARGS="$(TEST_CI_ARGS) --type=coverage" $(MAKE) jstest
$(MAKE) coverage-report-js

TRACE_PROCESSOR_SHELL_PATH ?= tools/perfetto/trace_processor_shell

# The downloaded copy has to match the vendored perfetto, so a version bump
# re-downloads it. An overridden path is a build we do not manage and may not
# be writable, so it gets no prerequisite and is left alone once it exists.
ifeq ($(TRACE_PROCESSOR_SHELL_PATH),tools/perfetto/trace_processor_shell)
TRACE_PROCESSOR_SHELL_DEPS = deps/perfetto/VERSION
endif

$(TRACE_PROCESSOR_SHELL_PATH): $(TRACE_PROCESSOR_SHELL_DEPS)
@tools/perfetto/get_trace_processor $@

.PHONY: test
# This does not run tests of third-party libraries inside deps.
test: all ## Run default tests and build docs.
Expand Down Expand Up @@ -660,7 +663,7 @@ test-ci-js: | clear-stalled ## Build and test JavaScript with building anything
.PHONY: test-ci
# Related CI jobs: most CI tests, excluding node-test-commit-arm-fanned
test-ci: LOGLEVEL := info ## Build and test everything (CI).
test-ci: | clear-stalled bench-addons-build build-addons build-js-native-api-tests build-node-api-tests build-sqlite-tests build-ffi-tests doc-only
test-ci: | clear-stalled bench-addons-build build-addons build-js-native-api-tests build-node-api-tests build-sqlite-tests build-ffi-tests doc-only $(TRACE_PROCESSOR_SHELL_PATH)
out/Release/cctest --gtest_output=xml:out/junit/cctest.xml
$(PYTHON) tools/test.py $(PARALLEL_ARGS) -p tap --logfile test.tap \
--mode=$(BUILDTYPE_LOWER) --flaky-tests=$(FLAKY_TESTS) \
Expand Down
24 changes: 16 additions & 8 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -551,8 +551,7 @@
action='store_true',
dest='shared_perfetto',
default=None,
help='link to a shared perfetto SDK instead of the one in deps/perfetto '
'(requires --with-perfetto)')
help='link to a shared perfetto SDK instead of the one in deps/perfetto')

shared_optgroup.add_argument('--shared-perfetto-includes',
action='store',
Expand Down Expand Up @@ -1171,11 +1170,11 @@
default=None,
help='disable the V8 inspector protocol')

parser.add_argument('--with-perfetto',
parser.add_argument('--without-perfetto',
action='store_true',
dest='with_perfetto',
dest='without_perfetto',
default=None,
help='enable perfetto support')
help='disable perfetto support')

parser.add_argument('--shared',
action='store_true',
Expand Down Expand Up @@ -2273,7 +2272,7 @@ def configure_v8(o, configs):
options.v8_disable_temporal_support = True
o['variables']['v8_enable_temporal_support'] = 0 if options.v8_disable_temporal_support else 1
o['variables']['v8_trace_maps'] = 1 if options.trace_maps else 0
o['variables']['v8_use_perfetto'] = 1 if options.with_perfetto else 0
o['variables']['v8_use_perfetto'] = 0 if options.without_perfetto or not perfetto_supported() else 1
o['variables']['node_use_v8_platform'] = b(not options.without_v8_platform)
o['variables']['node_use_bundled_v8'] = b(not options.without_bundled_v8)
o['variables']['force_dynamic_crt'] = 1 if options.shared else 0
Expand Down Expand Up @@ -2396,12 +2395,20 @@ def configure_lief(o):

configure_library('lief', o, pkgname='LIEF')

def perfetto_supported():
return flavor not in ('aix', 'cloudabi', 'openbsd', 'os400', 'solaris')

def configure_perfetto(o):
if not options.with_perfetto:
if options.without_perfetto:
if options.shared_perfetto:
error('--shared-perfetto requires --with-perfetto')
error('--without-perfetto is incompatible with --shared-perfetto')
o['variables']['node_shared_perfetto'] = b(False)
return
if options.without_perfetto is None and not perfetto_supported():
warn(f'Perfetto is disabled for {flavor}: the bundled perfetto integration '
'is not available on this platform. Pass --without-perfetto to '
'silence this warning.')
return

configure_library('perfetto', o)

Expand Down Expand Up @@ -3059,6 +3066,7 @@ def make_bin_override():
config = {
'BUILDTYPE': 'Debug' if options.debug else 'Release',
'NODE_TARGET_TYPE': variables['node_target_type'],
'V8_USE_PERFETTO': str(variables['v8_use_perfetto']),
}

# Not needed for trivial case. Useless when it's a win32 path.
Expand Down
8 changes: 8 additions & 0 deletions deps/perfetto/perfetto.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@
'sources': [
'<@(perfetto_sdk_sources)',
],
'conditions': [
['OS=="win"', {
'defines': [
'WIN32_LEAN_AND_MEAN',
'NOMINMAX',
],
}],
],
},
]
}
5 changes: 5 additions & 0 deletions node.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@
[ 'OS=="linux" and target_arch=="s390x"', {
'cflags': [ '-march=z14' ],
}],
[ 'v8_use_perfetto==1 and node_shared_perfetto=="false"', {
'dependencies': [
'deps/perfetto/perfetto.gyp:perfetto_sdk',
],
}],
[ 'node_enable_d8=="true"', {
'dependencies': [ 'tools/v8_gypfiles/d8.gyp:d8' ],
}],
Expand Down
6 changes: 3 additions & 3 deletions shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
# Build options
icu ? pkgs.icu,
withAmaro ? true,
withFFI ? true,
withLief ? true,
withPerfetto ? true,
withQuic ? false,
withSQLite ? true,
withFFI ? true,
withSSL ? true,
withTemporal ? true,
withPerfetto ? false,
sharedLibDeps ? (
import ./tools/nix/sharedLibDeps.nix {
inherit
Expand Down Expand Up @@ -87,7 +87,7 @@ let
"--v8-${if withTemporal then "enable" else "disable"}-temporal-support"
]
++ builtins.map (depName: "--shared-${depName}") sharedV8Deps
++ pkgs.lib.optional withPerfetto "--with-perfetto";
++ pkgs.lib.optional (!withPerfetto) "--without-perfetto";
in
pkgs.mkShell {
inherit nativeBuildInputs;
Expand Down
4 changes: 2 additions & 2 deletions test/trace_events/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# `trace_events` Tests

When the `node` binary is built with configure flag `--with-perfetto`,
When the `node` binary is not built with configure flag `--without-perfetto`,
the tests in this folder depends on `tools/perfetto/trace_processor_shell`,
which is downloaded with `tools/perfetto/get_trace_processor` via
`make tools/perfetto/trace_processor_shell`, to convert Perfetto binary trace
files to JSON format. Set `TRACE_PROCESSOR_SHELL_PATH` to use an existing build
of the tool instead of downloading a release.
of the tool to disable downloading a release.

Refer to <https://perfetto.dev/docs/reference/trace-processor-cli>
for help of the `trace_processor_shell` CLI.
4 changes: 2 additions & 2 deletions tools/nix/sharedLibDeps.nix
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
pkgs ? import ./pkgs.nix { },
withFFI ? true,
withLief ? true,
withPerfetto ? true,
withQuic ? false,
withSQLite ? true,
withSSL ? true,
withFFI ? true,
withPerfetto ? false,
withTemporal ? true,
}:
{
Expand Down
2 changes: 1 addition & 1 deletion tools/nix/v8.nix
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ let
!(builtins.elem "--v8-disable-temporal-support" configureFlags)
) ../../deps/crates
++ lib.optional (
builtins.elem "--with-perfetto" configureFlags && !useSharedPerfetto
!(builtins.elem "--without-perfetto" configureFlags) && !useSharedPerfetto
) ../../deps/perfetto
++ lib.optionals (icu != null) [
../../tools/icu/icu_versions.json
Expand Down
6 changes: 5 additions & 1 deletion tools/v8_gypfiles/v8.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -1771,7 +1771,11 @@
}],
['v8_use_perfetto==1', {
'sources!': [
'<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn" "\\"v8_libplatform.*?v8_use_perfetto.*?sources \\-= ")',
'<(V8_ROOT)/src/libplatform/tracing/trace-buffer.cc',
'<(V8_ROOT)/src/libplatform/tracing/trace-buffer.h',
'<(V8_ROOT)/src/libplatform/tracing/trace-writer.cc',
'<(V8_ROOT)/src/libplatform/tracing/trace-writer.h',
'<(V8_ROOT)/src/tracing/trace-event-no-perfetto.h',
],
'sources': [
'<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn" "\\"v8_libplatform.*?v8_use_perfetto.*?sources \\+= ")',
Expand Down
Loading