#
58afdee7 |
| 08-Sep-2021 |
dv <dv@openbsd.org> |
btrace(8): add initial support for cli arguments
This adds initial support for passing cli args to btrace(8) for use in bt(5) scripts. Similar to bpftrace, they are referenced via $1, $2, etc. with
btrace(8): add initial support for cli arguments
This adds initial support for passing cli args to btrace(8) for use in bt(5) scripts. Similar to bpftrace, they are referenced via $1, $2, etc. with $# being the number of command line arguments provided.
Adds an initial regress test and a Makefile change to allow providing arguments to regress tests in a .args file.
Currently no limit is imposed on the number of arguments, keeping a similar approach as observed in bpftrace. References to undefined arguments result in a new "nil" type that contextually acts as a zero or empty string. More work can be done here to improve bpftrace compatibility.
ok mpi@, jasper@
show more ...
|
#
89f39301 |
| 31-Aug-2021 |
mpi <mpi@openbsd.org> |
Rewrite grammar to implement operator precedence without using %right or %prec.
Arithmetic operator should now behave as expeted and tests can now be written without superfluous parenthesis, for exa
Rewrite grammar to implement operator precedence without using %right or %prec.
Arithmetic operator should now behave as expeted and tests can now be written without superfluous parenthesis, for example:
syscall:select:entry /($1 == 0) || (pid == $1)/ { }
Can now be written:
syscall:select:entry /$1 == 0 || pid == $1/ { }
While here improve filter debugging support.
show more ...
|
#
7aa3827d |
| 21-Apr-2021 |
mpi <mpi@openbsd.org> |
Support for local (scratch) variables: "$var_name".
Every rule gets its own list of (local) variables.
|
#
6ca6ae3f |
| 21-Apr-2021 |
mpi <mpi@openbsd.org> |
Support first shell argument as $1 in order to use it in filters.
Remove '-p' option now that scripts can filter by pid/tid.
|
#
9c84395d |
| 11-Jul-2020 |
mpi <mpi@openbsd.org> |
Implement linear and power-of-two histograms: hist() and lhist() keywords.
This is built on top of maps which are currently built on top of RB-trees. Improvements are welcome! For example the use o
Implement linear and power-of-two histograms: hist() and lhist() keywords.
This is built on top of maps which are currently built on top of RB-trees. Improvements are welcome! For example the use of a hashing table as pointed by espie@.
The following one-liner produce an histogram of power-of-two values returned by the read(2) syscall:
btrace 'syscall:read:return { @bytes = hist(retval); }' ^C @bytes: [0] 19 |@@@@@@@@@@@@@@@@@@@@@@@@@@ | [1] 26 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ | [1, 2) 1 |@ | [2, 4) 13 |@@@@@@@@@@@@@@@@@@ | [4, 8) 4 |@@@@@ | [8, 16) 3 |@@@@ | [16, 32) 1 |@ | [32, 64) 8 |@@@@@@@@@@@ | [64, 128) 14 |@@@@@@@@@@@@@@@@@@@ | [128, 256) 7 |@@@@@@@@@ | [256, 512) 37 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| [512, 1K) 1 |@ | [1K, 2K) 10 |@@@@@@@@@@@@@@ | [2K, 4K) 11 |@@@@@@@@@@@@@@@ | [8K, 16K) 1 |@ |
show more ...
|
#
0948ba6c |
| 23-Apr-2020 |
mpi <mpi@openbsd.org> |
Implement builtin 'cpu' keyword.
This is useful to know which CPU recorded a given event.
While here document 'retval' and comment out 'ustack' until we have a way to capture userland stacks.
|
#
6f386ca5 |
| 23-Apr-2020 |
mpi <mpi@openbsd.org> |
Extend map to support keys composed of multiple arguments.
Keys are still strings representing the output value.
The following example is now possible to count the number of "on CPU" events ordered
Extend map to support keys composed of multiple arguments.
Keys are still strings representing the output value.
The following example is now possible to count the number of "on CPU" events ordered by thread ID and executable name:
# btrace -e 'tracepoint:sched:on__cpu { @[tid, comm] = count() }' ^C @[138836, idle0]: 830941 @[161307, sshd]: 716476 @[482901, softnet]: 582008 @[104443, systqmp]: 405749 @[269230, update]: 396133 @[326533, softclock]: 316926 @[61040, sshd]: 177201 @[453567, reaper]: 119676 @[446052, ksh]: 85675 @[26270, syslogd]: 66625 @[504699, sshd]: 52958 @[446052, sshd]: 32207 @[44046, tset]: 13333 @[162960, zerothread]: 101 @[313046, ntpd]: 1
show more ...
|
#
7828ed3f |
| 23-Mar-2020 |
mpi <mpi@openbsd.org> |
Map are printed by default now, document that option "-c" is needed :)
|
#
0dac42ec |
| 28-Jan-2020 |
mpi <mpi@openbsd.org> |
Implement map functions min(), max() and sum().
For the moment map values are currently limited to integers.
|
#
88be68db |
| 28-Jan-2020 |
mpi <mpi@openbsd.org> |
Implement delete() and @map[key] access.
|
#
a378a2aa |
| 27-Jan-2020 |
mpi <mpi@openbsd.org> |
Implement builtin time() function.
|
#
f85dfe3a |
| 21-Jan-2020 |
mpi <mpi@openbsd.org> |
Some remaining items for the curious.
|