diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2023-08-15 10:37:45 +0200 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2023-08-15 10:37:45 +0200 |
commit | 2980f73251c631960fcbe048eda861afa7a1be89 (patch) | |
tree | d648100ba4d88378f31415b5627494000bb79acc | |
parent | 6c0732dcfc2af963e2b8577e9fc38f71307a1033 (diff) | |
download | dabmod-2980f73251c631960fcbe048eda861afa7a1be89.tar.gz dabmod-2980f73251c631960fcbe048eda861afa7a1be89.tar.bz2 dabmod-2980f73251c631960fcbe048eda861afa7a1be89.zip |
Dexter: Add in_holdover_since metric
-rw-r--r-- | src/output/Dexter.cpp | 7 | ||||
-rw-r--r-- | src/output/SDR.cpp | 10 |
2 files changed, 17 insertions, 0 deletions
diff --git a/src/output/Dexter.cpp b/src/output/Dexter.cpp index 14edace..457ec78 100644 --- a/src/output/Dexter.cpp +++ b/src/output/Dexter.cpp @@ -407,6 +407,7 @@ SDRDevice::run_statistics_t Dexter::get_run_statistics(void) const rs["frames"].v = num_frames_modulated; rs["in_holdover_since"].v = 0; + rs["remaining_holdover_s"].v = nullopt; switch (m_clock_state) { case DexterClockState::Startup: rs["clock_state"].v = "startup"; break; @@ -415,6 +416,12 @@ SDRDevice::run_statistics_t Dexter::get_run_statistics(void) const case DexterClockState::Holdover: rs["clock_state"].v = "holdover"; rs["in_holdover_since"].v = m_holdover_since_t; + { + using namespace std::chrono; + const auto max_holdover_duration = seconds(m_conf.maxGPSHoldoverTime); + const duration<double> remaining = max_holdover_duration - (steady_clock::now() - m_holdover_since); + rs["remaining_holdover_s"].v = duration_cast<seconds>(remaining).count(); + } break; } diff --git a/src/output/SDR.cpp b/src/output/SDR.cpp index d2956a2..d57e4d6 100644 --- a/src/output/SDR.cpp +++ b/src/output/SDR.cpp @@ -99,6 +99,16 @@ SDR::SDR(SDRDeviceConfig& config, std::shared_ptr<SDRDevice> device) : RC_ADD_PARAMETER(fifo_fill, "A value representing the Lime FIFO fullness [percent]"); } #endif // HAVE_LIMESDR + +#ifdef HAVE_DEXTER + if (std::dynamic_pointer_cast<Dexter>(device)) { + RC_ADD_PARAMETER(in_holdover_since, "DEXTER timestamp when holdover began"); + RC_ADD_PARAMETER(remaining_holdover_s, "DEXTER remaining number of seconds in holdover"); + RC_ADD_PARAMETER(clock_state, "DEXTER clock state: startup/normal/holdover"); + } +#endif // HAVE_DEXTER + + } SDR::~SDR() |