scx_rlfifo: print a performance warning banner

scx_rlfifo is provided as a simple example to show how to use
scx_rustland_core and it's not supposed to be used in a real production
environment.

To prevent performance bug reports print an explicit warning when it's
started to clarify the goal of this scheduler.

Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
This commit is contained in:
Andrea Righi 2024-03-05 18:52:21 +01:00
parent fe19754132
commit be5e51dfaa

View File

@ -98,11 +98,32 @@ impl<'a> Scheduler<'a> {
}
}
fn print_warning() {
let warning = r#"
**************************************************************************
WARNING: The purpose of scx_rlfifo is to provide a simple scheduler
implementation based on scx_rustland_core, and it is not intended for
use in production environments. If you want to run a scheduler that makes
decisions in user space, it is recommended to use *scx_rustland* instead.
Please do not open GitHub issues in the event of poor performance, or
scheduler eviction due to a runnable task timeout. However, if running this
scheduler results in a system crash or the entire system becoming unresponsive,
please open a GitHub issue.
**************************************************************************"#;
println!("{}", warning);
}
fn main() -> Result<()> {
let mut sched = Scheduler::init()?;
let shutdown = Arc::new(AtomicBool::new(false));
let shutdown_clone = shutdown.clone();
print_warning();
ctrlc::set_handler(move || {
shutdown_clone.store(true, Ordering::Relaxed);
})?;