@@ -909,6 +909,7 @@ That would fire once for every 1000000 cache misses. This usually indicates the
...
@@ -909,6 +909,7 @@ That would fire once for every 1000000 cache misses. This usually indicates the
-`curtask` - Current task struct as a u64
-`curtask` - Current task struct as a u64
-`rand` - Random number as a u32
-`rand` - Random number as a u32
-`cgroup` - Cgroup ID of the current process
-`cgroup` - Cgroup ID of the current process
-`$1`, `$2`, ..., `$N`. - Positional parameters for the bpftrace program
Many of these are discussed in other sections (use search).
Many of these are discussed in other sections (use search).
...
@@ -1155,6 +1156,73 @@ __libc_start_main+231
...
@@ -1155,6 +1156,73 @@ __libc_start_main+231
Note that for this example to work, bash had to be recompiled with frame pointers.
Note that for this example to work, bash had to be recompiled with frame pointers.
## 9. `$1`, ..., `$N`: Positional Parameters
Syntax: `$1`, `$2`, ..., `$N`
These are the positional parameters to the bpftrace program, also referred to as command line arguments. If the parameter is numeric (entirerly digits), it can be used as a number. If it is non-numeric, it must be used as a string in the `str()` call. If a parameter is used that was not provided, it will default to zero for numeric context, and "" for string context.
This allows scripts to be written that use basic arguments to change their behavior. If you develop a script that requires more complex argument processing, it may be better suited for bcc instead, which supports Python's argparse and completely custom argument processing.