Age | Commit message (Collapse) | Author |
|
From Christian Ludwig
|
|
From Christian Ludwig.
|
|
From Christian Ludwig cludwig at genua.de.
|
|
partly checked by millert@
|
|
found by smatch, ok mpi@
|
|
Statement lists for if & else conditions are now wrapped in a new
'struct bt_cond'. Handling B_AC_TEST statements moved to stmt_eval()
to handle nested conditional statements.
From Christian Ludwig christian_ludwig at genua.de
|
|
Currently, every kelf_snprintsym() call performs a linear search
through the .symtab for a symbol matching the given PC. The search is
expensive and seems to be a major source of dropped profiling events.
Storing all STT_FUNC .symtab entries and their names in a sorted array
cuts search time from O(n) to O(lg n). In practice, the faster
lookups seem to dramatically reduce the profiling drop rate.
With tweaks from mpi@.
Thread: https://marc.info/?l=openbsd-tech&m=170830125132105&w=2
ok mpi@
|
|
"No it's not okay." mpi@
|
|
Currently, every kelf_snprintsym() call performs a linear search
through the .symtab for a matching symbol. The search is very
costly and causes btrace(8) to drop a lot of profiling events.
Storing the STT_FUNC .symtab entries and their corresponding .strtab
entries in a sorted array cuts the lookup cost from O(n) to O(lg n).
Lower overhead reduces the drop rate for profiling events.
With tweaks from mpi@.
Thread: https://marc.info/?l=openbsd-tech&m=170830125132105&w=2
probably ok mpi@
|
|
|
|
|
|
Allow to save stacktrace and process name in tuples.
|
|
A current limitation is the value read from a map is converted to an
integer. To preserve the original type we have to make maps aware of
the type of its elements.
|
|
|
|
|
|
|
|
|
|
From Christian Ludwig.
|
|
Adapted from a fix from Christian Ludwig.
|
|
Previously only the first element of the tuple was considered. This led to
the introduction of new map entries.
Reported by Christian Ludwig.
|
|
the error handling of strange variable names can be better controlled.
With and OK dv@
|
|
Changes number tokenizing and parsing to support hex & octal values.
Does not address other lexer issues (e.g. $0x1) to close gaps with
bpftrace.
OK claudio@
|
|
ok claudio@
|
|
|
|
BPFTrace's exit() statement executes the END probe (if any) and prints
the contents of all non-empty maps before terminating the interpreter.
Implement this in btrace(8) with a halting check after each statement.
If a statement causes the program to halt, the condition bubbles up to
the top-level evaluation loop and causes rules_teardown() to run
immediately.
btrace(8) still performs a full rules_setup() if exit() is called
during the BEGIN probe, though the top-level evaluation loop is never
run.
One edge-like case: an exit() from the END probe is treated as an
early return; END is not executed multiple times.
Thread: https://marc.info/?l=openbsd-tech&m=169765169420751&w=2
ok mpi@
|
|
Link: https://marc.info/?l=openbsd-tech&m=169695435209410&w=2
ok mpi@
|
|
|
|
OK mpi@
|
|
Somehow missed in previous, regression reported by anton@.
|
|
It is now possible to save and print immutable arrays as below:
..$t = (1, 42, "something");
..printf("%d %s\n", $t.1, $t.2);
Also add support for evaluating builtin in order to save them in variables
(required by tuples)
|
|
ok dv@
|
|
Allows for probes like `BEGIN {}`, in parity with bpftrace.
Also fixes an incorrect syntax error parsing argN builtins in
subsequent probes after an empty BEGIN block.
ok mpi@
|
|
Resolves segfaults when using probe within BEGIN or END.
ok mpi@
|
|
The argN builtins are undefined for BEGIN and END special probes.
Similar to bpftrace, produce an error from the parser.
Adds a regress test, as well.
ok mpi@
|
|
Talking with mpi@, going to rework this to be part of the parser.
Reverts commit 0iIzGtIFgBXVfbNa.
|
|
The argN builtins aren't valid in BEGIN or END actions. The fake
probe number btrace uses to facilitate other valid builtins caused
an out of bound read of an array, producing a segfault.
Change the fake probe number to 0 as it's an unsigned int and check
for that condition.
Adds asserts near other probe array indexing to catch future issues.
ok kn@
|
|
Define the STR symbol, used for the str function.
Tune the grammar, simplifying the 'pat' rule to 'expr'. Resolves
the reduce conflicts related to 'pat' and 'factor' both matching a
lone CSTRING token.
ok mpi@
|
|
|
|
Freeing arguments tied to statements is not an option because rules are
parsed multiple times. Always make a copy of them if they are assigned
to a key in a map.
|
|
ok claudio@
|
|
Additionally fix the bacmp() function to work on integers and strings.
bacmp() is used when maps are printed out since the output is sorted by value.
Also adjust the rule parser to look into correctly into if branches to figure
out which values to request from the kernel.
OK kn@
|
|
part of the bt.5 man page.
Input and OK kn@
|
|
This only works for a single static binary where everything was compiled
with -fno-omit-frame-pointer since the stack unwinder requires the
frame-pointer.
A possible btrace script to capture performace of a single process is:
profile:hz:100 / pid == $1 / {
@[ustack] = count();
}
Then using btrace -p program uprofile.bt `pgrep program` will collect
the information for program.
This is far from perfect but should allow other people to play with this
and hopefully improve work.
OK mpi@
|
|
from the kernel. Add them to a cache when needed, and print them
with btrace -l. If the argument is of type int, print the value
as %d signed integer. This gives pretty output for refcnt changes.
All other types still use %ul.
The probe and argument number can be used as array index. Remove
the qsort and search for probe number to simplify the code. Use
array index for both probes and argument types.
OK mpi@
|
|
any parts of his diff not taken are noted on tech
|
|
A few programs used the plural in their synopsis which doesn't read as
clear as the obvious triple-dot notation.
mdoc(7) .Ar defaults to "file ..." if no arguments are given and consistent
use of 'arg ...' matches that behaviour.
Cleanup a few markups of the same argument so the text keeps reading
naturally; omit unhelpful parts like 'if optional arguments are given,
they are passed along' for tools like time(1) and timeout(1) that obviously
execute commands with whatever arguments where given -- just like doas(1)
which doesn't mention arguments in its DESCRIPTION in the first place.
For expr(1) the difference between 'expressions' and 'expression ...' is
crucial, as arguments must be passed as individual words.
Feedback millert jmc schwarze deraadt
OK jmc
|
|
It is now possible to filter by process name, like:
syscall:mmap:entry
/comm == "ld"/
{
...
}
Currently the parser treats C-string like any other expression member even
if arithmetic operations do no apply to strings.
|
|
|
|
|
|
|