Skip to main content

scx_pandemonium/cli/
mod.rs

1pub mod bench;
2pub mod check;
3pub mod child_guard;
4pub mod death_pipe;
5pub mod probe;
6pub mod report;
7pub mod run;
8pub mod stress;
9pub mod test_gate;
10pub const TARGET_DIR: &str = "/tmp/pandemonium-build";
11pub const LOG_DIR: &str = "/tmp/pandemonium";
12
13pub fn binary_path() -> String {
14    format!("{}/release/pandemonium", TARGET_DIR)
15}
16
17pub fn self_exe() -> std::path::PathBuf {
18    std::env::current_exe().unwrap_or_else(|_| std::path::PathBuf::from(binary_path()))
19}
20
21pub fn is_scx_active() -> bool {
22    std::fs::read_to_string("/sys/kernel/sched_ext/root/ops")
23        .map(|s| !s.trim().is_empty())
24        .unwrap_or(false)
25}
26
27pub fn wait_for_activation(timeout_secs: u64) -> bool {
28    let start = std::time::Instant::now();
29    while start.elapsed().as_secs() < timeout_secs {
30        if is_scx_active() {
31            return true;
32        }
33        std::thread::sleep(std::time::Duration::from_millis(100));
34    }
35    false
36}