monitor: Search the frames with a pager
Status from this message: This series was applied to bluetooth/bluez.git (master)
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v2 Latest9 patches 1 replyApplied
- v16 patches 1 replySuperseded
Changes in v2 from the cover letter
- Added the three unrelated fixes as patches 1 to 3. The trailing space is its own patch so that patch 4 stays a pure redirection.
- Rewrapped the lines that went over 80 columns, which the rename to display_printf() pushed past the limit.
- Dropped the NULL initialiser on the static output stream, removed the trailing semicolon from the print_space() macro and used ARRAY_SIZE().
Patches in v2 Applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/9 | monitor/analyze: Free the channel latency plotsmonitor/ monitor/ | +6 | 1 reply | |
| 2/9 | monitor/l2cap: Report the channel latency deviationmonitor/ | +0 | 0 replies | |
| 3/9 | monitor/analyze: Drop a trailing space before a newlinemonitor/ | +1 | 0 replies | |
| 4/9 | monitor: Route the decoding output through a single functionmonitor/ monitor/ monitor/ +8 more | +225 | 0 replies | |
| 5/9 | monitor: Separate the frames for a pager reading recordsMakefile.tools monitor/ monitor/ +2 more | +177 | 0 replies | |
| 6/9 | monitor: Hand the captured frames to the pager on Ctrl-Rmonitor/ monitor/ monitor/ | +463 | 0 replies | |
| 7/9 | doc/btmon: Document searching the framesdoc/ | +53 | 0 replies | |
| 8/9 | monitor: Prefer fzf as the pager when one is not setmonitor/ monitor/ monitor/ +2 more | +134 | 0 replies | |
| 9/9 | doc/btmon: Document the pager choicedoc/ | +14 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.
Cover letter [PATCH BlueZ v2 0/9] monitor: Search the frames with a pager
From: Luiz Augusto von Dentz <[email protected]>
A frame spans several lines, and what identifies one is spread between its header and its contents: the header says which controller and when, the body says what happened. Searching a trace a line at a time finds the line reporting an error without any of that context.
This series makes the frames searchable as whole entries:
$ btmon # then press Ctrl-R $ btmon -r hcidump.log $ btmon -r hcidump.log --print0 | fzf --read0
Patches 1 to 3 are unrelated fixes noticed on the way: a channel leaks its latency plots, the channel latency is the only one of the three not reporting its deviation, and a count of control messages is printed with a stray space at the end of the line.
Patch 4 sends the decoding output through one function so that a frame can be observed as a whole. It is a pure redirection and the output is unchanged.
Patch 5 separates the frames with a NUL when something is going to read them as records, asked for by --print0 or by --read0 already being in PAGER. Nothing is separated otherwise, so a pager reading lines and redirected output are both untouched.
Patches 6 and 7 hand the frames seen so far to the pager on Ctrl-R while capturing. The capture is never paused for this, as anything not read in time is dropped by the kernel, and whatever arrives while the pager is up is printed once it closes so the trace on the terminal has no gap.
Patches 8 and 9 use fzf when PAGER is not set and it is installed, since it suits a trace far better than a plain pager, giving it --ansi, --read0 and --tac wherever it is used.
Recordings of both, which expire after a week:
reading a file https://asciinema.org/a/FEetnoeF5H6NNOmZ
a running capture https://asciinema.org/a/pGZpLhPlJFPyO4I3
The first one searches a 39 frame trace of two LE connections:
'ATT: every ATT frame 19 of 39 'SMP: the pairing exchange 4 'L2CAP: the signalling 2 '0x0025 every frame touching that GATT handle 5 'ATT: 'Write two terms, both must match 2 'ATT: !'Error everything ATT except the failures 15 'Handle\ 65 just the second connection 4 '#20 one frame, by its number 1
A leading quote is an exact match, a space separates terms that must all match, and ! inverts one. Matching itself has no regex, but --delimiter is one, and with a newline as the delimiter every line of a frame becomes a field, so a search can be aimed at the header or at the contents:
whole frame header only body only
'Handle\ 64 21 21 0 '#20 1 1 0 '0x0025 5 0 5
'ATT: 19 0 19
A frame number or a connection only ever appears in the header, and a GATT handle or a protocol only inside.
The second recording shows Ctrl-R during a capture: the frames seen so far are handed over, the capture keeps running underneath, and what arrived meanwhile is printed on return.
Changes in v2:
- Added the three unrelated fixes as patches 1 to 3. The trailing space is its own patch so that patch 4 stays a pure redirection.
- Rewrapped the lines that went over 80 columns, which the rename to display_printf() pushed past the limit.
- Dropped the NULL initialiser on the static output stream, removed the trailing semicolon from the print_space() macro and used ARRAY_SIZE().
Luiz Augusto von Dentz (9):
monitor/analyze: Free the channel latency plots monitor/l2cap: Report the channel latency deviation monitor/analyze: Drop a trailing space before a newline
monitor: Route the decoding output through a single function
monitor: Separate the frames for a pager reading records
monitor: Hand the captured frames to the pager on Ctrl-R doc/btmon: Document searching the frames
monitor: Prefer fzf as the pager when one is not set doc/btmon: Document the pager choice
Makefile.tools | 1 + doc/btmon.rst | 64 ++++++ monitor/analyze.c | 47 ++-- monitor/avctp.c | 68 +++--- monitor/control.c | 176 ++++++++------- monitor/display.c | 139 +++++++++++- monitor/display.h | 14 +- monitor/find.c | 534 ++++++++++++++++++++++++++++++++++++++++++++++ monitor/find.h | 19 ++ monitor/l2cap.c | 41 ++-- monitor/lmp.c | 4 +- monitor/main.c | 28 ++- monitor/packet.c | 19 +- monitor/rfcomm.c | 6 +- tools/l2test.c | 10 + 15 files changed, 994 insertions(+), 176 deletions(-) create mode 100644 monitor/find.c create mode 100644 monitor/find.h
Signature · 1 line
2.55.0