summaryrefslogtreecommitdiff
path: root/usr.sbin/btrace
AgeCommit message (Collapse)Author
2021-03-21add -n to SYNOPSIS;Jason McIntyre
2021-03-21Add -n (no action) mode, which just parses the program and exits.Jonathan Matthew
ok mpi@ kn@
2021-02-10cast large to reduce warning on 32-bit machines (an ELF type is printed with ↵Theo de Raadt
%ll)
2021-02-08Extend binary operators support, required for more filter features.Martin Pieuchot
Improve debugging of filters and print operator names in debug output.
2021-02-01Start implementing conditionals for filters.Martin Pieuchot
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]); }
2021-01-27commons used rather than externs, fix for -fno-commonTheo de Raadt
2021-01-21Make it possible to convert map arguments to long and insert nsecs in maps.Martin Pieuchot
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); }
2021-01-10Exclude the 'hz' token from the lexer backdoor, so interval and profileJonathan Matthew
probes can be parsed again. ok anton@ kn@
2020-12-11Tracing syscalls which conflict with reserved bt(5) keywords currentlyanton
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@
2020-12-07In revision 1.18 of bt_parse.y, I missed the fact that the print()anton
function accepts an optional argument representing the number of map entries to print. ok bluhm@ mpi@
2020-12-07In btrace(8) handle snprintf(3) errors correctly. If snprintfAlexander Bluhm
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@
2020-12-01The print() function only accepts a single argument.anton
ok mpi@
2020-09-18fix typo in comment and trailing whitespaceJasper Lievisse Adriaanse
2020-09-18various fixes; ok mpiJason McIntyre
2020-09-17document min/max/sum functionJasper Lievisse Adriaanse
ok mpi@
2020-09-15consistently format/word the function documentationJasper Lievisse Adriaanse
2020-09-14add support for '&' and '|' operators in btrace scriptsJasper Lievisse Adriaanse
feedback from otto@ ok mpi@ kn@ semarie@
2020-09-11Support '-p' a flag to filter all actions by PID.Martin Pieuchot
2020-08-13Be compatible with bpftrace(8)'s output when printing stack traces in maps.Martin Pieuchot
This allows us to use `stackcollapse-bpftrace.pl' from Brendan Gregg's FrameGraph without pre-processing outputs.
2020-08-13When dealing with integers, it seems that [1] and [1, 2) are the same.Martin Pieuchot
2020-08-13Improve documentation.Martin Pieuchot
2020-08-07Do not hardcode the key length.Martin Pieuchot
2020-07-11Implement linear and power-of-two histograms: hist() and lhist() keywords.Martin Pieuchot
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 |@ |
2020-07-04Print the correct register for syscall return value.Martin Pieuchot
While here make it possible to store syscall return values in maps.
2020-07-03Increment line number when skipping multi-line comments.Martin Pieuchot
2020-06-22Fix "the symbol HZ is undefined" yacc warningkn
OK mpi
2020-06-18Apply rules to the number of events returned by the last read(2).Martin Pieuchot
Fix a corner case where old events could be re-evaluated. From Yuichiro NAITO.
2020-04-24Simplify the grammar by letting the lexer handle builtin keywords.Martin Pieuchot
Also clarify various constructs by using commonly understood names like 'expr' and 'vargs'.
2020-04-24Print given identifier in the error message when no matching probe exist.Martin Pieuchot
2020-04-23Implement builtin 'cpu' keyword.Martin Pieuchot
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.
2020-04-23Extend map to support keys composed of multiple arguments.Martin Pieuchot
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
2020-04-23Make debug output less verbose.Martin Pieuchot
2020-04-15Make map functions accept a "struct map *" instead of a "struct bt_var *".Martin Pieuchot
This is a step towards reducing the type casting crazyness.
2020-04-15Document filters: one type of predicates checked in kernel.Martin Pieuchot
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!
2020-04-15Crank key size to 256 to avoid conflicts when storing stack traces in maps.Martin Pieuchot
2020-04-15Stop including <machine/param.h> and <machine/vmparam.h>.Martin Pieuchot
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@
2020-03-27btrace(8): simplify builtin_nsecs(); ok mpi@cheloha
2020-03-27Skip first line if it starts with '#!'Martin Pieuchot
2020-03-23Map are printed by default now, document that option "-c" is needed :)Martin Pieuchot
2020-03-23Some architectures require <machine/param.h> to use VM_MIN_KERNEL_ADDRESS.Martin Pieuchot
Fix build on at least sparc64
2020-03-23Document some functions.Martin Pieuchot
2020-03-23Print maps when exiting unless an END rule has been defined.Martin Pieuchot
This allows to use oneliners like: # btrace -e 'profile:hz:99 { @[tid] = count(); }' ok kn@
2020-03-20Document exit, zero and delete functionskn
While here, reword existing function descriptions a little. Feedback OK mpi jmc
2020-03-19Use bv_name() in debug output and include the hash of a map.Martin Pieuchot
2020-03-19Add support for unnamed map.Martin Pieuchot
The following is now possible but won't print anything by default: # btrace -e 'profile:hz:99 { @[kstack] = count() }' ok patrick@, tobhe@
2020-03-19When looking at which data should be recorded by the kernel include theMartin Pieuchot
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@
2020-03-18time() takes a strftime(3) format stringkn
OK mpi
2020-03-18Whitelist 'map' type in order to use them in real (non BEGIN/END) rules.Martin Pieuchot
2020-03-16Fix affectation that should be conditionnal tests inside asserts.Martin Pieuchot
From tom@
2020-01-28Implement map functions min(), max() and sum().Martin Pieuchot
For the moment map values are currently limited to integers.