tests/benchmarks: fix BOOT_TIME_MEASUREMENT

The boot time measurement sample was giving bogus values on x86: an
assumption was made that the system timer is in sync with the CPU TSC,
which is not the case on most x86 boards.

Boot time measurements are no longer permitted unless the timer source
is the local APIC. To avoid issues of TSC scaling, the startup datum
has been forced to 0, which is in line with the ARM implementation
(which is the only other platform which supports this feature).

Cleanups along the way:

As the datum is now assumed zero, some variables are removed and
calculations simplified. The global variables involved in boot time
measurements are moved to the kernel.h header rather than being
redeclared in every place they are referenced. Since none of the
measurements actually use 64-bit precision, the samples are reduced
to 32-bit quantities.

In addition, this feature has been enabled in long mode.

Fixes: #19144

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
This commit is contained in:
Charles E. Youse 2019-09-16 11:13:12 -04:00 committed by Andrew Boie
commit 3036faf88a
10 changed files with 47 additions and 91 deletions

View file

@ -23,6 +23,11 @@
extern "C" {
#endif
#ifdef CONFIG_BOOT_TIME_MEASUREMENT
extern u32_t __main_time_stamp; /* timestamp when main task starts */
extern u32_t __idle_time_stamp; /* timestamp when CPU goes idle */
#endif
/**
* @brief Kernel APIs
* @defgroup kernel_apis Kernel APIs