mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-18 05:37:36 +08:00
Perf print: Fix division by zero
This commit is contained in:
@@ -448,7 +448,7 @@ perf_print_counter_fd(int fd, perf_counter_t handle)
|
|||||||
(unsigned long long)pce->event_count,
|
(unsigned long long)pce->event_count,
|
||||||
(unsigned long long)pce->event_overruns,
|
(unsigned long long)pce->event_overruns,
|
||||||
(unsigned long long)pce->time_total,
|
(unsigned long long)pce->time_total,
|
||||||
pce->event_count == 0 ? 0 : (unsigned long long)pce->time_total / pce->event_count,
|
(pce->event_count == 0) ? 0 : (unsigned long long)pce->time_total / pce->event_count,
|
||||||
(unsigned long long)pce->time_least,
|
(unsigned long long)pce->time_least,
|
||||||
(unsigned long long)pce->time_most,
|
(unsigned long long)pce->time_most,
|
||||||
(double)(1e6f * rms));
|
(double)(1e6f * rms));
|
||||||
@@ -462,7 +462,7 @@ perf_print_counter_fd(int fd, perf_counter_t handle)
|
|||||||
dprintf(fd, "%s: %llu events, %lluus avg, min %lluus max %lluus %5.3fus rms\n",
|
dprintf(fd, "%s: %llu events, %lluus avg, min %lluus max %lluus %5.3fus rms\n",
|
||||||
handle->name,
|
handle->name,
|
||||||
(unsigned long long)pci->event_count,
|
(unsigned long long)pci->event_count,
|
||||||
(unsigned long long)(pci->time_last - pci->time_first) / pci->event_count,
|
(pci->event_count == 0) ? 0 : (unsigned long long)(pci->time_last - pci->time_first) / pci->event_count,
|
||||||
(unsigned long long)pci->time_least,
|
(unsigned long long)pci->time_least,
|
||||||
(unsigned long long)pci->time_most,
|
(unsigned long long)pci->time_most,
|
||||||
(double)(1e6f * rms));
|
(double)(1e6f * rms));
|
||||||
|
|||||||
Reference in New Issue
Block a user