micro-test-plus 4.1.0
µTest++ Testing Framework
Loading...
Searching...
No Matches
timings.h File Reference

C++ header file with declarations for the µTest++ timing utilities. More...

#include <cstdint>
#include <optional>
#include <ctime>
#include "inlines/timings-inlines.h"

Go to the source code of this file.

Classes

class  micro_os_plus::micro_test_plus::detail::timestamp
 A single point-in-time measurement, wrapping a timespec value. More...
class  micro_os_plus::micro_test_plus::detail::timestamps
 A begin/end timestamp pair used to measure elapsed time. More...

Namespaces

namespace  micro_os_plus
 The primary namespace for the µOS++ framework.
namespace  micro_os_plus::micro_test_plus
 Primary namespace for the µTest++ testing framework.
namespace  micro_os_plus::micro_test_plus::detail
 Internal implementation details for the µTest++ framework.

Detailed Description

This header provides two lightweight classes used to measure the elapsed time of test suites and test sessions within the µTest++ framework:

  • timestamp wraps a single timespec value and records one point in time. It is default-constructible and trivially copyable.
  • timestamps pairs a begin and an end timestamp (both stored as std::optional<timestamp>) and exposes methods for recording the start and finish of an operation, querying whether both timestamps are available, and computing the elapsed time in milliseconds and microseconds.

Timing support relies on clock_gettime(CLOCK_MONOTONIC_RAW, ...) when available; if the clock is not present (e.g. on bare-metal targets without an RTC) the timestamps are simply omitted and no timing information is reported.

All definitions reside within the micro_os_plus::micro_test_plus namespace, ensuring clear separation from user code and minimising the risk of naming conflicts.

This file is intended solely for internal use within the framework and should not be included directly by user code.

Definition in file timings.h.