Skip to content

Commit 831a0ea

Browse files
authored
Merge pull request #2 from jordalgo/table-fixes
fix tables in doc markdown
2 parents d016f8f + 94609ad commit 831a0ea

File tree

3 files changed

+225
-225
lines changed

3 files changed

+225
-225
lines changed

docs/manpage.md

+75-75
Original file line numberDiff line numberDiff line change
@@ -939,27 +939,27 @@ The 'Kernel' column indicates the minimum kernel version required and the 'BPF H
939939

940940
| Variable | Type | Kernel | BPF Helper | Description |
941941
| --- | --- | --- | --- | --- |
942-
| [`$1`, `$2`, `...$n`](#positional-parameters) |
943-
| int64 | n/a | n/a | The nth positional parameter passed to the bpftrace program. If less than n parameters are passed this evaluates to `0`. For string arguments use the `str()` call to retrieve the value. | `$#` |
944-
| int64 | n/a | n/a | Total amount of positional parameters passed. | `arg0`, `arg1`, `...argn` |
945-
| int64 | n/a | n/a | nth argument passed to the function being traced. These are extracted from the CPU registers. The amount of args passed in registers depends on the CPU architecture. (kprobes, uprobes, usdt). | `args` |
946-
| struct args | n/a | n/a | The struct of all arguments of the traced function. Available in `tracepoint`, `fentry`, `fexit`, and `uprobe` (with DWARF) probes. Use `args.x` to access argument `x` or `args` to get a record with all arguments. | cgroup |
947-
| uint64 | 4.18 | get_current_cgroup_id | ID of the cgroup the current process belongs to. Only works with cgroupv2. | comm |
948-
| string[16] | 4.2 | get_current_comm | Name of the current thread | cpid |
949-
| uint32 | n/a | n/a | Child process ID, if bpftrace is invoked with `-c` | cpu |
950-
| uint32 | 4.1 | raw_smp_processor_id | ID of the processor executing the BPF program | curtask |
951-
| uint64 | 4.8 | get_current_task | Pointer to `struct task_struct` of the current task | elapsed |
952-
| uint64 | (see nsec) | ktime_get_ns / ktime_get_boot_ns | Nanoseconds elapsed since bpftrace initialization, based on `nsecs` | func |
953-
| string | n/a | n/a | Name of the current function being traced (kprobes,uprobes) | gid |
954-
| uint64 | 4.2 | get_current_uid_gid | Group ID of the current thread, as seen from the init namespace | jiffies |
955-
| uint64 | 5.9 | get_jiffies_64 | Jiffies of the kernel. In 32-bit system, using this builtin might be slower. | numaid |
956-
| uint32 | 5.8 | numa_node_id | ID of the NUMA node executing the BPF program | pid |
957-
| uint32 | 4.2 | get_current_pid_tgid | Process ID of the current thread (aka thread group ID), as seen from the init namespace | probe |
958-
| string | n/na | n/a | Name of the current probe | rand |
959-
| uint32 | 4.1 | get_prandom_u32 | Random number | return |
960-
| n/a | n/a | n/a | The return keyword is used to exit the current probe. This differs from exit() in that it doesn’t exit bpftrace. | retval |
961-
| uint64 | n/a | n/a | Value returned by the function being traced (kretprobe, uretprobe, fexit). For kretprobe and uretprobe, its type is `uint64`, but for fexit it depends. You can look up the type using `bpftrace -lv` | tid |
962-
| uint32 | 4.2 | get_current_pid_tgid | Thread ID of the current thread, as seen from the init namespace | uid |
942+
| [`$1`, `$2`, `...$n`](#positional-parameters) | int64 | n/a | n/a | The nth positional parameter passed to the bpftrace program. If less than n parameters are passed this evaluates to `0`. For string arguments use the `str()` call to retrieve the value.
943+
| `$#` | int64 | n/a | n/a | Total amount of positional parameters passed.
944+
| `arg0`, `arg1`, `...argn` | int64 | n/a | n/a | nth argument passed to the function being traced. These are extracted from the CPU registers. The amount of args passed in registers depends on the CPU architecture. (kprobes, uprobes, usdt).
945+
| `args` | struct args | n/a | n/a | The struct of all arguments of the traced function. Available in `tracepoint`, `fentry`, `fexit`, and `uprobe` (with DWARF) probes. Use `args.x` to access argument `x` or `args` to get a record with all arguments.
946+
| cgroup | uint64 | 4.18 | get_current_cgroup_id | ID of the cgroup the current process belongs to. Only works with cgroupv2.
947+
| comm | string[16] | 4.2 | get_current_comm | Name of the current thread
948+
| cpid | uint32 | n/a | n/a | Child process ID, if bpftrace is invoked with `-c`
949+
| cpu | uint32 | 4.1 | raw_smp_processor_id | ID of the processor executing the BPF program
950+
| curtask | uint64 | 4.8 | get_current_task | Pointer to `struct task_struct` of the current task
951+
| elapsed | uint64 | (see nsec) | ktime_get_ns / ktime_get_boot_ns | Nanoseconds elapsed since bpftrace initialization, based on `nsecs`
952+
| func | string | n/a | n/a | Name of the current function being traced (kprobes,uprobes)
953+
| gid | uint64 | 4.2 | get_current_uid_gid | Group ID of the current thread, as seen from the init namespace
954+
| jiffies | uint64 | 5.9 | get_jiffies_64 | Jiffies of the kernel. In 32-bit system, using this builtin might be slower.
955+
| numaid | uint32 | 5.8 | numa_node_id | ID of the NUMA node executing the BPF program
956+
| pid | uint32 | 4.2 | get_current_pid_tgid | Process ID of the current thread (aka thread group ID), as seen from the init namespace
957+
| probe | string | n/na | n/a | Name of the current probe
958+
| rand | uint32 | 4.1 | get_prandom_u32 | Random number |
959+
return | n/a | n/a | n/a | The return keyword is used to exit the current probe. This differs from exit() in that it doesn’t exit bpftrace.
960+
| retval | uint64 | n/a | n/a | Value returned by the function being traced (kretprobe, uretprobe, fexit). For kretprobe and uretprobe, its type is `uint64`, but for fexit it depends. You can look up the type using `bpftrace -lv`
961+
| tid | uint32 | 4.2 | get_current_pid_tgid | Thread ID of the current thread, as seen from the init namespace
962+
| uid | uint64 | 4.2 | get_current_uid_gid | User ID of the current thread, as seen from the init namespace
963963

964964
### Positional Parameters
965965

@@ -1047,42 +1047,42 @@ Tracing block I/O sizes > 0 bytes
10471047

10481048
| Function Name | Description | Sync/Async/Compile Time |
10491049
| --- | --- | --- |
1050-
| `bswap(uint[8 \| 16 \| 32 \| 64] n)` | Reverse byte order | Sync | [`buf(void *d [, int length](#buf))`] |
1051-
| Returns a hex-formatted string of the data pointed to by d | Sync | [`cat(char *filename)`](#cat) |
1052-
| Print file content | Async | [`cgroupid(char *path)`](#cgroupid) |
1053-
| Resolve cgroup ID | Compile Time | [`cgroup_path(int cgroupid, string filter)`](#cgroup_path) |
1054-
| Convert cgroup id to cgroup path | Sync | [`exit([int code](#exit))`] |
1055-
| Quit bpftrace with an optional exit code | Async | [`join(char *arr[join](#join) [, char *delim])`] |
1056-
| Print the array | Async | [`kaddr(char *name)`](#kaddr) |
1057-
| Resolve kernel symbol name | Compile Time | [`kptr(void *p)`](#kptr) |
1058-
| Annotate as kernelspace pointer | Sync | [`kstack([StackMode mode, ](#kstack)[int level])`] |
1059-
| Kernel stack trace | Sync | [`ksym(void *p)`](#ksym) |
1060-
| Resolve kernel address | Async | [`macaddr(char[6](#macaddr) addr)`] |
1061-
| Convert MAC address data | Sync | [`nsecs([TimestampMode mode](#nsecs))`] |
1062-
| Timestamps and Time Deltas | Sync | <<functions-ntop, `ntop([int af, ]int\ |
1063-
| char[4\ | 16] addr)`>> | Convert IP address data to text |
1064-
| Sync | [`offsetof(struct, element)`](#offsetof) | Offset of element in structure |
1065-
| Compile Time | [`override(u64 rc)`](#override) | Override return value |
1066-
| Sync | [`path(struct path *path [, int32 size](#path))`] | Return full path |
1067-
| Sync | [`percpu_kaddr(const string name [, int cpu](#percpu_kaddr))`] | Resolve percpu kernel symbol name |
1068-
| Sync | [`print(...)`](#print) | Print a non-map value with default formatting |
1069-
| Async | [`printf(char *fmt, ...)`](#printf) | Print formatted |
1070-
| Async | [`pton(const string *addr)`](#pton) | Convert text IP address to byte array |
1071-
| Compile Time | [`reg(char *name)`](#reg) | Returns the value stored in the named register |
1072-
| Sync | [`signal(char[signal](#signal) signal \ | u32 signal)`] |
1073-
| Send a signal to the current process | Sync | [`sizeof(...)`](#sizeof) |
1074-
| Return size of a type or expression | Sync | [`skboutput(const string p, struct sk_buff *s, ...)`](#skboutput) |
1075-
| Write skb 's data section into a PCAP file | Async | [`str(char *s [, int length](#str))`] |
1076-
| Returns the string pointed to by s | Sync | [`strcontains(const char *haystack, const char *needle)`](#strcontains) |
1077-
| Compares whether the string haystack contains the string needle. | Sync | [`strerror(uint64 error)`](#strerror) |
1078-
| Get error message for errno code | Sync | [`strftime(char *format, int nsecs)`](#strftime) |
1079-
| Return a formatted timestamp | Async | [`strncmp(char *s1, char *s2, int length)`](#strncmp) |
1080-
| Compare first n characters of two strings | Sync | [`system(char *fmt)`](#system) |
1081-
| Execute shell command | Async | [`time(char *fmt)`](#time) |
1082-
| Print formatted time | Async | [`uaddr(char *name)`](#uaddr) |
1083-
| Resolve user-level symbol name | Compile Time | [`uptr(void *p)`](#uptr) |
1084-
| Annotate as userspace pointer | Sync | [`ustack([StackMode mode, ](#ustack)[int level])`] |
1085-
| User stack trace | Sync | [`usym(void *p)`](#usym) |
1050+
| [`bswap(uint[8 \| 16 \| 32 \| 64] n)`](#bswap) | Reverse byte order | Sync
1051+
| [`buf(void *d [, int length])`](#buf) | Returns a hex-formatted string of the data pointed to by d | Sync
1052+
| [`cat(char *filename)`](#cat) | Print file content | Async
1053+
| [`cgroupid(char *path)`](#cgroupid) | Resolve cgroup ID | Compile Time
1054+
| [`cgroup_path(int cgroupid, string filter)`](#cgroup_path) | Convert cgroup id to cgroup path | Sync
1055+
| [`exit([int code])`](#exit) | Quit bpftrace with an optional exit code | Async
1056+
| [`join(char *arr[] [, char *delim])`](#join) | Print the array | Async
1057+
| [`kaddr(char *name)`](#kaddr) | Resolve kernel symbol name | Compile Time
1058+
| [`kptr(void *p)`](#kptr) | Annotate as kernelspace pointer | Sync
1059+
| [`kstack([StackMode mode, ][int level])`](#kstack) | Kernel stack trace | Sync
1060+
| [`ksym(void *p)`](#ksym) | Resolve kernel address | Async
1061+
| [`macaddr(char[6] addr)`](#macaddr) | Convert MAC address data | Sync
1062+
| [`nsecs([TimestampMode mode])`](#nsecs) | Timestamps and Time Deltas | Sync
1063+
| [`ntop([int af, ]int\|char[4 \| 16] addr)`](#ntop) | Convert IP address data to text | Sync
1064+
| [`offsetof(struct, element)`](#offsetof) | Offset of element in structure | Compile Time
1065+
| [`override(u64 rc)`](#override) | Override return value | Sync
1066+
| [`path(struct path *path [, int32 size])`](#path) | Return full path | Sync
1067+
| [`percpu_kaddr(const string name [, int cpu])`](#percpu_kaddr) | Resolve percpu kernel symbol name | Sync
1068+
| [`print(...)`](#print) | Print a non-map value with default formatting | Async
1069+
| [`printf(char *fmt, ...)`](#printf) | Print formatted | Async
1070+
| [`pton(const string *addr)`](#pton) | Convert text IP address to byte array | Compile Time
1071+
| [`reg(char *name)`](#reg) | Returns the value stored in the named register | Sync
1072+
| [`signal(char[signal] signal \| u32 signal)`](#signal) | Send a signal to the current process | Sync
1073+
| [`sizeof(...)`](#sizeof) | Return size of a type or expression | Sync
1074+
| [`skboutput(const string p, struct sk_buff *s, ...)`](#skboutput) | Write skb 's data section into a PCAP file | Async
1075+
| [`str(char *s [, int length])`](#str) | Returns the string pointed to by s | Sync
1076+
| [`strcontains(const char *haystack, const char *needle)`](#strcontains) | Compares whether the string haystack contains the string needle. | Sync
1077+
| [`strerror(uint64 error)`](#strerror) | Get error message for errno code | Sync
1078+
| [`strftime(char *format, int nsecs)`](#strftime) | Return a formatted timestamp | Async
1079+
| [`strncmp(char *s1, char *s2, int length)`](#strncmp) | Compare first n characters of two strings | Sync
1080+
| [`system(char *fmt)`](#system) | Execute shell command | Async
1081+
| [`time(char *fmt)`](#time) | Print formatted time | Async
1082+
| [`uaddr(char *name)`](#uaddr) | Resolve user-level symbol name | Compile Time
1083+
| [`uptr(void *p)`](#uptr) | Annotate as userspace pointer | Sync
1084+
| [`ustack([StackMode mode, ][int level])`](#ustack) | User stack trace | Sync
1085+
| [`usym(void *p)`](#usym) | Resolve user space address | Async
10861086

10871087
Functions that are marked **async** are asynchronous which can lead to unexpected behaviour, see the [Invocation Mode](#invocation-mode) section for more information.
10881088

@@ -1806,7 +1806,7 @@ dropped privs to tcpdump
18061806
The maximum string length is limited by the `BPFTRACE_MAX_STRLEN` env variable, unless `length` is specified and shorter than the maximum.
18071807
In case the string is longer than the specified length only `length - 1` bytes are copied and a NULL byte is appended at the end.
18081808

1809-
When available (starting from kernel 5.5, see the `--info` flag) bpftrace will automatically use the `kernel` or `user` variant of `probe_read_{kernel,user}_str` based on the address space of `data`, see [Address-spaces](#Address-spaces) for more information.
1809+
When available (starting from kernel 5.5, see the `--info` flag) bpftrace will automatically use the `kernel` or `user` variant of `probe_read_{kernel,user}_str` based on the address space of `data`, see [Address-spaces](#address-spaces) for more information.
18101810

18111811
### strcontains
18121812

@@ -2108,21 +2108,21 @@ Functions that are marked **async** are asynchronous which can lead to unexpecte
21082108

21092109
See [Advanced Topics](#advanced-topics) for more information on [Map Printing](#map-printing).
21102110

2111-
| Function Name |
2111+
| Function Name | Description | Sync/async |
21122112
| --- | --- | --- |
2113-
| Description | Sync/async | [`avg(int64 n)`](#avg) |
2114-
| Calculate the running average of `n` between consecutive calls. | Sync | [`clear(map m)`](#clear) |
2115-
| Clear all keys/values from a map. | Async | [`count()`](#count) |
2116-
| Count how often this function is called. | Sync | [`delete(map m, mapkey k)`](#delete) |
2117-
| Delete a single key from a map. | Sync | [`has_key(map m, mapkey k)`](#has_key) |
2118-
| Return true (1) if the key exists in this map. Otherwise return false (0). | Sync | [`hist(int64 n[, int k](#hist))`] |
2119-
| Create a log2 histogram of n using buckets per power of 2, 0 <= k <= 5, defaults to 0. | Sync | [`len(map m)`](#len) |
2120-
| Return the number of elements in a map. | Sync | [`lhist(int64 n, int64 min, int64 max, int64 step)`](#lhist) |
2121-
| Create a linear histogram of n. lhist creates M ((max - min) / step) buckets in the range [min,max) where each bucket is step in size. | Sync | [`max(int64 n)`](#max) |
2122-
| Update the map with n if n is bigger than the current value held. | Sync | [`min(int64 n)`](#min) |
2123-
| Update the map with n if n is smaller than the current value held. | Sync | [`stats(int64 n)`](#stats) |
2124-
| Combines the count, avg and sum calls into one. | Sync | [`sum(int64 n)`](#sum) |
2125-
| Calculate the sum of all n passed. | Sync | [`zero(map m)`](#zero) |
2113+
| [`avg(int64 n)`](#avg) | Calculate the running average of `n` between consecutive calls. | Sync
2114+
| [`clear(map m)`](#clear) | Clear all keys/values from a map. | Async
2115+
| [`count()`](#count) | Count how often this function is called. | Sync
2116+
| [`delete(map m, mapkey k)`](#delete) | Delete a single key from a map. | Sync
2117+
| [`has_key(map m, mapkey k)`](#has_key) | Return true (1) if the key exists in this map. Otherwise return false (0). | Sync
2118+
| [`hist(int64 n[, int k])`](#hist) | Create a log2 histogram of n using buckets per power of 2, 0 <= k <= 5, defaults to 0. | Sync
2119+
| [`len(map m)`](#len) | Return the number of elements in a map. | Sync
2120+
| [`lhist(int64 n, int64 min, int64 max, int64 step)`](#lhist) | Create a linear histogram of n. lhist creates M ((max - min) / step) buckets in the range [min,max) where each bucket is step in size. | Sync
2121+
| [`max(int64 n)`](#max) | Update the map with n if n is bigger than the current value held. | Sync
2122+
| [`min(int64 n)`](#min) | Update the map with n if n is smaller than the current value held. | Sync
2123+
| [`stats(int64 n)`](#stats) | Combines the count, avg and sum calls into one. | Sync
2124+
| [`sum(int64 n)`](#sum) | Calculate the sum of all n passed. | Sync
2125+
| [`zero(map m)`](#zero) | Set all values for all keys to zero. | Async
21262126

21272127
### avg
21282128

@@ -2504,7 +2504,7 @@ Most providers also support a short name which can be used instead of the full n
25042504
| | | | |
25052505
| --- | --- | --- | --- |
25062506
| **Probe Name** | **Short Name** | **Description** | **Kernel/User Level** |
2507-
| [`BEGIN/END`](#begin/end) | - | Built-in events | Kernel/User |
2507+
| [`BEGIN/END`](#beginend) | - | Built-in events | Kernel/User |
25082508
| [`self`](#self) | - | Built-in events | Kernel/User |
25092509
| [`hardware`](#hardware) | `h` | Processor-level events | Kernel |
25102510
| [`interval`](#interval) | `i` | Timed output | Kernel/User |
@@ -2515,7 +2515,7 @@ Most providers also support a short name which can be used instead of the full n
25152515
| [`rawtracepoint`](#rawtracepoint) | `rt` | Kernel static tracepoints with raw arguments | Kernel |
25162516
| [`software`](#software) | `s` | Kernel software events | Kernel |
25172517
| [`tracepoint`](#tracepoint) | `t` | Kernel static tracepoints | Kernel |
2518-
| [`uprobe/uretprobe`](#uprobe,-uretprobe) | `u`/`ur` | User-level function start/return | User |
2518+
| [`uprobe/uretprobe`](#uprobe-uretprobe) | `u`/`ur` | User-level function start/return | User |
25192519
| [`usdt`](#usdt) | `U` | User-level static tracepoints | User |
25202520
| [`watchpoint/asyncwatchpoint`](#watchpoint-and-asyncwatchpoint) | `w`/`aw` | Memory watchpoints | Kernel |
25212521

@@ -3516,7 +3516,7 @@ BEGIN { @=*uptr(kaddr("do_poweroff")) }
35163516
```
35173517
35183518
bpftrace tries to automatically set the correct address space for a pointer based on the probe type, but might fail in cases where it is unclear.
3519-
The address space can be changed with the [kptrs](#kptr) and [uptr](#functios-uptr) functions.
3519+
The address space can be changed with the [kptrs](#kptr) and [uptr](#uptr) functions.
35203520
35213521
### BTF Support
35223522

0 commit comments

Comments
 (0)