NAME
report, reportdata, reporting, reportcheck – report debugging and monitoring information

SYNOPSIS
#include <u.h>
#include <libc.h>
#include <thread.h>
#include <worker.h>
#include <error.h>
typedef struct Debugs {
char *name;
ulong val;
} Debugs;
#define report if(!Reporting){}else _report
#define reportcheck(x) (Reporting?_reportcheck(x):0)
#define reportdata if(!Reporting){}else _reportdata
void    _report(ulong event, char *, ...)
int     _reportcheck(ulong event)
void    reporting(char *eventname)
void    _reportdata(ulong event, char *name, void *addr, int size, int count)
extern int Reporting;
extern Debugs debugs[];

DESCRIPTION
Report belongs to a set of routines for conveniently printing debugging reports in an application. Its first parameter is an event type which consists of one (or more) bits in a variable that is matched against an event mask to decide whether or not to print the event.

Report and reportdata print the time (since program start, in µs) followed by the information indicated if event & eventmask is non–nil.

report takes a format string as in print(2). Reportdata prints name followed by a dump of count variables of size bytes (1, 2, 4, or 8) starting at addr.

Reportcheck returns event & eventmask.

The user–supplied debugs array gives a list of event types (typically a bit in a long int) and their names.

Reporting toggles the named event in the event mask (turning on or off printing for that reporting event).

The user–supplied integer Reporting enables or disables printing altogether.

SOURCE
/sys/src/libworker

SEE ALSO
error(2), worker(2)

AUTHOR
Sape Mullender
Copyright © 2025 Plan 9 Foundation