diff --git a/CMakeLists.txt b/CMakeLists.txt index dc317ef..74c7972 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,8 +7,10 @@ set (SF_DAQ_BUFFER_VERSION "1.0.0") set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) -# Download and unpack googletest at configure time +set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DDEBUG_OUTPUT") +set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG_OUTPUT") +# Download and unpack googletest at configure time configure_file(googletest.in googletest-download/CMakeLists.txt) execute_process( diff --git a/core-buffer/src/BufferUtils.cpp b/core-buffer/src/BufferUtils.cpp index a3ba89b..81b3ece 100644 --- a/core-buffer/src/BufferUtils.cpp +++ b/core-buffer/src/BufferUtils.cpp @@ -11,6 +11,7 @@ #include #include #include +#include using namespace std; using namespace buffer_config; @@ -96,6 +97,10 @@ void* BufferUtils::connect_socket( string ipc_address = BUFFER_LIVE_IPC_URL + detector_name + "-" + stream_name; +#ifdef DEBUG_OUTPUT + cout << "[BufferUtils::connect_socket]"; + cout << " IPC address: " << ipc_address << endl; +#endif void* socket = zmq_socket(ctx, ZMQ_SUB); if (socket == nullptr) { diff --git a/jf-live-writer/README.md b/jf-live-writer/README.md index 27286b8..95e1139 100644 --- a/jf-live-writer/README.md +++ b/jf-live-writer/README.md @@ -13,6 +13,8 @@ docker build -f jf-live-writer/debug.Dockerfile -t jf-live-writer . (Running this command from the project root is mandatory as the entire project folder needs to be part of the build context.) +# Build on your local machine + ## Building In order to build this executable you need to specify the cmake variable ``` @@ -21,7 +23,7 @@ cmake3 -DBUILD_JF_LIVE_WRITER=ON The project will not build if you do not have installed the PHDF5 library. Please follow instructions below on how to do that manually. -## Install PHDF5 manually +## Install PHDF5 ``` wget https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.12/hdf5-1.12.0/src/hdf5-1.12.0.tar.gz tar -xzf hdf5-1.12.0.tar.gz diff --git a/jf-live-writer/src/JFH5Writer.cpp b/jf-live-writer/src/JFH5Writer.cpp index 7209d39..08ec2a9 100644 --- a/jf-live-writer/src/JFH5Writer.cpp +++ b/jf-live-writer/src/JFH5Writer.cpp @@ -3,6 +3,7 @@ #include #include #include +#include #include "live_writer_config.hpp" @@ -62,11 +63,27 @@ void JFH5Writer::open_run(const int64_t run_id, bits_per_pixel_ = bits_per_pixel; image_n_bytes_ = (image_y_size_ * image_x_size_ * bits_per_pixel_) / 8; +#ifdef DEBUG_OUTPUT + cout << "[JFH5Writer::open_run]"; + cout << " run_id:" << current_run_id_; + cout << " output_file:" << output_file; + cout << " bits_per_pixel:" << bits_per_pixel_; + cout << " image_y_size:" << image_y_size_; + cout << " image_x_size:" << image_x_size_; + cout << " image_n_bytes:" << image_n_bytes_; + cout << endl; +#endif + open_file(output_file, n_images); } void JFH5Writer::close_run() { + +#ifdef DEBUG_OUTPUT + cout << "[JFH5Writer::close_run] run_id:" << current_run_id_ << endl; +#endif + close_file(); current_run_id_ = NO_RUN_ID; diff --git a/jf-live-writer/src/main.cpp b/jf-live-writer/src/main.cpp index f379356..6a57521 100644 --- a/jf-live-writer/src/main.cpp +++ b/jf-live-writer/src/main.cpp @@ -16,7 +16,7 @@ using namespace live_writer_config; int main (int argc, char *argv[]) { - if (argc != 3) { + if (argc != 2) { cout << endl; cout << "Usage: jf_live_writer [detector_json_filename]" << endl; cout << "\tdetector_json_filename: detector config file path." << endl; @@ -38,7 +38,7 @@ int main (int argc, char *argv[]) auto ctx = zmq_ctx_new(); zmq_ctx_set(ctx, ZMQ_IO_THREADS, LIVE_ZMQ_IO_THREADS); auto receiver = BufferUtils::connect_socket( - ctx, config.detector_name, "broker-agent"); + ctx, config.detector_name, "writer-agent"); RamBuffer ram_buffer(config.detector_name, config.n_modules);