Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Small fixes
Browse files Browse the repository at this point in the history
nathanwbrei committed Nov 19, 2024
1 parent e3eb07d commit 7b30bb8
Showing 8 changed files with 25 additions and 10 deletions.
11 changes: 11 additions & 0 deletions src/libraries/JANA/Engine/JExecutionEngine.cc
Original file line number Diff line number Diff line change
@@ -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;
@@ -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
@@ -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
@@ -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
@@ -26,7 +26,6 @@ class JApplication;
extern JApplication* japp;

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


@@ -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();
4 changes: 0 additions & 4 deletions src/libraries/JANA/Topology/JTopologyBuilder.h
Original file line number Diff line number Diff line change
@@ -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>
@@ -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<void(JTopologyBuilder&)> m_configure_topology;
JEventPool* event_pool = nullptr; // TODO: Move into pools eventually
JPerfMetrics metrics;
JProcessorMapping mapping;

public:
2 changes: 1 addition & 1 deletion src/libraries/JANA/Utils/JBacktrace.cc
Original file line number Diff line number Diff line change
@@ -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) {
2 changes: 0 additions & 2 deletions src/python/common/janapy.h
Original file line number Diff line number Diff line change
@@ -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."); \
1 change: 1 addition & 0 deletions src/python/modules/jana/jana_module.cc
Original file line number Diff line number Diff line change
@@ -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(){}};

0 comments on commit 7b30bb8

Please sign in to comment.