mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-26 03:23:35 +08:00
hrt: Add interface functions for latency counters
Add interface functions for fetching latency buckets and counters and use those in perf_counter.cpp. This cleans up the usage of perf counters, when variables defined in hrt_drv are not referenced directly from perf. This also enables implementing kernel-userspace interface for those for nuttx protected/kernel build. Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
This commit is contained in:
committed by
Daniel Agar
parent
da51177382
commit
9299a5c3f6
@@ -988,4 +988,21 @@ hrt_call_delay(struct hrt_call *entry, hrt_abstime delay)
|
||||
entry->deadline = hrt_absolute_time() + delay;
|
||||
}
|
||||
|
||||
#if !defined(CONFIG_BUILD_FLAT)
|
||||
/* These functions are inlined in all but NuttX protected/kernel builds */
|
||||
|
||||
latency_info_t get_latency(uint16_t bucket_idx, uint16_t counter_idx)
|
||||
{
|
||||
latency_info_t ret = {latency_buckets[bucket_idx], latency_counters[counter_idx]};
|
||||
return ret;
|
||||
}
|
||||
|
||||
void reset_latency_counters(void)
|
||||
{
|
||||
for (int i = 0; i <= get_latency_bucket_count(); i++) {
|
||||
latency_counters[i] = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* HRT_TIMER */
|
||||
|
||||
Reference in New Issue
Block a user