rush_sync_server/commands/performance/
command.rs

1use crate::commands::command::Command;
2use crate::core::prelude::*;
3
4#[derive(Debug)]
5pub struct PerformanceCommand;
6
7impl Command for PerformanceCommand {
8    fn name(&self) -> &'static str {
9        "performance"
10    }
11
12    fn description(&self) -> &'static str {
13        "Show performance statistics and current config values"
14    }
15
16    fn matches(&self, command: &str) -> bool {
17        let cmd = command.trim().to_lowercase();
18        cmd == "perf" || cmd == "performance" || cmd == "stats" || cmd.starts_with("perf ")
19    }
20
21    fn execute_sync(&self, args: &[&str]) -> Result<String> {
22        match args.first() {
23            Some(&"--help" | &"-h") => Ok("Performance Command Help:\n  perf                   Show performance status\n  performance           Same as perf\n  stats                 Same as perf\n  perf -h               Show this help".to_string()),
24            None => super::manager::PerformanceManager::get_status(),
25            _ => Ok("Unknown performance parameter. Use 'perf -h' for help.".to_string()),
26        }
27    }
28
29    fn priority(&self) -> u8 {
30        25
31    }
32}