OpenBSD manual page server

Manual Page Search Parameters

BT(5) File Formats Manual BT(5)

BTBug Tracing language

probe / filter / { action }

The BT language, also known as BPFtrace syntax, describes how to format and display information gathered from specified probe events.

Events are generated by the dynamic tracer dt(4) when an enabled probe is triggered. They are periodically collected by btrace(8), which formats them using the corresponding action. If a recorded event doesn't match the optional filter it will be silently ignored.

A valid BT source file contains at least one probe clause associated with an action statement.

The list of available probes may vary from system to system and can be queried with btrace(8).

The special probes BEGIN and END may be used to manipulate states before the first event is recorded and after the last. They cannot be combined with any filter.

Define under which condition an event should be recorded when its related probe is executed. An empty filter means record all events.

Variable names available in filters:

Process ID of the current thread.
Thread ID of the current thread.

An action is a sequence of statements that are evaluated for each event recorded by the associated probe.

Variable names with special meaning:

Argument N of the corresponding probe.
Command name of the current process.
ID of the processor that recorded the event.
Kernel stack of the current thread.
Timestamp of the event in nanoseconds.
Process ID of the current thread.
Return value of the traced syscall.
Thread ID of the current thread.


Delete all (key, value) pairs from @map.
Delete the pair indexed by key from @map.
Terminate execution with exit code 0.
Increment the bucket corresponding to value in a power-of-two histogram.
(value, min, max, step)
Increment the bucket corresponding to value in the linear histogram spawning between the positive value min and max with buckets of step size.
Returns the maximum recorded value.
Returns the minimum recorded value.
Print all pairs from @map.
print(@map, n)
Print only the first n entries in @map.
(fmt, ...)
Print formatted string fmt.
Returns the sum of all recorded values.
Print timestamps using strftime(3)
Set all values from @map to 0.

awk(1), dt(4), btrace(8)

BPFtrace reference guide,

The dialect of the BT language described in this manual and supported by btrace(8) is compatible with BPFtrace. The syntax is similar to awk(1) and dtrace.

December 7, 2020 OpenBSD-current