diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2018-07-24 08:54:02 +0200 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2018-07-24 08:54:02 +0200 |
commit | 3715980e5cb1e628a8fef1ee7d6f76c4f12157f7 (patch) | |
tree | 26bdd157185c844d41f7e4324e316a7c51a48faa | |
parent | 689a699de00f82e002a8feba4d19677ec253cd15 (diff) | |
download | dabmux-3715980e5cb1e628a8fef1ee7d6f76c4f12157f7.tar.gz dabmux-3715980e5cb1e628a8fef1ee7d6f76c4f12157f7.tar.bz2 dabmux-3715980e5cb1e628a8fef1ee7d6f76c4f12157f7.zip |
zmq2edi: Display number of late frames in stats
-rw-r--r-- | src/zmq2edi/EDISender.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/zmq2edi/EDISender.cpp b/src/zmq2edi/EDISender.cpp index 38fcae9..9cd84c7 100644 --- a/src/zmq2edi/EDISender.cpp +++ b/src/zmq2edi/EDISender.cpp @@ -241,14 +241,11 @@ void EDISender::send_eti_frame(uint8_t* p, metadata_t metadata) etiLog.level(debug) << "wait " << wait_time.count(); */ + const auto wait_time = t_release - t_now; if (t_release > t_now) { - const auto wait_time = t_release - t_now; std::this_thread::sleep_for(wait_time); - wait_times.push_back(duration_cast<microseconds>(wait_time).count()); - } - else { - wait_times.push_back(0); } + wait_times.push_back(duration_cast<microseconds>(wait_time).count()); edi_tagDETI.tsta = tist; edi_tagDETI.atstf = 1; @@ -342,6 +339,8 @@ void EDISender::process() const double n = wait_times.size(); double sum = accumulate(wait_times.begin(), wait_times.end(), 0); + size_t num_late = std::count_if(wait_times.begin(), wait_times.end(), + [](double v){ return v < 0; }); double mean = sum / n; double sq_sum = 0; @@ -360,12 +359,14 @@ void EDISender::process() etiLog.level(debug) << ss.str(); */ - etiLog.level(info) << "Wait time statistics:" + etiLog.level(info) << "Wait time statistics [microseconds]:" " min: " << *min_max.first << " max: " << *min_max.second << " mean: " << mean << " stdev: " << stdev << - " microseconds"; + " late: " << + num_late << " of " << wait_times.size() << " (" << + num_late * 100.0 / n << "%)"; wait_times.clear(); } |