From 8413277847489d313ab2b68be011656270aebf59 Mon Sep 17 00:00:00 2001 From: Hayodea Hakol Date: Tue, 9 Sep 2025 12:02:03 -0400 Subject: [PATCH] Verbose: Print these messages only in verbose mode --- smocore/componentThread.cpp | 14 ++++++++++++-- smocore/mind.cpp | 10 +++++++--- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/smocore/componentThread.cpp b/smocore/componentThread.cpp index 3fb3b4b..081bdcf 100644 --- a/smocore/componentThread.cpp +++ b/smocore/componentThread.cpp @@ -3,6 +3,7 @@ #include #include #include +#include #include #include #include @@ -39,7 +40,13 @@ const std::shared_ptr ComponentThread::getSelf(void) void ComponentThread::main(ComponentThread& self) { - std::cout << self.name << ":" << __func__ << ": Waiting for JOLT" <<"\n"; + + if (OptionParser::getOptions().verbose) + { + std::cout << self.name << ":" << __func__ << ": Waiting for JOLT" + <<"\n"; + } + self.getIoService().run(); self.initializeTls(); @@ -304,7 +311,10 @@ void ComponentThread::pinToCpu(int cpuId) } pinnedCpuId = cpuId; - std::cout << name << ": Pinned to CPU " << cpuId << "\n"; + if (OptionParser::getOptions().verbose) + { + std::cout << name << ": Pinned to CPU " << cpuId << "\n"; + } } } // namespace smo diff --git a/smocore/mind.cpp b/smocore/mind.cpp index d14a4e4..fbb2a99 100644 --- a/smocore/mind.cpp +++ b/smocore/mind.cpp @@ -1,4 +1,5 @@ #include +#include #include #include @@ -143,7 +144,10 @@ Mind::getMindThreads() const void Mind::distributeAndPinThreadsAcrossCpus() { int cpuCount = ComponentThread::getAvailableCpuCount(); - std::cout << "Available CPUs: " << cpuCount << "\n"; + + if (OptionParser::getOptions().verbose) { + std::cout << __func__ << ": Available CPUs: " << cpuCount << "\n"; + } // Distribute and pin threads across CPUs int threadIndex = 0; @@ -154,8 +158,8 @@ void Mind::distributeAndPinThreadsAcrossCpus() ++threadIndex; } - std::cout << "Distributed " << threadIndex << " threads across " - << cpuCount << " CPUs\n"; + std::cout << __func__ << ": Distributed " << threadIndex << " threads " + << "across " << cpuCount << " CPUs\n"; } // Thread management methods (moved from ComponentThread)