Skip to content

Commit 664c010

Browse files
committed
feat: add runner-shared crate
1 parent e7fa404 commit 664c010

File tree

11 files changed

+119
-154
lines changed

11 files changed

+119
-154
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,9 @@ object = "0.36.7"
5353
linux-perf-data = "0.11.0"
5454
debugid = "0.8.0"
5555
memmap2 = "0.9.5"
56-
nix = { version = "0.29.0", features = ["fs", "user"] }
56+
nix = { version = "0.29.0", features = ["fs", "time", "user"] }
5757
futures = "0.3.31"
58+
runner-shared = { path = "crates/runner-shared" }
5859

5960
[target.'cfg(target_os = "linux")'.dependencies]
6061
procfs = "0.17.0"
@@ -67,6 +68,9 @@ rstest = { version = "0.25.0", default-features = false }
6768
rstest_reuse = "0.7.0"
6869
shell-quote = "0.7.2"
6970

71+
[workspace]
72+
members = ["crates/runner-shared"]
73+
7074
[workspace.metadata.release]
7175
sign-tag = true
7276
sign-commit = true

crates/runner-shared/Cargo.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[package]
2+
name = "runner-shared"
3+
version = "0.1.0"
4+
edition = "2024"
5+
6+
[dependencies]
7+
anyhow = "1.0.100"
8+
serde = { version = "1.0.225", features = ["derive"] }
9+
serde_json = "1.0.145"

crates/runner-shared/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
pub mod fifo;
2+
pub mod metadata;
3+
pub mod unwind_data;
File renamed without changes.
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
use core::{
2+
fmt::Debug,
3+
hash::{Hash, Hasher},
4+
};
5+
use serde::{Deserialize, Serialize};
6+
use std::{hash::DefaultHasher, ops::Range};
7+
8+
/// Unwind data for a single module.
9+
#[derive(Serialize, Deserialize)]
10+
pub struct UnwindData {
11+
pub path: String,
12+
13+
pub avma_range: Range<u64>,
14+
pub base_avma: u64,
15+
16+
pub eh_frame_hdr: Vec<u8>,
17+
pub eh_frame_hdr_svma: Range<u64>,
18+
19+
pub eh_frame: Vec<u8>,
20+
pub eh_frame_svma: Range<u64>,
21+
}
22+
23+
impl Debug for UnwindData {
24+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
25+
let eh_frame_hdr_hash = {
26+
let mut hasher = DefaultHasher::new();
27+
self.eh_frame_hdr.hash(&mut hasher);
28+
hasher.finish()
29+
};
30+
let eh_frame_hash = {
31+
let mut hasher = DefaultHasher::new();
32+
self.eh_frame.hash(&mut hasher);
33+
hasher.finish()
34+
};
35+
36+
f.debug_struct("UnwindData")
37+
.field("path", &self.path)
38+
.field("avma_range", &format_args!("{:x?}", self.avma_range))
39+
.field("base_avma", &format_args!("{:x}", self.base_avma))
40+
.field(
41+
"eh_frame_hdr_svma",
42+
&format_args!("{:x?}", self.eh_frame_hdr_svma),
43+
)
44+
.field("eh_frame_hdr_hash", &format_args!("{eh_frame_hdr_hash:x}"))
45+
.field("eh_frame_hash", &format_args!("{eh_frame_hash:x}"))
46+
.field("eh_frame_svma", &format_args!("{:x?}", self.eh_frame_svma))
47+
.finish()
48+
}
49+
}

src/run/runner/wall_time/perf/fifo.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
use super::{FifoCommand, RUNNER_ACK_FIFO, RUNNER_CTL_FIFO};
1+
use super::FifoCommand;
2+
use runner_shared::fifo::{RUNNER_ACK_FIFO, RUNNER_CTL_FIFO};
23
use std::path::PathBuf;
34
use tokio::io::{AsyncReadExt, AsyncWriteExt};
45
use tokio::net::unix::pipe::OpenOptions as TokioPipeOpenOptions;

src/run/runner/wall_time/perf/helpers.rs

Lines changed: 0 additions & 71 deletions
This file was deleted.

src/run/runner/wall_time/perf/jit_dump.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@ use crate::{
22
prelude::*,
33
run::runner::wall_time::perf::{
44
perf_map::{ModuleSymbols, Symbol},
5-
unwind_data::UnwindData,
5+
unwind_data::UnwindDataExt,
66
},
77
};
88
use linux_perf_data::jitdump::{JitDumpReader, JitDumpRecord};
9+
use runner_shared::unwind_data::UnwindData;
910
use std::{
1011
collections::HashSet,
1112
path::{Path, PathBuf},

src/run/runner/wall_time/perf/shared.rs

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)