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
18 changes: 6 additions & 12 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,16 @@ cargo build
# Build in release mode
cargo build --release

# Run tests (prefer nextest if available)
cargo nextest run # preferred if installed
cargo test # fallback if nextest is not available
# Run tests
cargo test

# Run specific test
cargo nextest run <test_name> # with nextest
cargo test <test_name> # with cargo test
cargo test <test_name>

# Run tests with output
cargo nextest run --nocapture # with nextest
cargo test -- --nocapture # with cargo test
cargo test -- -nocapture
```

**Note**: Always check if `cargo nextest` is available first (with `cargo nextest --version` or `which cargo-nextest`). If available, use it instead of `cargo test` as it provides faster and more reliable test execution.

### Running the Application

```bash
Expand Down Expand Up @@ -99,7 +94,7 @@ The core functionality for running benchmarks:

The project uses:

- `cargo nextest` (preferred) or standard Rust `cargo test`
- `cargo test`
- `insta` for snapshot testing
- `rstest` for parameterized tests
- `temp-env` for environment variable testing
Expand All @@ -108,5 +103,4 @@ Test files include snapshots in `snapshots/` directories for various run environ

**Important**:

- Always prefer `cargo nextest run` over `cargo test` when running tests, as it provides better performance and reliability.
- Some walltime executor tests require `sudo` access and will fail in non-interactive environments (e.g., `test_walltime_executor::*`). These failures are expected if sudo is not available.
- Some tests require `sudo` access. They are skipped by default unless the `GITHUB_ACTIONS` env var is set.
4 changes: 4 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,7 @@ This ensures only stable runner releases are marked as "latest" in GitHub.
## Known issue

- If one of the crates is currenlty in beta version, for example the runner is in beta version 4.4.2-beta.1, any alpha release will fail for the any crate, saying that only minor, major or patch releases is supported.

## Testing

- Some tests require `sudo` access. They are skipped by default unless the `GITHUB_ACTIONS` env var is set.
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ default-run = "codspeed"
name = "codspeed"
path = "src/main.rs"

[[bin]]
name = "compare_walltime_output"
path = "src/bin/compare_walltime_output.rs"


[dependencies]
anyhow = { workspace = true }
Expand Down
6 changes: 6 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
fn main() {
// Force a rebuild of the test target to be able to run the full test suite locally just by
// setting GITHUB_ACTIONS=1 in the environment.
// This is because `test_with` is evaluated at build time
println!("cargo::rerun-if-env-changed=GITHUB_ACTIONS");
}
5 changes: 5 additions & 0 deletions crates/memtrack/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ use std::{env, path::PathBuf};

#[cfg(feature = "ebpf")]
fn build_ebpf() {
// Force a rebuild of the test target to be able to run the full test suite locally just by
// setting GITHUB_ACTIONS=1 in the environment.
// This is because `test_with` is evaluated at build time
println!("cargo::rerun-if-env-changed=GITHUB_ACTIONS");

use libbpf_cargo::SkeletonBuilder;

println!("cargo:rerun-if-changed=src/ebpf/c");
Expand Down
7 changes: 7 additions & 0 deletions crates/runner-shared/src/debug_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ impl std::fmt::Debug for DebugInfo {
}
}

/// Per-pid mounting info referencing a deduplicated debug info entry.
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct DebugInfoPidMapping {
pub debug_info_key: String,
pub load_bias: u64,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ModuleDebugInfo {
/// The path to the object file on disk (e.g. `/usr/lib/libc.so.6`)
Expand Down
1 change: 1 addition & 0 deletions crates/runner-shared/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ pub mod debug_info;
pub mod fifo;
pub mod metadata;
pub mod perf_event;
pub mod perf_map;
pub mod unwind_data;
pub mod walltime_results;
34 changes: 30 additions & 4 deletions crates/runner-shared/src/metadata.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
use anyhow::Context;
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use std::io::BufWriter;
use std::path::Path;
use std::path::PathBuf;

use crate::debug_info::ModuleDebugInfo;
use crate::debug_info::{DebugInfoPidMapping, ModuleDebugInfo};
use crate::fifo::MarkerType;
use crate::perf_map::SymbolPidMapping;
use crate::unwind_data::UnwindDataPidMapping;

#[derive(Serialize, Deserialize)]
pub struct PerfMetadata {
Expand All @@ -25,9 +29,31 @@ pub struct PerfMetadata {
#[deprecated(note = "Use ExecutionTimestamps in the 'artifacts' module instead")]
pub markers: Vec<MarkerType>,

/// Debug info for all modules across all processes, mapping PID to module debug info
#[serde(default, skip_serializing_if = "std::collections::HashMap::is_empty")]
pub debug_info_by_pid: std::collections::HashMap<i32, Vec<ModuleDebugInfo>>,
/// Kept for backward compatibility, was used before deduplication of debug info entries.
#[serde(default, skip_serializing_if = "HashMap::is_empty")]
#[deprecated(note = "Use 'debug_info' + 'debug_info_pid_mappings_by_pid' instead")]
pub debug_info_by_pid: HashMap<i32, Vec<ModuleDebugInfo>>,

/// Deduplicated debug info entries, keyed by semantic key
#[serde(default, skip_serializing_if = "HashMap::is_empty")]
pub debug_info: HashMap<String, ModuleDebugInfo>,

/// Per-pid debug info references, mapping PID to list of debug info index + load bias
#[serde(default, skip_serializing_if = "HashMap::is_empty")]
pub debug_info_pid_mappings_by_pid: HashMap<i32, Vec<DebugInfoPidMapping>>,

/// Per-pid unwind data references, mapping PID to list of unwind data index + mounting info
#[serde(default, skip_serializing_if = "HashMap::is_empty")]
pub unwind_data_pid_mappings_by_pid: HashMap<i32, Vec<UnwindDataPidMapping>>,

/// Per-pid symbol references, mapping PID to list of perf map index + load bias
#[serde(default, skip_serializing_if = "HashMap::is_empty")]
pub symbol_pid_mappings_by_pid: HashMap<i32, Vec<SymbolPidMapping>>,

/// Mapping from semantic key to original binary path
/// Kept for traceability, and if we ever need to reconstruct the original paths from the keys
#[serde(default, skip_serializing_if = "HashMap::is_empty")]
pub key_to_path: HashMap<String, PathBuf>,
}

impl PerfMetadata {
Expand Down
11 changes: 11 additions & 0 deletions crates/runner-shared/src/perf_map.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
use serde::{Deserialize, Serialize};

/// File suffix used when registering module symbols in a PID agnostic way.
pub const SYMBOLS_MAP_SUFFIX: &str = "symbols.map";

/// Per-pid mounting info referencing a deduplicated perf map entry.
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct SymbolPidMapping {
pub perf_map_key: String,
pub load_bias: u64,
}
Loading