diff --git a/.gitmodules b/.gitmodules index 5744bd75..5c15dba5 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "crates/instrument-hooks-bindings/instrument-hooks"] path = crates/instrument-hooks-bindings/instrument-hooks url = https://github.com/CodSpeedHQ/instrument-hooks.git +[submodule "crates/samply-codspeed"] + path = crates/samply-codspeed + url = https://github.com/CodSpeedHQ/samply-codspeed.git diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7e1690ef..d8fbace6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -17,7 +17,8 @@ repos: rev: v1.0 hooks: - id: fmt - args: [--all, --] + args: [--] + pass_filenames: false - id: clippy args: [--all-targets, --, -D, warnings] - repo: https://github.com/cpp-linter/cpp-linter-hooks diff --git a/Cargo.lock b/Cargo.lock index 1a569b1e..14c40bfe 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -125,7 +125,7 @@ version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" dependencies = [ - "windows-sys 0.61.2", + "windows-sys 0.60.2", ] [[package]] @@ -136,7 +136,7 @@ checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" dependencies = [ "anstyle", "once_cell_polyfill", - "windows-sys 0.61.2", + "windows-sys 0.60.2", ] [[package]] @@ -1021,7 +1021,7 @@ dependencies = [ "libc", "option-ext", "redox_users 0.5.2", - "windows-sys 0.61.2", + "windows-sys 0.60.2", ] [[package]] @@ -1159,7 +1159,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.61.2", + "windows-sys 0.60.2", ] [[package]] @@ -1386,7 +1386,6 @@ dependencies = [ [[package]] name = "fxprof-processed-profile" version = "0.8.1" -source = "git+https://github.com/CodSpeedHQ/samply-codspeed?rev=81ba2c346e71#81ba2c346e71d05aaef94448e2962961d29cb4c8" dependencies = [ "bitflags", "debugid", @@ -1712,7 +1711,7 @@ dependencies = [ "js-sys", "log", "wasm-bindgen", - "windows-core 0.62.2", + "windows-core", ] [[package]] @@ -2559,7 +2558,7 @@ version = "0.50.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" dependencies = [ - "windows-sys 0.61.2", + "windows-sys 0.60.2", ] [[package]] @@ -3673,7 +3672,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys 0.12.1", - "windows-sys 0.61.2", + "windows-sys 0.60.2", ] [[package]] @@ -3731,7 +3730,7 @@ dependencies = [ "security-framework", "security-framework-sys", "webpki-root-certs", - "windows-sys 0.61.2", + "windows-sys 0.60.2", ] [[package]] @@ -3785,7 +3784,6 @@ dependencies = [ [[package]] name = "samply" version = "0.13.1" -source = "git+https://github.com/CodSpeedHQ/samply-codspeed?rev=81ba2c346e71#81ba2c346e71d05aaef94448e2962961d29cb4c8" dependencies = [ "bitflags", "byteorder", @@ -3854,7 +3852,6 @@ dependencies = [ [[package]] name = "samply-api" version = "0.24.0" -source = "git+https://github.com/CodSpeedHQ/samply-codspeed?rev=81ba2c346e71#81ba2c346e71d05aaef94448e2962961d29cb4c8" dependencies = [ "samply-debugid", "samply-symbols", @@ -3870,7 +3867,6 @@ dependencies = [ [[package]] name = "samply-debugid" version = "0.1.0" -source = "git+https://github.com/CodSpeedHQ/samply-codspeed?rev=81ba2c346e71#81ba2c346e71d05aaef94448e2962961d29cb4c8" dependencies = [ "debugid", "uuid", @@ -3879,7 +3875,6 @@ dependencies = [ [[package]] name = "samply-object" version = "0.1.0" -source = "git+https://github.com/CodSpeedHQ/samply-codspeed?rev=81ba2c346e71#81ba2c346e71d05aaef94448e2962961d29cb4c8" dependencies = [ "debugid", "object", @@ -3890,7 +3885,6 @@ dependencies = [ [[package]] name = "samply-quota-manager" version = "0.1.0" -source = "git+https://github.com/CodSpeedHQ/samply-codspeed?rev=81ba2c346e71#81ba2c346e71d05aaef94448e2962961d29cb4c8" dependencies = [ "bytesize", "futures", @@ -3904,7 +3898,6 @@ dependencies = [ [[package]] name = "samply-symbols" version = "0.24.1" -source = "git+https://github.com/CodSpeedHQ/samply-codspeed?rev=81ba2c346e71#81ba2c346e71d05aaef94448e2962961d29cb4c8" dependencies = [ "addr2line", "bitflags", @@ -4244,7 +4237,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3a766e1110788c36f4fa1c2b71b387a7815aa65f88ce0229841826633d93723e" dependencies = [ "libc", - "windows-sys 0.61.2", + "windows-sys 0.60.2", ] [[package]] @@ -4470,10 +4463,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd" dependencies = [ "fastrand", - "getrandom 0.4.2", + "getrandom 0.3.4", "once_cell", "rustix 1.1.4", - "windows-sys 0.61.2", + "windows-sys 0.60.2", ] [[package]] @@ -4492,7 +4485,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "230a1b821ccbd75b185820a1f1ff7b14d21da1e442e22c0863ea5f08771a8874" dependencies = [ "rustix 1.1.4", - "windows-sys 0.61.2", + "windows-sys 0.60.2", ] [[package]] @@ -5273,7 +5266,6 @@ dependencies = [ [[package]] name = "wholesym" version = "0.8.1" -source = "git+https://github.com/CodSpeedHQ/samply-codspeed?rev=81ba2c346e71#81ba2c346e71d05aaef94448e2962961d29cb4c8" dependencies = [ "bytes", "core-foundation 0.10.1", @@ -5330,7 +5322,7 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "windows-sys 0.61.2", + "windows-sys 0.60.2", ] [[package]] @@ -5355,7 +5347,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9babd3a767a4c1aef6900409f85f5d53ce2544ccdfaa86dad48c91782c6d6893" dependencies = [ "windows-collections", - "windows-core 0.61.2", + "windows-core", "windows-future", "windows-link 0.1.3", "windows-numerics", @@ -5367,7 +5359,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3beeceb5e5cfd9eb1d76b381630e82c4241ccd0d27f1a39ed41b2760b255c5e8" dependencies = [ - "windows-core 0.61.2", + "windows-core", ] [[package]] @@ -5383,26 +5375,13 @@ dependencies = [ "windows-strings 0.4.2", ] -[[package]] -name = "windows-core" -version = "0.62.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" -dependencies = [ - "windows-implement", - "windows-interface", - "windows-link 0.2.1", - "windows-result 0.4.1", - "windows-strings 0.5.1", -] - [[package]] name = "windows-future" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc6a41e98427b19fe4b73c550f060b59fa592d7d686537eebf9385621bfbad8e" dependencies = [ - "windows-core 0.61.2", + "windows-core", "windows-link 0.1.3", "windows-threading", ] @@ -5447,7 +5426,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1" dependencies = [ - "windows-core 0.61.2", + "windows-core", "windows-link 0.1.3", ] diff --git a/Cargo.toml b/Cargo.toml index 4eeb2e75..61c393ce 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -68,7 +68,7 @@ rmp-serde = "1.3.1" uuid = { version = "1.23.1", features = ["v4"] } which = "8.0.2" crc32fast = "1.5.0" -samply = { git = "https://github.com/CodSpeedHQ/samply-codspeed", rev = "81ba2c346e71" } +samply = { path = "crates/samply-codspeed/samply" } # Memory profiling (memtrack) and the capability handling around it are Linux-only. [target.'cfg(target_os = "linux")'.dependencies] @@ -96,6 +96,7 @@ members = [ "crates/exec-harness", "crates/instrument-hooks-bindings", ] +exclude = ["crates/samply-codspeed"] [workspace.dependencies] anyhow = "1.0" @@ -106,7 +107,7 @@ serde_json = "1.0" serde = { version = "1.0.228", features = ["derive"] } ipc-channel = "0.20" itertools = "0.14.0" -linux-perf-event-reader = "0.10.2" # matches the version linux-perf-data resolves to +linux-perf-event-reader = "0.10.2" # matches the version linux-perf-data resolves to env_logger = "0.11.10" tempfile = "3.27.0" object = { version = "0.39", default-features = false, features = ["read_core", "elf"] } diff --git a/crates/samply-codspeed b/crates/samply-codspeed new file mode 160000 index 00000000..81ba2c34 --- /dev/null +++ b/crates/samply-codspeed @@ -0,0 +1 @@ +Subproject commit 81ba2c346e71d05aaef94448e2962961d29cb4c8 diff --git a/scripts/samply-dev.sh b/scripts/samply-dev.sh deleted file mode 100755 index f99a9c72..00000000 --- a/scripts/samply-dev.sh +++ /dev/null @@ -1,105 +0,0 @@ -#!/bin/sh -# Toggle "samply dev mode" for the runner. -# -# Dev mode redirects the runner's `samply`, `framehop`, and -# `linux-perf-event-reader` dependencies to local sibling checkouts by -# appending a `[patch]` block to the relevant `Cargo.toml` files. This lets you -# iterate on all three crates in place and have the runner pick the changes up -# immediately. -# -# Nothing is hidden from git: the appended blocks and the resulting `Cargo.lock` -# edits show up in `git status` like any other change. It is on you not to commit -# them — run `off` to remove the blocks when you're done. -# -# The block is delimited by sentinel comments so `off` can strip it cleanly: -# - /Cargo.toml patches samply + framehop + reader -> local -# - /Cargo.toml patches framehop + reader -> local (so samply -# standalone builds also use them) -# -# Usage: -# scripts/samply-dev.sh on enable dev mode (append patch blocks) -# scripts/samply-dev.sh off disable dev mode (remove patch blocks) -set -eu - -# Resolve repo roots relative to this script, not the cwd. -RUNNER_ROOT=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd) -SAMPLY_ROOT=$(CDPATH= cd -- "$RUNNER_ROOT/../samply-codspeed" 2>/dev/null && pwd || true) - -SAMPLY_URL="https://github.com/CodSpeedHQ/samply-codspeed" -FRAMEHOP_URL="https://github.com/CodSpeedHQ/framehop" - -RUNNER_MANIFEST="$RUNNER_ROOT/Cargo.toml" -SAMPLY_MANIFEST="$SAMPLY_ROOT/Cargo.toml" - -BEGIN="# >>> samply-dev (do not commit) >>>" -END="# <<< samply-dev <<<" - -usage() { - echo "Usage: $0 {on|off}" >&2 - echo " on enable dev mode (append patch blocks)" >&2 - echo " off disable dev mode (remove patch blocks)" >&2 - exit 2 -} - -# Remove the sentinel-delimited block from a manifest, if present. -strip_block() { - manifest=$1 - [ -f "$manifest" ] || return 0 - sed "/^$BEGIN\$/,/^$END\$/d" "$manifest" > "$manifest.tmp" && mv "$manifest.tmp" "$manifest" -} - -# Append a sentinel-delimited block to a manifest, replacing any existing one. -append_block() { - manifest=$1 - body=$2 - strip_block "$manifest" - printf '%s\n%s%s\n' "$BEGIN" "$body" "$END" >> "$manifest" -} - -enable() { - if [ -z "$SAMPLY_ROOT" ]; then - echo "error: ../samply-codspeed not found next to the runner repo" >&2 - exit 1 - fi - - append_block "$RUNNER_MANIFEST" "\ -[patch.\"$SAMPLY_URL\"] -samply = { path = \"../samply-codspeed/samply\" } - -[patch.\"$FRAMEHOP_URL\"] -framehop = { path = \"../framehop\" } - -[patch.crates-io] -linux-perf-event-reader = { path = \"../linux-perf-event-reader\" } -" - - append_block "$SAMPLY_MANIFEST" "\ -[patch.\"$FRAMEHOP_URL\"] -framehop = { path = \"../framehop\" } - -[patch.crates-io] -linux-perf-event-reader = { path = \"../linux-perf-event-reader\" } -" - - echo "samply dev mode: ON" - echo " patched $RUNNER_MANIFEST" - echo " patched $SAMPLY_MANIFEST" -} - -disable() { - strip_block "$RUNNER_MANIFEST" - echo " cleaned $RUNNER_MANIFEST" - if [ -n "$SAMPLY_ROOT" ]; then - strip_block "$SAMPLY_MANIFEST" - echo " cleaned $SAMPLY_MANIFEST" - fi - echo "samply dev mode: OFF" -} - -[ $# -eq 1 ] || usage - -case "$1" in - on) enable ;; - off) disable ;; - *) usage ;; -esac