Zth (libzth)
Loading...
Searching...
No Matches

Classes

class  zth::Load< T >
 Measure the load of some activity. More...
 
class  zth::EventRate< T, Bins, Count >
 Measure the rate of some event in Hz. More...
 

Functions

void zth::perf_start (zth_perf_done_callback_t *f) noexcept
 Starts recording perf events.
 
void zth::perf_stop () noexcept
 Stops recording perf events.
 
void zth::perf_mark (char const *m, Timestamp const &t) noexcept
 Put a string marker into the perf output.
 
void zth::perf_async_handle (zth_perf_async_handle_t *handle) noexcept
 Returns the handle of the current thread's perf buffer.
 
void zth::perf_mark_async (char const *marker, zth_perf_async_handle_t *handle) noexcept
 Async-/thread-safe zth::perf_mark().
 
void zth::perf_log (char const *fmt,...) noexcept
 Put a formatted log string into the perf output.
 
void zth::perf_log (Timestamp const &t, char const *fmt,...) noexcept
 Put a formatted log string into the perf output.
 
void zth::perf_logv (char const *fmt, va_list args, Timestamp const &t) noexcept
 Put a formatted log string into the perf output.
 
void zth::perf_dump (zth_perf_dump_callback_t *f) noexcept
 Passes collected perf data to f.
 
void zth::perf_run (zth_perf_dump_callback_t *f) noexcept
 Setup the system to automatically perform perf event recording, dumping, and resuming.
 
void zth::perf_abort () noexcept
 Abort a zth::perf_run().
 
void zth::perf_run_dump (char const *path) noexcept
 Like zth::perf_run(), but dump the contents to file immediately.
 

Detailed Description

This module allows generating a VCD file which tracks scheduling behavior of the application.

Function Documentation

◆ perf_abort()

void zth::perf_abort ( )
noexcept

Abort a zth::perf_run().

Definition at line 700 of file perf.cpp.

◆ perf_async_handle()

void zth::perf_async_handle ( zth_perf_async_handle_t handle)
noexcept

Returns the handle of the current thread's perf buffer.

See also
perf_mark_async()

Definition at line 408 of file perf.cpp.

◆ perf_dump()

void zth::perf_dump ( zth_perf_dump_callback_t f)
noexcept

Passes collected perf data to f.

The data (pointer to a buffer and its length) passed to f can be converted to VCD later on. Write the data to file or stdout, for example, for later processing.

The internal buffer is erased afterwards.

Typical workflow:

Definition at line 572 of file perf.cpp.

◆ perf_log() [1/2]

void zth::perf_log ( char const *  fmt,
  ... 
)
noexcept

Put a formatted log string into the perf output.

Examples
5_perf.cpp.

Definition at line 443 of file perf.cpp.

◆ perf_log() [2/2]

void zth::perf_log ( Timestamp const &  t,
char const *  fmt,
  ... 
)
noexcept

Put a formatted log string into the perf output.

Definition at line 455 of file perf.cpp.

◆ perf_logv()

void zth::perf_logv ( char const *  fmt,
va_list  args,
Timestamp const &  t = Timestamp() 
)
noexcept

Put a formatted log string into the perf output.

Definition at line 467 of file perf.cpp.

◆ perf_mark()

void zth::perf_mark ( char const *  marker,
Timestamp const &  t = Timestamp() 
)
noexcept

Put a string marker into the perf output.

Examples
5_perf.cpp.

Definition at line 394 of file perf.cpp.

◆ perf_mark_async()

void zth::perf_mark_async ( char const *  marker,
zth_perf_async_handle_t handle 
)
noexcept

Async-/thread-safe zth::perf_mark().

This function performs zth::perf_mark() on another thread's perf event buffer, of which its handle is retrieved by the owner thread using zth::perf_async_handle().

Definition at line 424 of file perf.cpp.

◆ perf_run()

void zth::perf_run ( zth_perf_dump_callback_t f)
noexcept

Setup the system to automatically perform perf event recording, dumping, and resuming.

Typical workflow:

  • Make sure Config::DoPerfEvent is set (optionally via environment).
  • Call perf_run().
  • When the buffer is full, the callback function is called, as if zth::perf_dump() was invoked.
  • The buffer is cleared and recording is resumed automatically.

This gives a continuous flow of zth::perf_dump() callbacks, with data later/offline to be converted to VCD.

Definition at line 685 of file perf.cpp.

◆ perf_run_dump()

void zth::perf_run_dump ( char const *  path = nullptr)
noexcept

Like zth::perf_run(), but dump the contents to file immediately.

Definition at line 744 of file perf.cpp.

◆ perf_start()

void zth::perf_start ( zth_perf_done_callback_t f)
noexcept

Starts recording perf events.

Recording can only be started when perf is enabled.

Definition at line 263 of file perf.cpp.

◆ perf_stop()

void zth::perf_stop ( )
noexcept

Stops recording perf events.

Recording is automatically stopped when the buffer is full.

Definition at line 276 of file perf.cpp.