-
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.
Merge pull request #17 from nbaksalyar/sdt-semaphores
Support conditional SystemTap probes using semaphores
- Loading branch information
Showing
6 changed files
with
39 additions
and
15 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
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
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
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
use probe::probe; | ||
|
||
fn main() { | ||
let mut iter = 0; | ||
loop { | ||
iter += 1; | ||
probe!(foo, iter, { | ||
// This delay is an exaggeration of the overhead of a probe argument, but it's only | ||
// incurred while something is attached to the probe, thanks to the semaphore. | ||
std::thread::sleep(std::time::Duration::from_secs(1)); | ||
iter | ||
}); | ||
} | ||
} | ||
|
||
// bcc/tools/trace.py -p $(pidof semaphore) '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 |
---|---|---|
@@ -1,5 +1,10 @@ | ||
#[doc(hidden)] | ||
#[macro_export] | ||
macro_rules! platform_probe( | ||
($provider:ident, $name:ident, $($arg:expr,)*) => () | ||
($provider:ident, $name:ident, $($arg:expr,)*) => ({ | ||
// Expand the arguments so they don't cause unused warnings. | ||
if false { | ||
let _ = ($($arg,)*); | ||
} | ||
}) | ||
); |
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