-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PoC for SystemTap semaphores - using asm_sym
- Loading branch information
1 parent
8520232
commit 5fb1ec0
Showing
3 changed files
with
21 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,16 @@ | ||
#![feature(asm_sym)] | ||
|
||
use probe::probe; | ||
|
||
fn main() { | ||
probe!(foo, begin); | ||
let mut total = 0; | ||
for i in 0..100 { | ||
total += i; | ||
probe!(foo, loop, i, total); | ||
let mut iter = 0; | ||
loop { | ||
iter += 1; | ||
probe!(foo, iter, { | ||
std::thread::sleep(std::time::Duration::from_secs(1)); | ||
iter | ||
}); | ||
} | ||
assert_eq!(total, 4950); | ||
probe!(foo, end); | ||
} | ||
|
||
// bcc/tools/trace.py -p $(pidof loop) 'u::foo:iter "iter = %d", arg1' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,6 +79,7 @@ | |
//! ``` | ||
|
||
#![no_std] | ||
#![feature(asm_sym)] | ||
|
||
mod platform; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters