Skip to content

Commit ce52948

Browse files
committed
AP_HAL_SITL: log number of times sim paused on serial0 buffer
SITL pauses the simulation if we do not have a minimum amount of space in its out queue. Log the number of times we do this.
1 parent 5c76e77 commit ce52948

File tree

4 files changed

+12
-0
lines changed

4 files changed

+12
-0
lines changed

libraries/AP_HAL_SITL/HAL_SITL_Class.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,11 @@ bool HAL_SITL::run_in_maintenance_mode() const
206206
}
207207
#endif
208208

209+
uint32_t HAL_SITL::get_uart_output_full_queue_count() const
210+
{
211+
return _sitl_state->_serial_0_outqueue_full_count;
212+
}
213+
209214
void HAL_SITL::run(int argc, char * const argv[], Callbacks* callbacks) const
210215
{
211216
assert(callbacks);

libraries/AP_HAL_SITL/HAL_SITL_Class.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ class HAL_SITL : public AP_HAL::HAL {
4141
bool run_in_maintenance_mode() const;
4242
#endif
4343

44+
uint32_t get_uart_output_full_queue_count() const;
45+
4446
private:
4547
HALSITL::SITL_State *_sitl_state;
4648

libraries/AP_HAL_SITL/SITL_State.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ void SITL_State::wait_clock(uint64_t wait_time_usec)
188188
if (queue_length < 1024) {
189189
break;
190190
}
191+
_serial_0_outqueue_full_count++;
191192
usleep(1000);
192193
}
193194
}

libraries/AP_HAL_SITL/SITL_State_common.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,10 @@ class HALSITL::SITL_State_Common {
247247
void multicast_state_open(void);
248248
void multicast_state_send(void);
249249

250+
// number of times we have paused the simulation for 1ms because
251+
// the TCP queue is full:
252+
uint32_t _serial_0_outqueue_full_count;
253+
250254
protected:
251255
enum vehicle_type _vehicle;
252256

0 commit comments

Comments
 (0)