writer stats only when image counter is not zero

This commit is contained in:
lhdamiani
2021-07-13 14:59:43 +02:00
parent 07d60d0a06
commit 92bc53ef9b
3 changed files with 24 additions and 50 deletions
+21 -42
View File
@@ -70,21 +70,18 @@ void EigerAssembler::assemble_image(const char* src_meta,
image_meta->encoding = 0;
image_meta->source_id = 0;
is_pulse_init = 1;
#ifdef DEBUG_OUTPUT
using namespace date;
cout << " [" << std::chrono::system_clock::now();
cout << "] [EigerAssembler::assemble_image] is_pulse_init ";
cout << " || Image id: " << image_meta->id;
cout << endl;
#endif
}
// missing packets: bad status = 1
if (frame_meta->n_recv_packets != n_packets_per_frame_){
image_meta->status = 1;
#ifdef DEBUG_OUTPUT
using namespace date;
cout << " [" << std::chrono::system_clock::now();
cout << "] [EigerAssembler::assemble_image] bad frame :";
cout << "frame_meta->frame_index != n_packets_per_frame_ ";
cout << "|| i_module: " << i_module;
cout << "|| frame_meta->n_recv_packets " << frame_meta->n_recv_packets;
cout << "|| n_packets_per_frame_" << n_packets_per_frame_;
cout << endl;
#endif
}
// frame id false: bad status = 2
@@ -118,20 +115,6 @@ void EigerAssembler::assemble_image(const char* src_meta,
dest_offset += n_bytes_per_module_line_ + n_bytes_per_x_gap_;
}
#ifdef DEBUG_OUTPUT
using namespace date;
// if (i_module == 0){
cout << " [" << std::chrono::system_clock::now();
cout << "] [MODULE " << i_module;
cout << "] (row " << i_module_row;
cout << " , column" << i_module_column;
cout << ") || reverse_factor" << reverse_factor;
cout << " || line_number" << line_number;
cout << " || N_RECV_PACKETS" << frame_meta->n_recv_packets;
cout << endl;
// }
#endif
int counter = 0;
for (uint32_t frame_line = 0;
@@ -142,29 +125,25 @@ void EigerAssembler::assemble_image(const char* src_meta,
(char*)(src_data + source_offset),
n_bytes_per_module_line_
);
#ifdef DEBUG_OUTPUT
using namespace date;
// verifies the addresses for
// beginning and end of each frame
if (counter < 5 || counter > 508){
cout << " [" << std::chrono::system_clock::now();
cout << "] [MODULE " << i_module;
cout << "] (row " << i_module_row;
cout << ",column " << i_module_column;
cout << ") source_offset" << source_offset;
cout << " || dest_offset " << dest_offset;
cout << " || frame_line " << frame_line;
cout << " || COUNTER " << counter;
cout << endl;
}
#endif
counter += 1;
source_offset += reverse * n_bytes_per_module_line_;
dest_offset += reverse * n_bytes_per_image_line_;
}
line_number += n_lines_per_frame_;
dest_module_line = line_number + n_lines_per_frame_ - 1;
last_image_status_ = image_meta->status;
// last module sets the last_image_status_
if (i_module == n_modules_ - 1){
last_image_status_ = image_meta->status;
#ifdef DEBUG_OUTPUT
using namespace date;
cout << " [" << std::chrono::system_clock::now();
cout << "] [EigerAssembler::assemble_image] ";
cout << " || Image id: " << image_meta->id;
cout << " || last_image_status_ " << last_image_status_;
cout << endl;
#endif
}
}
}
-7
View File
@@ -95,13 +95,6 @@ int main (int argc, char *argv[])
// receives the synced image id
zmq_recv(receiver_sync, &image_id, sizeof(image_id), 0);
#ifdef DEBUG_OUTPUT
using namespace date;
cout << " [" << std::chrono::system_clock::now();
cout << "] [ASSEMBLER::receiver_sync] image_id: ";
cout << image_id;
cout << endl;
#endif
// metadata
auto* src_meta = frame_buffer.get_slot_meta(image_id);
auto* src_data = frame_buffer.get_slot_data(image_id);
+3 -1
View File
@@ -39,7 +39,9 @@ void WriterStats::end_image_write()
void WriterStats::end_run()
{
print_stats();
if (image_counter_ > 0){
print_stats();
}
reset_counters();
}