From 2980f73251c631960fcbe048eda861afa7a1be89 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Tue, 15 Aug 2023 10:37:45 +0200 Subject: Dexter: Add in_holdover_since metric --- src/output/Dexter.cpp | 7 +++++++ src/output/SDR.cpp | 10 ++++++++++ 2 files changed, 17 insertions(+) (limited to 'src') 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 remaining = max_holdover_duration - (steady_clock::now() - m_holdover_since); + rs["remaining_holdover_s"].v = duration_cast(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 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(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() -- cgit v1.2.3