Skip to content

Commit 407e945

Browse files
committed
feat(examples): add rftrace-example
Signed-off-by: Martin Kröning <[email protected]>
1 parent 1b3bd23 commit 407e945

File tree

4 files changed

+51
-1
lines changed

4 files changed

+51
-1
lines changed

.github/workflows/ci.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,11 @@ jobs:
1717
- uses: actions/checkout@v4
1818
with:
1919
submodules: true
20+
- uses: dtolnay/rust-toolchain@nightly
21+
with:
22+
components: rust-src
2023
- uses: mkroening/rust-toolchain-toml@main
21-
- run: rustup component add clippy
24+
- run: rustup component add clippy llvm-tools
2225
- name: Clippy
2326
run: |
2427
cargo clippy --all-targets
@@ -43,7 +46,11 @@ jobs:
4346
- uses: actions/checkout@v4
4447
with:
4548
submodules: true
49+
- uses: dtolnay/rust-toolchain@nightly
50+
with:
51+
components: rust-src
4652
- uses: mkroening/rust-toolchain-toml@main
53+
- run: rustup component add llvm-tools
4754
- name: Check docs
4855
run: cargo doc --no-deps --document-private-items
4956

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ members = [
1111
"examples/miotcp",
1212
"examples/mioudp",
1313
"examples/polling",
14+
"examples/rftrace-example",
1415
"examples/testtcp",
1516
"examples/testudp",
1617
"examples/tls",

examples/rftrace-example/Cargo.toml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[package]
2+
name = "rftrace-example"
3+
version = "0.1.0"
4+
authors = ["Martin Kröning <[email protected]>"]
5+
edition = "2021"
6+
publish = false
7+
8+
[dependencies]
9+
rftrace = "0.2"
10+
rftrace-frontend = "0.2"
11+
12+
[target.'cfg(target_os = "hermit")'.dependencies]
13+
hermit = { path = "../../hermit" }
14+
15+
[features]
16+
instrument-kernel = ["hermit/instrument"]

examples/rftrace-example/src/main.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#[cfg(target_os = "hermit")]
2+
use hermit as _;
3+
4+
extern crate rftrace as _;
5+
use rftrace_frontend as rftrace;
6+
7+
fn main() {
8+
let events = rftrace::init(2000, false);
9+
rftrace::enable();
10+
f1();
11+
// Uhyve mounts at `/host`, virtiofsd mounts to `/root`
12+
rftrace::dump_full_uftrace(events, "/root/tracedir", "rftrace-example").unwrap();
13+
}
14+
15+
#[inline(never)]
16+
fn f1() {
17+
f2();
18+
}
19+
20+
#[inline(never)]
21+
fn f2() {
22+
f3();
23+
}
24+
25+
#[inline(never)]
26+
fn f3() {}

0 commit comments

Comments
 (0)