Skip to content

Commit

Permalink
feat(examples): add rftrace-example
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Kröning <[email protected]>
  • Loading branch information
mkroening committed Mar 27, 2024
1 parent 1b3bd23 commit 407e945
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 1 deletion.
9 changes: 8 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: true
- uses: dtolnay/rust-toolchain@nightly
with:
components: rust-src
- uses: mkroening/rust-toolchain-toml@main
- run: rustup component add clippy
- run: rustup component add clippy llvm-tools
- name: Clippy
run: |
cargo clippy --all-targets
Expand All @@ -43,7 +46,11 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: true
- uses: dtolnay/rust-toolchain@nightly
with:
components: rust-src
- uses: mkroening/rust-toolchain-toml@main
- run: rustup component add llvm-tools
- name: Check docs
run: cargo doc --no-deps --document-private-items

Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ members = [
"examples/miotcp",
"examples/mioudp",
"examples/polling",
"examples/rftrace-example",
"examples/testtcp",
"examples/testudp",
"examples/tls",
Expand Down
16 changes: 16 additions & 0 deletions examples/rftrace-example/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[package]
name = "rftrace-example"
version = "0.1.0"
authors = ["Martin Kröning <[email protected]>"]
edition = "2021"
publish = false

[dependencies]
rftrace = "0.2"
rftrace-frontend = "0.2"

[target.'cfg(target_os = "hermit")'.dependencies]
hermit = { path = "../../hermit" }

[features]
instrument-kernel = ["hermit/instrument"]
26 changes: 26 additions & 0 deletions examples/rftrace-example/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#[cfg(target_os = "hermit")]
use hermit as _;

extern crate rftrace as _;
use rftrace_frontend as rftrace;

fn main() {
let events = rftrace::init(2000, false);
rftrace::enable();
f1();
// Uhyve mounts at `/host`, virtiofsd mounts to `/root`
rftrace::dump_full_uftrace(events, "/root/tracedir", "rftrace-example").unwrap();
}

#[inline(never)]
fn f1() {
f2();
}

#[inline(never)]
fn f2() {
f3();
}

#[inline(never)]
fn f3() {}

0 comments on commit 407e945

Please sign in to comment.