Skip to content

Commit 5147e3b

Browse files
Pavel Harbanaucodebot
authored andcommitted
ofh: log warning when the timing worker skips more than two symbols
1 parent 9a10889 commit 5147e3b

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

.gitlab/ci/e2e/.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
SRSGNB_REGISTRY_URI=registry.gitlab.com/softwareradiosystems/srsgnb
22
RETINA_REGISTRY_PREFIX=registry.gitlab.com/softwareradiosystems/ci/retina
3-
RETINA_VERSION=0.89.2
3+
RETINA_VERSION=0.89.3
44
UBUNTU_VERSION=24.04
55
AMARISOFT_VERSION=2025-09-19
66
SRSUE_VERSION=23.11

lib/ofh/timing/realtime_timing_worker.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ void realtime_timing_worker::start()
6868

6969
auto now = gps_clock::now();
7070
auto ns_fraction = calculate_ns_fraction_from(now);
71+
last_wakeup_tp = std::chrono::steady_clock::now();
7172
previous_symb_index = get_symbol_index(ns_fraction, symbol_duration);
7273
previous_time_since_epoch = now.time_since_epoch().count();
7374

@@ -122,6 +123,8 @@ calculate_slot_point(subcarrier_spacing scs, uint64_t gps_seconds, uint32_t frac
122123

123124
void realtime_timing_worker::poll()
124125
{
126+
auto sleeping_time = calculate_sleeping_time();
127+
125128
auto now = gps_clock::now();
126129
auto ns_fraction = calculate_ns_fraction_from(now);
127130

@@ -158,6 +161,18 @@ void realtime_timing_worker::poll()
158161
current_symbol_index % nof_symbols_per_slot);
159162
metrics_collector.update_skipped_symbols(delta);
160163
}
164+
if (SRSRAN_UNLIKELY(delta >= 3)) {
165+
log_conditional_warning(
166+
logger,
167+
enable_log_warnings_for_lates,
168+
"Real-time timing worker woke up late, skipped '{}' symbols. Current symbol is '{}'. Equivalent realtime clock "
169+
"sleep time has been '{}us', wall clock sleep time has been '{}us'",
170+
delta,
171+
current_symbol_index % nof_symbols_per_slot,
172+
std::chrono::duration_cast<std::chrono::microseconds>(delta * symbol_duration).count(),
173+
sleeping_time.count());
174+
}
175+
161176
if (SRSRAN_UNLIKELY(delta >= nof_symbols_per_slot)) {
162177
log_conditional_warning(
163178
logger,

lib/ofh/timing/realtime_timing_worker.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ class realtime_timing_worker : public operation_controller, public ota_symbol_bo
8484
bool enable_log_warnings_for_lates;
8585
unsigned previous_symb_index = 0;
8686
gps_clock::rep previous_time_since_epoch = 0;
87+
std::chrono::steady_clock::time_point last_wakeup_tp;
8788
stop_event_source stop_manager;
8889
timing_metrics_collector_impl metrics_collector;
8990

@@ -118,6 +119,16 @@ class realtime_timing_worker : public operation_controller, public ota_symbol_bo
118119
auto tp_sec = std::chrono::time_point_cast<std::chrono::seconds>(tp);
119120
return tp - tp_sec;
120121
}
122+
123+
/// Calculates the time passed since last wake-up using the steady clock.
124+
std::chrono::microseconds calculate_sleeping_time()
125+
{
126+
auto tp_now = std::chrono::steady_clock::now();
127+
auto sleeping_time = std::chrono::duration_cast<std::chrono::microseconds>(tp_now - last_wakeup_tp);
128+
last_wakeup_tp = tp_now;
129+
130+
return sleeping_time;
131+
}
121132
};
122133

123134
} // namespace ofh

0 commit comments

Comments
 (0)