From 8053febeffdd870902615e4470c08112820f3bc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20Jos=C3=A9=20Pereira?= Date: Wed, 29 Nov 2023 21:25:53 -0300 Subject: [PATCH] Add thread counter option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Patrick José Pereira --- src/cli/manager.rs | 13 +++++++++++++ src/main.rs | 4 ++++ 2 files changed, 17 insertions(+) diff --git a/src/cli/manager.rs b/src/cli/manager.rs index 22808f70..c2fe5cb8 100644 --- a/src/cli/manager.rs +++ b/src/cli/manager.rs @@ -90,6 +90,13 @@ pub fn default_settings() -> Option<&'static str> { return MANAGER.as_ref().clap_matches.value_of("default-settings"); } +pub fn enable_thread_counter() -> bool { + return MANAGER + .as_ref() + .clap_matches + .is_present("enable-thread-counter"); +} + // Return the command line used to start this application pub fn command_line_string() -> String { std::env::args().collect::>().join(" ") @@ -217,6 +224,12 @@ fn get_clap_matches<'a>() -> clap::ArgMatches<'a> { .long("enable-tracy") .help("Turns on the Tracy tool integration. Learn more: https://github.com/wolfpld/tracy") .takes_value(false), + ) + .arg( + clap::Arg::with_name("enable-thread-counter") + .long("enable-thread-counter") + .help("Enable a thread that prints the number of children processes.") + .takes_value(false), ); matches.get_matches() diff --git a/src/main.rs b/src/main.rs index 227cd4b3..030e1b61 100644 --- a/src/main.rs +++ b/src/main.rs @@ -34,6 +34,10 @@ async fn main() -> Result<(), std::io::Error> { settings::manager::set_mavlink_endpoint(endpoint); } + if cli::manager::enable_thread_counter() { + helper::threads::start_thread_counter_thread(); + } + stream::webrtc::signalling_server::SignallingServer::default(); if let Err(error) = stream::manager::start_default() {