47 #include <px4_platform_common/px4_config.h> 48 #include <px4_platform_common/micro_hal.h> 54 #include <nuttx/irq.h> 55 static irqstate_t flags;
61 flags = px4_enter_critical_section();
68 px4_leave_critical_section(flags);
72 #define PERF(name, op, count) do { \ 75 perf_counter_t p = perf_alloc(PC_ELAPSED, name); \ 76 for (int i = 0; i < count; i++) { \ 84 perf_print_counter(p); \ 91 virtual bool run_tests();
102 flags = px4_enter_critical_section();
109 px4_leave_critical_section(flags);
117 bool MicroBenchHRT::run_tests()
121 return (_tests_failed == 0);
127 const T scale = rand() / (T) RAND_MAX;
128 return min + scale * (max -
min);
133 srand(time(
nullptr));
142 bool MicroBenchHRT::time_px4_hrt()
int test_microbench_hrt(int argc, char *argv[])
ut_declare_test_c(test_microbench_hrt, MicroBenchHRT) bool MicroBenchHRT
int reset(enum LPS22HB_BUS busid)
Reset the driver.
#define PERF(name, op, count)
Base class to be used for unit tests.
High-resolution timer with callouts and timekeeping.
constexpr _Tp min(_Tp a, _Tp b)
constexpr _Tp max(_Tp a, _Tp b)
#define ut_run_test(test)
Runs a single unit test.
__EXPORT hrt_abstime hrt_absolute_time(void)
Get absolute time in [us] (does not wrap).
Performance measuring tools.
__EXPORT hrt_abstime hrt_elapsed_time_atomic(const volatile hrt_abstime *then)
Compute the delta between a timestamp taken in the past and now.