Skip to content

Commit

Permalink
Small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanwbrei committed Nov 19, 2024
1 parent e3eb07d commit 1d7214f
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 11 deletions.
1 change: 1 addition & 0 deletions src/libraries/JANA/CLI/JSignalHandler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <JANA/Engine/JExecutionEngine.h>
#include <JANA/Utils/JBacktrace.h>

#include <unistd.h>
#include <csignal>

/// JSignalHandler bundles together the logic for querying a JApplication
Expand Down
11 changes: 11 additions & 0 deletions src/libraries/JANA/Engine/JExecutionEngine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <sstream>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>

thread_local int jana2_worker_id = -1;
thread_local JBacktrace* jana2_worker_backtrace = nullptr;
Expand Down Expand Up @@ -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";
}
}

1 change: 1 addition & 0 deletions src/libraries/JANA/Engine/JExecutionEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,5 +168,6 @@ class JExecutionEngine : public JService {
};


std::string ToString(JExecutionEngine::RunStatus status);


10 changes: 10 additions & 0 deletions src/libraries/JANA/JApplication.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}



4 changes: 1 addition & 3 deletions src/libraries/JANA/JApplicationFwd.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ class JApplication;
extern JApplication* japp;

#include <JANA/Components/JComponentSummary.h>
#include <JANA/Engine/JPerfSummary.h>
#include <JANA/JLogger.h>


Expand Down Expand Up @@ -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();
Expand Down
4 changes: 0 additions & 4 deletions src/libraries/JANA/Topology/JTopologyBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#include <JANA/Utils/JProcessorMapping.h>
#include <JANA/Topology/JEventQueue.h>
#include <JANA/Topology/JEventPool.h>
#include <JANA/Engine/JPerfMetrics.h> // TODO: Should't be here

#include <JANA/Services/JParameterManager.h>
#include <JANA/Services/JComponentManager.h>
Expand All @@ -18,8 +17,6 @@
class JParameterManager;
class JComponentManager;
class JArrow;
class JQueue;
class JQueue;
class JFoldArrow;
class JUnfoldArrow;

Expand All @@ -44,7 +41,6 @@ class JTopologyBuilder : public JService {
// Things that probably shouldn't be here
std::function<void(JTopologyBuilder&)> m_configure_topology;
JEventPool* event_pool = nullptr; // TODO: Move into pools eventually
JPerfMetrics metrics;
JProcessorMapping mapping;

public:
Expand Down
2 changes: 1 addition & 1 deletion src/libraries/JANA/Utils/JBacktrace.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/janacontrol/JControlZMQ.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions src/python/common/janapy.h
Original file line number Diff line number Diff line change
Expand Up @@ -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(); }
Expand Down Expand Up @@ -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."); \
Expand Down
1 change: 1 addition & 0 deletions src/python/modules/jana/jana_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <janapy.h>
#include <JANA/CLI/JMain.h>
#include <JANA/JVersion.h>
#include <dlfcn.h>

// Something to throw that makes a nicer error message
class PYTHON_MODULE_STARTUP_FAILED{public: PYTHON_MODULE_STARTUP_FAILED(){}};
Expand Down

0 comments on commit 1d7214f

Please sign in to comment.