summaryrefslogtreecommitdiffstats
path: root/usr.sbin/btrace (follow)
Commit message (Collapse)AuthorAgeFilesLines
* add -n to SYNOPSIS;jmc2021-03-211-2/+2
|
* Add -n (no action) mode, which just parses the program and exits.jmatthew2021-03-212-6/+15
| | | | ok mpi@ kn@
* cast large to reduce warning on 32-bit machines (an ELF type is printed with %ll)deraadt2021-02-101-2/+2
|
* Extend binary operators support, required for more filter features.mpi2021-02-084-88/+150
| | | | Improve debugging of filters and print operator names in debug output.
* Start implementing conditionals for filters.mpi2021-02-013-36/+97
| | | | | | | | | | | | | | | | | Allows to check the existence of a variable in predicates, making it possible to trace syscall latency, as follow: syscall:select:entry { @start[pid] = nsecs; } syscall:select:return /@start[pid]/ { @usecs = hist((nsecs - @start[pid]) / 1000); delete(@start[pid]); }
* commons used rather than externs, fix for -fno-commonderaadt2021-01-271-3/+3
|
* Make it possible to convert map arguments to long and insert nsecs in maps.mpi2021-01-212-2/+9
| | | | | | | | Necessary to measure latency, example below to better understand the kqueue select(2) regression: syscall:select:entry { @start[pid] = nsecs; } syscall:select:return { @usecs = hist((nsecs - @start[pid]) / 1000); }
* Exclude the 'hz' token from the lexer backdoor, so interval and profilejmatthew2021-01-101-4/+8
| | | | | | probes can be parsed again. ok anton@ kn@
* Tracing syscalls which conflict with reserved bt(5) keywords currentlyanton2020-12-111-3/+16
| | | | | | | | | | | causes btrace to reject such programs. An example is exit which is both a syscall and a builtin btrace function. Pointed out by bluhm@ To resolve the conflict, make use of a lexer backdoor. A concept described in the original yacc paper and also found in other yacc parsers in our tree. ok bluhm@ mpi@
* In revision 1.18 of bt_parse.y, I missed the fact that the print()anton2020-12-072-7/+18
| | | | | | | function accepts an optional argument representing the number of map entries to print. ok bluhm@ mpi@
* In btrace(8) handle snprintf(3) errors correctly. If snprintfbluhm2020-12-072-19/+44
| | | | | | | | fails, buffer is unchanged; initialize it with empty string. snprintf may return negative value or the length that would have been written; check and calculate remaining size. snprintf writes size - 1 characters; pass buffer size as length. OK mpi@
* The print() function only accepts a single argument.anton2020-12-011-2/+2
| | | | ok mpi@
* fix typo in comment and trailing whitespacejasper2020-09-182-11/+11
|
* various fixes; ok mpijmc2020-09-181-18/+17
|
* document min/max/sum functionjasper2020-09-171-2/+8
| | | | ok mpi@
* consistently format/word the function documentationjasper2020-09-151-13/+13
|
* add support for '&' and '|' operators in btrace scriptsjasper2020-09-143-7/+25
| | | | | feedback from otto@ ok mpi@ kn@ semarie@
* Support '-p' a flag to filter all actions by PID.mpi2020-09-112-12/+29
|
* Be compatible with bpftrace(8)'s output when printing stack traces in maps.mpi2020-08-132-9/+10
| | | | | This allows us to use `stackcollapse-bpftrace.pl' from Brendan Gregg's FrameGraph without pre-processing outputs.
* When dealing with integers, it seems that [1] and [1, 2) are the same.mpi2020-08-131-2/+2
|
* Improve documentation.mpi2020-08-132-6/+14
|
* Do not hardcode the key length.mpi2020-08-073-7/+7
|
* Implement linear and power-of-two histograms: hist() and lhist() keywords.mpi2020-07-117-37/+359
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 |@ |
* Print the correct register for syscall return value.mpi2020-07-043-9/+15
| | | | While here make it possible to store syscall return values in maps.
* Increment line number when skipping multi-line comments.mpi2020-07-031-1/+3
|
* Fix "the symbol HZ is undefined" yacc warningkn2020-06-221-2/+2
| | | | OK mpi
* Apply rules to the number of events returned by the last read(2).mpi2020-06-181-10/+3
| | | | | | Fix a corner case where old events could be re-evaluated. From Yuichiro NAITO.
* Simplify the grammar by letting the lexer handle builtin keywords.mpi2020-04-241-110/+71
| | | | | Also clarify various constructs by using commonly understood names like 'expr' and 'vargs'.
* Print given identifier in the error message when no matching probe exist.mpi2020-04-241-3/+5
|
* Implement builtin 'cpu' keyword.mpi2020-04-235-19/+30
| | | | | | | 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.
* Extend map to support keys composed of multiple arguments.mpi2020-04-233-48/+79
| | | | | | | | | | | | | | | | | | | | | | | | | 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
* Make debug output less verbose.mpi2020-04-231-11/+10
|
* Make map functions accept a "struct map *" instead of a "struct bt_var *".mpi2020-04-153-48/+55
| | | | This is a step towards reducing the type casting crazyness.
* Document filters: one type of predicates checked in kernel.mpi2020-04-151-3/+6
| | | | | | | By default a PID filter is set by dt(4) to not record events for the tracing program. The other type of predicates, which are checked in userland, is coming soon!
* Crank key size to 256 to avoid conflicts when storing stack traces in maps.mpi2020-04-151-2/+2
|
* Stop including <machine/param.h> and <machine/vmparam.h>.mpi2020-04-151-15/+4
| | | | | | | | | | There's no need to redefine the INKERNEL() macro in userland because stacktrace_save_at() only saves kernel stack traces. If we decide to use the same interface to unwind & save userland stack traces we can simply indicate that in the "struct stacktrace". Discussed with deraadt@ and kettenis@
* btrace(8): simplify builtin_nsecs(); ok mpi@cheloha2020-03-271-9/+6
|
* Skip first line if it starts with '#!'mpi2020-03-271-3/+5
|
* Map are printed by default now, document that option "-c" is needed :)mpi2020-03-231-2/+5
|
* Some architectures require <machine/param.h> to use VM_MIN_KERNEL_ADDRESS.mpi2020-03-231-1/+2
| | | | Fix build on at least sparc64
* Document some functions.mpi2020-03-231-1/+8
|
* Print maps when exiting unless an END rule has been defined.mpi2020-03-231-1/+24
| | | | | | | | This allows to use oneliners like: # btrace -e 'profile:hz:99 { @[tid] = count(); }' ok kn@
* Document exit, zero and delete functionskn2020-03-201-5/+16
| | | | | While here, reword existing function descriptions a little. Feedback OK mpi jmc
* Use bv_name() in debug output and include the hash of a map.mpi2020-03-191-9/+10
|
* Add support for unnamed map.mpi2020-03-193-5/+20
| | | | | | | | The following is now possible but won't print anything by default: # btrace -e 'profile:hz:99 { @[kstack] = count() }' ok patrick@, tobhe@
* When looking at which data should be recorded by the kernel include thempi2020-03-191-39/+55
| | | | | | | | | | | | | key of a map. This makes map indexed by stack traces work. For example to know where the sleeps are coming from: tracepoint:sched:sleep { @map[kstack] = count(); } ok patrick@, tobhe@
* time() takes a strftime(3) format stringkn2020-03-181-4/+5
| | | | OK mpi
* Whitelist 'map' type in order to use them in real (non BEGIN/END) rules.mpi2020-03-181-1/+2
|
* Fix affectation that should be conditionnal tests inside asserts.mpi2020-03-161-5/+5
| | | | From tom@
* Implement map functions min(), max() and sum().mpi2020-01-286-18/+62
| | | | For the moment map values are currently limited to integers.