From 315b2880145234181fd5377dbfef0fb282abdcec Mon Sep 17 00:00:00 2001 From: "Y. T. Chung" Date: Sat, 3 Oct 2015 13:47:42 +0800 Subject: [PATCH] prints running coroutines --- src/bin/local.rs | 9 +++++++++ src/bin/server.rs | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/src/bin/local.rs b/src/bin/local.rs index 246e19c8..d4dbfcec 100644 --- a/src/bin/local.rs +++ b/src/bin/local.rs @@ -177,6 +177,15 @@ fn main() { .ok().expect("`threads` should be an integer"); Scheduler::new().with_workers(threads).run(move|| { + if matches.occurrences_of("VERBOSE") >= 1 { + Scheduler::spawn(move|| { + loop { + coio::sleep_ms(1000); + debug!("Running coroutines: {}", Scheduler::instance().work_count()); + } + }); + } + RelayLocal::new(config).run(); }).unwrap(); } diff --git a/src/bin/server.rs b/src/bin/server.rs index 741e6d37..393cc8e5 100644 --- a/src/bin/server.rs +++ b/src/bin/server.rs @@ -171,6 +171,15 @@ fn main() { .ok().expect("`threads` should be an integer"); Scheduler::new().with_workers(threads).run(move|| { + if matches.occurrences_of("VERBOSE") >= 1 { + Scheduler::spawn(move|| { + loop { + coio::sleep_ms(1000); + debug!("Running coroutines: {}", Scheduler::instance().work_count()); + } + }); + } + RelayServer::new(config).run(); }).unwrap(); }