mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-24 16:33: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
@@ -610,15 +610,17 @@ perf_print_all(int fd)
|
||||
void
|
||||
perf_print_latency(int fd)
|
||||
{
|
||||
latency_info_t latency;
|
||||
dprintf(fd, "bucket [us] : events\n");
|
||||
|
||||
for (int i = 0; i < latency_bucket_count; i++) {
|
||||
dprintf(fd, " %4i : %li\n", latency_buckets[i], (long int)latency_counters[i]);
|
||||
for (int i = 0; i < get_latency_bucket_count(); i++) {
|
||||
latency = get_latency(i, i);
|
||||
dprintf(fd, " %4i : %li\n", latency.bucket, (long int)latency.counter);
|
||||
}
|
||||
|
||||
// print the overflow bucket value
|
||||
dprintf(fd, " >%4" PRIu16 " : %" PRIu32 "\n", latency_buckets[latency_bucket_count - 1],
|
||||
latency_counters[latency_bucket_count]);
|
||||
latency = get_latency(get_latency_bucket_count() - 1, get_latency_bucket_count());
|
||||
dprintf(fd, " >%4" PRIu16 " : %" PRIu32 "\n", latency.bucket, latency.counter);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -634,7 +636,5 @@ perf_reset_all(void)
|
||||
|
||||
pthread_mutex_unlock(&perf_counters_mutex);
|
||||
|
||||
for (int i = 0; i <= latency_bucket_count; i++) {
|
||||
latency_counters[i] = 0;
|
||||
}
|
||||
reset_latency_counters();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user