Use stats time instead of n_images for statistics

This commit is contained in:
2021-07-19 14:28:27 +02:00
parent bebb8891b0
commit 1e461d6647
3 changed files with 9 additions and 6 deletions
+2 -2
View File
@@ -7,7 +7,7 @@
class AssemblerStats {
const std::string detector_name_;
const size_t stats_modulo_;
const size_t stats_time_;
int image_counter_;
int n_corrupted_images_;
@@ -19,7 +19,7 @@ class AssemblerStats {
public:
AssemblerStats(const std::string &detector_name,
const size_t stats_modulo);
const size_t stats_time);
void record_stats(const ImageMetadata *meta, const uint32_t n_lost_pulses);
};
+6 -3
View File
@@ -7,9 +7,9 @@ using namespace chrono;
AssemblerStats::AssemblerStats(
const std::string &detector_name,
const size_t stats_modulo) :
const size_t stats_time) :
detector_name_(detector_name),
stats_modulo_(stats_modulo)
stats_time_(stats_time)
{
reset_counters();
}
@@ -32,7 +32,10 @@ void AssemblerStats::record_stats(
n_corrupted_images_++;
}
if (image_counter_ == stats_modulo_) {
const auto time_passed = duration_cast<milliseconds>(
steady_clock::now()-stats_interval_start_).count();
if (time_passed >= stats_time_*1000) {
print_stats();
reset_counters();
}
+1 -1
View File
@@ -86,7 +86,7 @@ int main (int argc, char *argv[])
sizeof(ImageMetadata), IMAGE_N_BYTES, 1,
buffer_config::RAM_BUFFER_N_SLOTS);
AssemblerStats stats(config.detector_name, ASSEMBLER_STATS_MODULO);
AssemblerStats stats(config.detector_name, STATS_TIME);
uint64_t image_id = 0;