mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-03 15:18:54 +08:00
Unit tests: Retain atomic operation
This ensures we get absolutely accurate timing.
This commit is contained in:
@@ -71,13 +71,13 @@ int HRTTest::main()
|
||||
|
||||
hrt_abstime t = hrt_absolute_time();
|
||||
px4_usleep(1000000);
|
||||
hrt_abstime elt = hrt_elapsed_time(&t);
|
||||
hrt_abstime elt = hrt_elapsed_time_atomic(&t);
|
||||
PX4_INFO("Elapsed time %llu in 1 sec (usleep)\n", (unsigned long long)elt);
|
||||
PX4_INFO("Start time %llu\n", (unsigned long long)t);
|
||||
|
||||
t = hrt_absolute_time();
|
||||
px4_sleep(1);
|
||||
elt = hrt_elapsed_time(&t);
|
||||
elt = hrt_elapsed_time_atomic(&t);
|
||||
PX4_INFO("Elapsed time %llu in 1 sec (sleep)\n", (unsigned long long)elt);
|
||||
PX4_INFO("Start time %llu\n", (unsigned long long)t);
|
||||
|
||||
|
||||
@@ -137,7 +137,7 @@ ut_declare_test_c(test_microbench_hrt, MicroBenchHRT)
|
||||
bool MicroBenchHRT::time_px4_hrt()
|
||||
{
|
||||
PERF("hrt_absolute_time()", u_64_out = hrt_absolute_time(), 1000);
|
||||
PERF("hrt_elapsed_time()", u_64_out = hrt_elapsed_time(&u_64), 1000);
|
||||
PERF("hrt_elapsed_time()", u_64_out = hrt_elapsed_time_atomic(&u_64), 1000);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user