Zth (libzth)
Loading...
Searching...
No Matches
perf.h File Reference
#include <libzth/macros.h>
#include <libzth/util.h>
#include <libzth/allocator.h>
#include <libzth/config.h>
#include <libzth/time.h>
#include <cstdio>
#include <cstdlib>
#include <cstring>

Go to the source code of this file.

Classes

struct  zth_perf_async_handle_t
 
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...
 

Namespaces

namespace  zth
 

Macros

#define zth_perf_mark(marker)
 Put a string marker into the perf output.
 
#define zth_perf_logv(fmt, args)
 Put a formatted log string into the perf output.
 
#define zth_perf_log(fmt, ...)
 Put a formatted log string into the perf output.
 
#define zth_perf_mark_async(marker, handle)
 Async-/thread-safe zth::perf_mark().
 

Typedefs

typedef void() zth_perf_done_callback_t()
 
typedef void() zth_perf_dump_callback_t(void const *, size_t)
 

Functions

int zth::perf_init ()
 Initializes the per-thread perf event buffer.
 
void zth::perf_deinit ()
 
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_logv (char const *fmt, va_list args, Timestamp const &t) noexcept
 Put a formatted log string into the perf output.
 
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_dump (zth_perf_dump_callback_t *f) noexcept
 Passes collected perf data to f.
 
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_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.
 
int zth::perf_vcd (char const *perf, char const *vcd) noexcept
 Convert a perf file into VCD.
 
int zth::perf_vcdf (FILE *perf, FILE *vcd) noexcept
 Convert a perf file into VCD.
 
void zth::perf_syscall (char const *syscall, Timestamp const &t=Timestamp()) noexcept
 Put a syscall into the perf output.
 
void zth::perf_fiber (Fiber &f) noexcept
 Write fiber ID/name to the perf buffer.
 
void zth::perf_fiber_state (Fiber &f, int state, Timestamp const &t) noexcept
 Record the current fiber state.
 
void zth_perf_start (zth_perf_done_callback_t *f=nullptr) noexcept
 Starts recording perf events.
 
void zth_perf_stop () noexcept
 Stops recording perf events.
 
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_mark_ (char const *marker) noexcept
 
void zth_perf_logv_ (char const *fmt, va_list args) noexcept
 
void zth_perf_log_ (char const *fmt,...) noexcept
 
void zth_perf_dump (zth_perf_dump_callback_t *f) noexcept
 Passes collected perf data to f.
 
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
 
int zth_perf_vcd (char const *perf=nullptr, char const *vcd=nullptr) noexcept
 Convert a perf file into VCD.
 
int zth_perf_vcdf (FILE *perf, FILE *vcd) noexcept
 Convert a perf file into VCD.
 

Typedef Documentation

◆ zth_perf_done_callback_t

typedef void() zth_perf_done_callback_t()

Definition at line 30 of file perf.h.

◆ zth_perf_dump_callback_t

typedef void() zth_perf_dump_callback_t(void const *, size_t)

Definition at line 31 of file perf.h.

Function Documentation

◆ zth_perf_log_()

void zth_perf_log_ ( char const *  fmt,
  ... 
)
noexcept

Definition at line 343 of file perf.h.

◆ zth_perf_logv_()

void zth_perf_logv_ ( char const *  fmt,
va_list  args 
)
noexcept

Definition at line 336 of file perf.h.

◆ zth_perf_mark_()

void zth_perf_mark_ ( char const *  marker)
noexcept

Definition at line 329 of file perf.h.

◆ zth_perf_mark_async_()

void zth_perf_mark_async_ ( char const *  marker,
zth_perf_async_handle_t handle 
)
noexcept

Definition at line 377 of file perf.h.