stopwatch.cpp File
C++ source file with implementations for the µTest++ stopwatch. More...
Included Headers
Namespaces Index
| namespace | micro_os_plus |
|
The primary namespace for the µOS++ framework. More... | |
| namespace | micro_test_plus |
|
Primary namespace for the µTest++ testing framework. More... | |
| namespace | detail |
|
Internal implementation details for the µTest++ framework. More... | |
Functions Index
| void | read_clock (timespec &ts) noexcept |
|
Reads the system clock. More... | |
Description
C++ source file with implementations for the µTest++ stopwatch.
This source file contains the implementation of the stopwatch class of the µTest++ framework. It provides the member functions that read the system clock (monotonic on POSIX) at the start and at the end of the measured interval, and that compute the elapsed time between the two readings, and read_clock(), which isolates the platform-specific access to the system clock.
All definitions reside within the micro_os_plus::micro_test_plus::detail namespace.
This file must be included when building the µTest++ library.
Functions
read_clock()
| noexcept |
Reads the system clock.
Isolates the platform-specific access to the system clock, used by stopwatch and by the deprecated timestamp class. The clock is monotonic on POSIX; without a clock, ts is left unchanged, so the callers clear it first when a zero value must mean that the clock was not read.
- Parameters
-
[out] ts The timespec where the reading is stored.
- Returns
Nothing.
On Windows, the current time is captured via timespec_get() with TIME_UTC. On POSIX platforms with CLOCK_MONOTONIC defined, clock_gettime(CLOCK_MONOTONIC) is used to obtain a monotonic reading. On platforms where neither macro is defined, ts is left unchanged.
Definition at line 66 of file stopwatch.cpp.
Reference micro_os_plus::micro_test_plus::detail::read_clock.
Referenced by micro_os_plus::micro_test_plus::detail::timestamp::timestamp, micro_os_plus::micro_test_plus::detail::read_clock, micro_os_plus::micro_test_plus::detail::stopwatch::start, micro_os_plus::micro_test_plus::detail::stopwatch::stop, micro_os_plus::micro_test_plus::detail::stopwatch::timestamp_begin and micro_os_plus::micro_test_plus::detail::stopwatch::timestamp_end.
File Listing
The file content with the documentation metadata removed is:
Generated via doxygen2docusaurus 2.2.8 by Doxygen 1.18.0.