-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9f59c16
commit 84579da
Showing
3 changed files
with
54 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#![feature(test)] | ||
|
||
extern crate test; | ||
|
||
use kill_tree::{get_available_max_process_id, Config}; | ||
use test::Bencher; | ||
|
||
#[bench] | ||
fn kill_tree(b: &mut Bencher) { | ||
b.iter(|| { | ||
let target_process_id = get_available_max_process_id(); | ||
kill_tree::blocking::kill_tree(target_process_id).unwrap(); | ||
}); | ||
} | ||
|
||
#[bench] | ||
fn kill_tree_with_sigkill(b: &mut Bencher) { | ||
b.iter(|| { | ||
let target_process_id = get_available_max_process_id(); | ||
let config = Config { | ||
signal: String::from("SIGKILL"), | ||
..Default::default() | ||
}; | ||
kill_tree::blocking::kill_tree_with_config(target_process_id, &config).unwrap(); | ||
}); | ||
} | ||
|
||
#[bench] | ||
fn kill_tree_exclude_target(b: &mut Bencher) { | ||
b.iter(|| { | ||
let target_process_id = get_available_max_process_id(); | ||
let config = Config { | ||
include_target: false, | ||
..Default::default() | ||
}; | ||
kill_tree::blocking::kill_tree_with_config(target_process_id, &config).unwrap(); | ||
}); | ||
} |
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