diff --git a/src/libraries/JANA/CLI/JSignalHandler.cc b/src/libraries/JANA/CLI/JSignalHandler.cc index d1a3b4df9..2ef87f4d8 100644 --- a/src/libraries/JANA/CLI/JSignalHandler.cc +++ b/src/libraries/JANA/CLI/JSignalHandler.cc @@ -8,6 +8,7 @@ #include #include +#include #include /// JSignalHandler bundles together the logic for querying a JApplication diff --git a/src/libraries/JANA/Engine/JExecutionEngine.cc b/src/libraries/JANA/Engine/JExecutionEngine.cc index 1879accfd..ddf59f6de 100644 --- a/src/libraries/JANA/Engine/JExecutionEngine.cc +++ b/src/libraries/JANA/Engine/JExecutionEngine.cc @@ -13,6 +13,7 @@ #include #include #include +#include thread_local int jana2_worker_id = -1; thread_local JBacktrace* jana2_worker_backtrace = nullptr; @@ -799,4 +800,14 @@ void JExecutionEngine::PrintWorkerReport(bool send_to_pipe) { } +std::string ToString(JExecutionEngine::RunStatus runstatus) { + switch(runstatus) { + case JExecutionEngine::RunStatus::Running: return "Running"; + case JExecutionEngine::RunStatus::Paused: return "Paused"; + case JExecutionEngine::RunStatus::Failed: return "Failed"; + case JExecutionEngine::RunStatus::Pausing: return "Pausing"; + case JExecutionEngine::RunStatus::Draining: return "Draining"; + case JExecutionEngine::RunStatus::Finished: return "Finished"; + } +} diff --git a/src/libraries/JANA/Engine/JExecutionEngine.h b/src/libraries/JANA/Engine/JExecutionEngine.h index 50845e6cf..ad6f6e163 100644 --- a/src/libraries/JANA/Engine/JExecutionEngine.h +++ b/src/libraries/JANA/Engine/JExecutionEngine.h @@ -168,5 +168,6 @@ class JExecutionEngine : public JService { }; +std::string ToString(JExecutionEngine::RunStatus status); diff --git a/src/libraries/JANA/JApplication.cc b/src/libraries/JANA/JApplication.cc index c0442a835..7fb9ae402 100644 --- a/src/libraries/JANA/JApplication.cc +++ b/src/libraries/JANA/JApplication.cc @@ -341,4 +341,14 @@ float JApplication::GetInstantaneousRate() return instantaneous_throughput; } +void JApplication::PrintStatus() { + auto perf = m_execution_engine->GetPerf(); + LOG_INFO(m_logger) << "Topology status: " << ToString(perf.runstatus) << LOG_END; + LOG_INFO(m_logger) << "Worker thread count: " << perf.thread_count << LOG_END; + LOG_INFO(m_logger) << "Events processed: " << perf.event_count << LOG_END; + LOG_INFO(m_logger) << "Uptime [s]: " << perf.uptime_ms*1000 << LOG_END; + LOG_INFO(m_logger) << "Throughput [Hz]: " << perf.throughput_hz << LOG_END; +} + + diff --git a/src/libraries/JANA/JApplicationFwd.h b/src/libraries/JANA/JApplicationFwd.h index f98d866fc..4770caf9f 100644 --- a/src/libraries/JANA/JApplicationFwd.h +++ b/src/libraries/JANA/JApplicationFwd.h @@ -26,7 +26,6 @@ class JApplication; extern JApplication* japp; #include -#include #include @@ -80,9 +79,8 @@ class JApplication { void SetExitCode(int exitCode); int GetExitCode(); - // Performance/status monitoring - + void PrintStatus(); bool IsInitialized(void){return m_initialized;} bool IsQuitting(void) { return m_quitting; } bool IsDrainingQueues(); diff --git a/src/libraries/JANA/Topology/JTopologyBuilder.h b/src/libraries/JANA/Topology/JTopologyBuilder.h index ce3f0676c..685efc09f 100644 --- a/src/libraries/JANA/Topology/JTopologyBuilder.h +++ b/src/libraries/JANA/Topology/JTopologyBuilder.h @@ -9,7 +9,6 @@ #include #include #include -#include // TODO: Should't be here #include #include @@ -18,8 +17,6 @@ class JParameterManager; class JComponentManager; class JArrow; -class JQueue; -class JQueue; class JFoldArrow; class JUnfoldArrow; @@ -44,7 +41,6 @@ class JTopologyBuilder : public JService { // Things that probably shouldn't be here std::function m_configure_topology; JEventPool* event_pool = nullptr; // TODO: Move into pools eventually - JPerfMetrics metrics; JProcessorMapping mapping; public: diff --git a/src/libraries/JANA/Utils/JBacktrace.cc b/src/libraries/JANA/Utils/JBacktrace.cc index 4d2368635..4c52dfc98 100644 --- a/src/libraries/JANA/Utils/JBacktrace.cc +++ b/src/libraries/JANA/Utils/JBacktrace.cc @@ -28,7 +28,7 @@ void JBacktrace::WaitForCapture() const { void JBacktrace::Capture(int frames_to_omit) { m_frame_count = backtrace(m_buffer, MAX_FRAMES); m_frames_to_omit = frames_to_omit; - m_ready.store(true, std::memory_order::release); + m_ready.store(true, std::memory_order_release); } void JBacktrace::Format(std::ostream& os) { diff --git a/src/plugins/janacontrol/JControlZMQ.cc b/src/plugins/janacontrol/JControlZMQ.cc index ba6a16d23..f370ec54d 100644 --- a/src/plugins/janacontrol/JControlZMQ.cc +++ b/src/plugins/janacontrol/JControlZMQ.cc @@ -258,7 +258,7 @@ void JControlZMQ::ServerLoop() ss << "OK"; }else if( vals[0]=="resume" ){ //------------------ resume - _japp->Resume(); + _japp->Run(false); ss << "OK"; }else if( vals[0]=="debug_mode" ){ //------------------ debug_mode diff --git a/src/python/common/janapy.h b/src/python/common/janapy.h index 233047bba..3b6154e4c 100644 --- a/src/python/common/janapy.h +++ b/src/python/common/janapy.h @@ -31,7 +31,6 @@ static JApplication *pyjapp = nullptr; inline void janapy_Start(void) { PY_INITIALIZED = true; } inline void janapy_Quit(bool skip_join=false) { pyjapp->Quit(skip_join); } inline void janapy_Stop(bool wait_until_idle=false) { pyjapp->Stop(wait_until_idle); } -inline void janapy_Resume(void) { pyjapp->Resume(); } inline bool janapy_IsInitialized(void) { return pyjapp->IsInitialized(); } inline bool janapy_IsQuitting(void) { return pyjapp->IsQuitting(); } @@ -135,7 +134,6 @@ m.def("Start", &janapy_Start, "Allow m.def("Run", &janapy_Run, "Begin processing events (use when running python as an extension)"); \ m.def("Quit", &janapy_Quit, "Tell JANA to quit gracefully", py::arg("skip_join")=false); \ m.def("Stop", &janapy_Stop, "Tell JANA to (temporarily) stop event processing. If optional agrument is True then block until all threads are stopped."); \ -m.def("Resume", &janapy_Resume, "Tell JANA to resume event processing."); \ \ m.def("IsInitialized", &janapy_IsInitialized, "Check if JApplication has already been initialized."); \ m.def("IsQuitting", &janapy_IsQuitting, "Check if JApplication is in the process of quitting."); \ diff --git a/src/python/modules/jana/jana_module.cc b/src/python/modules/jana/jana_module.cc index e2ec8e238..ac4d07842 100644 --- a/src/python/modules/jana/jana_module.cc +++ b/src/python/modules/jana/jana_module.cc @@ -5,6 +5,7 @@ #include #include #include +#include // Something to throw that makes a nicer error message class PYTHON_MODULE_STARTUP_FAILED{public: PYTHON_MODULE_STARTUP_FAILED(){}};