Skip to content

Commit 42bf300

Browse files
authored
feat: improve the result table display (#217)
1 parent eaa4115 commit 42bf300

12 files changed

Lines changed: 584 additions & 158 deletions

AGENTS.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ CodSpeed Runner is a Rust CLI application for gathering performance data and upl
99
## Common Development Commands
1010

1111
### Building and Testing
12+
1213
```bash
1314
# Build the project
1415
cargo build
@@ -32,6 +33,7 @@ cargo test -- --nocapture # with cargo test
3233
**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.
3334

3435
### Running the Application
36+
3537
```bash
3638
# Build and run
3739
cargo run -- <subcommand> <args>
@@ -43,6 +45,7 @@ cargo run -- setup
4345
```
4446

4547
### Code Quality
48+
4649
```bash
4750
# Check code without building
4851
cargo check
@@ -59,26 +62,31 @@ cargo clippy
5962
The application follows a modular structure:
6063

6164
### Core Modules
65+
6266
- **`main.rs`**: Entry point with error handling and logging setup
6367
- **`app.rs`**: CLI definition using clap with subcommands (Run, Auth, Setup)
6468
- **`api_client.rs`**: CodSpeed GraphQL API client
6569
- **`auth.rs`**: Authentication management
6670
- **`config.rs`**: Configuration loading and management
6771

6872
### Run Module (`src/run/`)
73+
6974
The core functionality for running benchmarks:
75+
7076
- **`run_environment/`**: CI provider implementations (GitHub Actions, GitLab CI, Buildkite, local)
7177
- **`runner/`**: Execution modes:
7278
- **`valgrind/`**: Instrumentation mode using custom Valgrind
7379
- **`wall_time/perf/`**: Walltime mode with perf integration
7480
- **`uploader/`**: Results upload to CodSpeed
7581

7682
### Key Dependencies
83+
7784
- `clap`: CLI framework with derive macros
7885
- `tokio`: Async runtime (current_thread flavor)
7986
- `reqwest`: HTTP client with middleware/retry
8087
- `serde`/`serde_json`: Serialization
8188
- `gql_client`: Custom GraphQL client
89+
- `tabled`: Table formatting for CLI output (https://docs.rs/tabled/latest/tabled/index.html)
8290
- Platform-specific: `procfs` (Linux), `linux-perf-data`
8391

8492
## Environment Variables
@@ -90,6 +98,7 @@ The core functionality for running benchmarks:
9098
## Testing
9199

92100
The project uses:
101+
93102
- `cargo nextest` (preferred) or standard Rust `cargo test`
94103
- `insta` for snapshot testing
95104
- `rstest` for parameterized tests
@@ -98,5 +107,6 @@ The project uses:
98107
Test files include snapshots in `snapshots/` directories for various run environment providers.
99108

100109
**Important**:
110+
101111
- Always prefer `cargo nextest run` over `cargo test` when running tests, as it provides better performance and reliability.
102112
- 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.

CLAUDE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
AGENTS.md

Cargo.lock

Lines changed: 59 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,17 +69,17 @@ shellexpand = { version = "3.1.1", features = ["tilde"] }
6969
addr2line = "0.25"
7070
gimli = "0.32"
7171
open = "5.3.2"
72-
tabled = "0.17"
72+
tabled = { version = "0.20.0", features = ["ansi"] }
7373
shell-words = "1.1.0"
7474
rmp-serde = "1.3.0"
75-
test-log = "0.2.19"
7675

7776
[target.'cfg(target_os = "linux")'.dependencies]
7877
procfs = "0.17.0"
7978

8079
[dev-dependencies]
8180
temp-env = { version = "0.3.6", features = ["async_closure"] }
8281
insta = { version = "1.29.0", features = ["json", "redactions"] }
82+
test-log = "0.2.19"
8383
test-with = { version = "0.15", default-features = false, features = [] }
8484
rstest = { version = "0.25.0", default-features = false }
8585
rstest_reuse = "0.7.0"

src/api_client.rs

Lines changed: 38 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -110,16 +110,6 @@ impl Display for ReportConclusion {
110110
}
111111
}
112112

113-
#[derive(Debug, Deserialize, Serialize)]
114-
#[serde(rename_all = "camelCase")]
115-
pub struct FetchLocalRunReportRun {
116-
pub id: String,
117-
pub status: RunStatus,
118-
pub url: String,
119-
pub head_reports: Vec<FetchLocalRunReportHeadReport>,
120-
pub results: Vec<FetchLocalRunBenchmarkResult>,
121-
}
122-
123113
#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
124114
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
125115
pub enum RunStatus {
@@ -129,24 +119,44 @@ pub enum RunStatus {
129119
Processing,
130120
}
131121

132-
#[derive(Debug, Deserialize, Serialize)]
133-
#[serde(rename_all = "camelCase")]
134-
pub struct FetchLocalRunReportHeadReport {
135-
pub id: String,
136-
pub impact: Option<f64>,
137-
pub conclusion: ReportConclusion,
138-
}
139-
140-
#[derive(Debug, Deserialize, Serialize)]
141-
pub struct FetchLocalRunBenchmarkResult {
142-
pub value: f64,
143-
pub benchmark: FetchLocalRunBenchmark,
144-
}
145-
146-
#[derive(Debug, Deserialize, Serialize)]
147-
pub struct FetchLocalRunBenchmark {
148-
pub name: String,
149-
pub executor: ExecutorName,
122+
nest! {
123+
#[derive(Debug, Deserialize, Serialize)]*
124+
#[serde(rename_all = "camelCase")]*
125+
pub struct FetchLocalRunReportRun {
126+
pub id: String,
127+
pub status: RunStatus,
128+
pub url: String,
129+
pub head_reports: Vec<pub struct FetchLocalRunReportHeadReport {
130+
pub id: String,
131+
pub impact: Option<f64>,
132+
pub conclusion: ReportConclusion,
133+
}>,
134+
pub results: Vec<pub struct FetchLocalRunBenchmarkResult {
135+
pub value: f64,
136+
pub benchmark: pub struct FetchLocalRunBenchmark {
137+
pub name: String,
138+
pub executor: ExecutorName,
139+
},
140+
pub valgrind: Option<pub struct ValgrindResult {
141+
pub time_distribution: Option<pub struct TimeDistribution {
142+
pub ir: f64,
143+
pub l1m: f64,
144+
pub llm: f64,
145+
pub sys: f64,
146+
}>,
147+
}>,
148+
pub walltime: Option<pub struct WallTimeResult {
149+
pub iterations: f64,
150+
pub stdev: f64,
151+
pub total_time: f64,
152+
}>,
153+
pub memory: Option<pub struct MemoryResult {
154+
pub peak_memory: i64,
155+
pub total_allocated: i64,
156+
pub alloc_calls: i64,
157+
}>,
158+
}>,
159+
}
150160
}
151161

152162
nest! {

src/exec/poll_results.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use crate::api_client::{
55
CodSpeedAPIClient, FetchLocalRunReportResponse, FetchLocalRunReportVars, RunStatus,
66
};
77
use crate::prelude::*;
8-
use crate::run::helpers::poll_results::{
8+
use crate::run::helpers::benchmark_display::{
99
POLLING_INTERVAL, RUN_PROCESSING_MAX_DURATION, build_benchmark_table, build_detailed_summary,
1010
};
1111
use crate::run::uploader::UploadResult;
@@ -62,7 +62,7 @@ pub async fn poll_results(
6262
}
6363

6464
info!(
65-
"\nTo see the full report, visit: {}",
65+
"\nFull report: {}",
6666
style(response.run.url).blue().bold().underlined()
6767
);
6868
}

src/queries/FetchLocalRunReport.gql

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,29 @@ query FetchLocalRunReport($owner: String!, $name: String!, $runId: String!) {
1313
conclusion
1414
}
1515
results {
16-
value
1716
benchmark {
1817
name
1918
executor
2019
}
20+
value
21+
valgrind {
22+
timeDistribution {
23+
ir
24+
l1m
25+
llm
26+
sys
27+
}
28+
}
29+
walltime {
30+
iterations
31+
stdev
32+
totalTime
33+
}
34+
memory {
35+
peakMemory
36+
totalAllocated
37+
allocCalls
38+
}
2139
}
2240
}
2341
}

0 commit comments

Comments
 (0)