Skip to main content

trace Namespace

Tracing support namespace. More...

Definition

namespace micro_os_plus::trace { ... }

Namespaces Index

namespacedetail

Implementation details namespace. More...

Functions Index

voiddump_args (int argc, char *argv[], const char *name="main") noexcept

Send the argv[] array to the trace output channel. More...

voidflush (void) noexcept

Flush the trace output channel. More...

voidinitialise (void) noexcept

Initialise the trace output channel. More...

intprintf (const char *format,...) noexcept

Write a formatted string to the trace output channel. More...

intputchar (int c) noexcept

Write the single character to the trace output channel. More...

intputs (const char *s="") noexcept

Write the string and a line terminator to the trace output channel. More...

intvprintf (const char *format, std::va_list arguments) noexcept

Write a formatted variable arguments list to the trace output channel. More...

ssize_twrite (const void *buf, std::size_t nbyte) noexcept

Write the given number of bytes to the trace output channel. More...

Description

Tracing support namespace.

The trace channel functions as a standalone output device designed specifically for diagnostic purposes.

The API is straightforward and emulates the standard C output calls:

The C++ API is implemented as a class template, micro_os_plus::trace::detail::tracer, parameterised on a policy class that supplies the low-level primitives. One such policy class is declared here: micro_os_plus::trace::detail::implementation for production use. tracer<implementation> is an independent class instantiation: it is already instantiated and is used internally; it shares no mutable state.

The free functions (micro_os_plus::trace::printf() etc.) are a thin alias for tracer<implementation>, so existing call sites do not need to change.

The user is required to provide implementations of the following static methods, once per policy class actually used:

Trace support is activated by adding the MICRO_OS_PLUS_TRACE macro definition to the compiler line.

When MICRO_OS_PLUS_TRACE is not defined, all functions are inlined to empty bodies. This approach eliminates the need for trace calls to be conditionally compiled using #if defined(MICRO_OS_PLUS_TRACE) and #endif. However, the drawback is that the associated header file must always be included.


Generated via doxygen2docusaurus 2.2.1 by Doxygen 1.17.0.