Rename DEBUG to DEBUG_OUTPUT

This commit is contained in:
2018-01-10 14:14:14 +01:00
parent af02caf241
commit 94f447bd9d
5 changed files with 28 additions and 28 deletions
+2 -2
View File
@@ -12,9 +12,9 @@ HEADERS = $(wildcard $(SRC_DIR)/*.hpp)
SRCS = $(wildcard $(SRC_DIR)/*.cpp)
OBJS = $(patsubst $(SRC_DIR)/%.cpp, $(OBJ_DIR)/%.o, $(SRCS))
all: build_dirs h5_zmq_writer rest_api
all: build_dirs h5_zmq_writer
debug: CPPFLAGS += -DDEBUG -g
debug: CPPFLAGS += -DDEBUG_OUTPUT -g
debug: all
h5_zmq_writer: $(OBJS)
+10 -10
View File
@@ -20,7 +20,7 @@ hsize_t expand_dataset(const H5::DataSet& dataset, hsize_t frame_index, hsize_t
dataset.getSpace().getSimpleExtentDims(dataset_dimension);
dataset_dimension[0] = frame_index + dataset_increase_step;
#ifdef DEBUG
#ifdef DEBUG_OUTPUT
cout << "[expand_dataset] Expanding dataspace to size (";
for (hsize_t i=0; i<dataset_rank; ++i) {
cout << dataset_dimension[i] << ",";
@@ -41,7 +41,7 @@ void compact_dataset(const H5::DataSet& dataset, hsize_t max_frame_index)
dataset.getSpace().getSimpleExtentDims(dataset_dimension);
dataset_dimension[0] = max_frame_index + 1;
#ifdef DEBUG
#ifdef DEBUG_OUTPUT
cout << "[compact_dataset] Compacting dataspace to size (";
for (hsize_t i=0; i<dataset_rank; ++i) {
cout << dataset_dimension[i] << ",";
@@ -55,7 +55,7 @@ void compact_dataset(const H5::DataSet& dataset, hsize_t max_frame_index)
HDF5ChunkedWriter::HDF5ChunkedWriter(const string filename, const string dataset_name, hsize_t frames_per_file, hsize_t initial_dataset_size) :
filename(filename), dataset_name(dataset_name), frames_per_file(frames_per_file), initial_dataset_size(initial_dataset_size)
{
#ifdef DEBUG
#ifdef DEBUG_OUTPUT
cout << "[HDF5ChunkedWriter::HDF5ChunkedWriter] Creating chunked writer";
cout << " with filename " << filename;
cout << " and dataset_name " << dataset_name;
@@ -73,14 +73,14 @@ HDF5ChunkedWriter::~HDF5ChunkedWriter()
void HDF5ChunkedWriter::close_file()
{
if (file.getId() == -1) {
#ifdef DEBUG
#ifdef DEBUG_OUTPUT
cout << "[HDF5ChunkedWriter::close_file] Trying to close an already closed file." << endl;
#endif
return;
}
#ifdef DEBUG
#ifdef DEBUG_OUTPUT
cout << "[HDF5ChunkedWriter::close_file] Closing file." << endl;
#endif
@@ -98,7 +98,7 @@ void HDF5ChunkedWriter::close_file()
auto image_nr_low = min_frame_in_dataset + 1;
auto image_nr_high = max_frame_in_dataset + 1;
#ifdef DEBUG
#ifdef DEBUG_OUTPUT
cout << "[HDF5ChunkedWriter::close_file] Setting dataset attribute image_nr_low=" << image_nr_low << " and image_nr_high=" << image_nr_high << endl;
#endif
@@ -147,7 +147,7 @@ void HDF5ChunkedWriter::create_file(size_t* frame_shape, hsize_t frame_chunk) {
// In case frames_per_file is > 0, the filename variable is a template for the filename.
if (frames_per_file) {
#ifdef DEBUG
#ifdef DEBUG_OUTPUT
cout << "[HDF5ChunkedWriter::create_file] Frames per file is defined. Format " << filename << " with frame_chunk " << frame_chunk << endl;
#endif
@@ -158,7 +158,7 @@ void HDF5ChunkedWriter::create_file(size_t* frame_shape, hsize_t frame_chunk) {
target_filename = string(buffer);
}
#ifdef DEBUG
#ifdef DEBUG_OUTPUT
cout << "[HDF5ChunkedWriter::create_file] Creating filename " << target_filename << endl;
#endif
@@ -174,7 +174,7 @@ void HDF5ChunkedWriter::create_file(size_t* frame_shape, hsize_t frame_chunk) {
const hsize_t max_dataset_dimension[] = {H5S_UNLIMITED, frame_shape[0], frame_shape[1]};
H5::DataSpace dataspace(dataset_rank, dataset_dimension, max_dataset_dimension);
#ifdef DEBUG
#ifdef DEBUG_OUTPUT
cout << "[HDF5ChunkedWriter::create_file] Creating dataspace of size (";
for (hsize_t i=0; i<dataset_rank; ++i) {
cout << dataset_dimension[i] << ",";
@@ -213,7 +213,7 @@ hsize_t HDF5ChunkedWriter::prepare_storage_for_frame(size_t frame_index, size_t*
relative_frame_index = frame_index - ((frame_chunk - 1) * frames_per_file);
}
#ifdef DEBUG
#ifdef DEBUG_OUTPUT
cout << "[HDF5ChunkedWriter::prepare_storage_for_frame] Received frame index " << frame_index << " and processed as relative frame index " << relative_frame_index << endl;
#endif
+8 -8
View File
@@ -10,7 +10,7 @@
using namespace std;
RingBuffer::RingBuffer(size_t n_slots) : n_slots(n_slots), ringbuffer_slots(n_slots, 0){
#ifdef DEBUG
#ifdef DEBUG_OUTPUT
cout << "[RingBuffer::RingBuffer] Creating ring buffer with n_slots " << n_slots << endl;
#endif
}
@@ -33,7 +33,7 @@ void RingBuffer::initialize(size_t slot_size)
throw runtime_error(error_message.str());
}
#ifdef DEBUG
#ifdef DEBUG_OUTPUT
cout << "[RingBuffer::initialize] Initializing ring buffer with slot_size " << slot_size << endl;
#endif
@@ -44,7 +44,7 @@ void RingBuffer::initialize(size_t slot_size)
this->buffer_used_slots = 0;
this->ring_buffer_initialized = true;
#ifdef DEBUG
#ifdef DEBUG_OUTPUT
cout << "[RingBuffer::initialize] Total buffer_size " << buffer_size << endl;
#endif
}
@@ -74,7 +74,7 @@ void RingBuffer::write(FrameMetadata &metadata, char* data)
// Set the write index in the FrameMetadata object.
metadata.buffer_slot_index = write_index;
#ifdef DEBUG
#ifdef DEBUG_OUTPUT
cout << "[RingBuffer::write] Ring buffer slot " << metadata.buffer_slot_index << " reserved for frame_index " << metadata.frame_index << endl;
#endif
@@ -97,7 +97,7 @@ void RingBuffer::write(FrameMetadata &metadata, char* data)
char* slot_memory_address = get_buffer_slot_address(metadata.buffer_slot_index);
memcpy(slot_memory_address, data, metadata.frame_bytes_size);
#ifdef DEBUG
#ifdef DEBUG_OUTPUT
cout << "[RingBuffer::write] Copied " << metadata.frame_bytes_size << " frame bytes to buffer_slot_index " << metadata.buffer_slot_index << endl;
#endif
@@ -108,7 +108,7 @@ void RingBuffer::write(FrameMetadata &metadata, char* data)
frame_metadata_queue_mutex.unlock();
#ifdef DEBUG
#ifdef DEBUG_OUTPUT
cout << "[RingBuffer] Metadata for frame_index " << metadata.frame_index << " added to metadata queue." << endl;
#endif
}
@@ -124,7 +124,7 @@ char* RingBuffer::get_buffer_slot_address(size_t buffer_slot_index) {
throw runtime_error(error_message.str());
}
#ifdef DEBUG
#ifdef DEBUG_OUTPUT
cout << "[RingBuffer::get_buffer_slot_address] For buffer_slot_index " << buffer_slot_index << " the calculated memory address is " << long(slot_memory_address) << endl;
#endif
@@ -150,7 +150,7 @@ pair<FrameMetadata, char*> RingBuffer::read()
frame_metadata_queue_mutex.unlock();
#ifdef DEBUG
#ifdef DEBUG_OUTPUT
cout << "[RingBuffer::read] Received metadata for frame_index " << frame_metadata.frame_index << endl;
#endif
}
+2 -2
View File
@@ -79,7 +79,7 @@ void run_writer(string connect_address, string output_file, uint64_t n_images){
WriterManager manager(n_images);
RingBuffer ring_buffer(n_slots);
#ifdef DEBUG
#ifdef DEBUG_OUTPUT
cout << "[h5_zmq_writer::run_writer] Running writer";
cout << " with connect_address " << connect_address << " ";
cout << " and output_file " << output_file << " ";
@@ -96,7 +96,7 @@ void run_writer(string connect_address, string output_file, uint64_t n_images){
receiver_thread.join();
writer_thread.join();
#ifdef DEBUG
#ifdef DEBUG_OUTPUT
cout << "[h5_zmq_writer::run_writer] Writer properly stopped." << endl;
#endif
}
+6 -6
View File
@@ -43,9 +43,9 @@ void start_rest_api(WriterManager& writer_manager, uint16_t port)
CROW_ROUTE (app, "/statistics") ([&](){
crow::json::wvalue result;
for (const auto& item : writer_manager.get_statistics()) {
result[item.first] = item.second;
}
// for (const auto& item : writer_manager.get_statistics()) {
// result[item.first] = item.second;
// }
return result;
});
@@ -55,9 +55,9 @@ void start_rest_api(WriterManager& writer_manager, uint16_t port)
if (req.method == "GET"_method) {
for (const auto& item : writer_manager.get_paramters()) {
result[item.first] = item.second;
}
// for (const auto& item : writer_manager.get_paramters()) {
// result[item.first] = item.second;
// }
return result;
} else {