All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ v1 0/6] monitor: Search the frames with a pager
@ 2026-09-17 20:45 Luiz Augusto von Dentz
  2026-09-17 20:45 ` [PATCH BlueZ v1 1/6] monitor: Route the decoding output through a single function Luiz Augusto von Dentz
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Luiz Augusto von Dentz @ 2026-09-17 20:45 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

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

Patch 1 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 2 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 3 and 4 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 5 and 6 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 and
--read0 wherever it is used.

Luiz Augusto von Dentz (6):
  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 |  44 ++--
 monitor/avctp.c   |  68 +++----
 monitor/control.c | 163 ++++++++-------
 monitor/display.c |  93 ++++++++-
 monitor/display.h |  14 +-
 monitor/find.c    | 499 ++++++++++++++++++++++++++++++++++++++++++++++
 monitor/find.h    |  19 ++
 monitor/l2cap.c   |  34 ++--
 monitor/lmp.c     |   4 +-
 monitor/main.c    |  28 ++-
 monitor/packet.c  |  18 +-
 monitor/rfcomm.c  |   6 +-
 tools/l2test.c    |  10 +
 15 files changed, 891 insertions(+), 174 deletions(-)
 create mode 100644 monitor/find.c
 create mode 100644 monitor/find.h

-- 
2.55.0


^ permalink raw reply	[flat|nested] 9+ messages in thread
* [PATCH BlueZ v2 1/9] monitor/analyze: Free the channel latency plots
@ 2026-09-18 16:14 Luiz Augusto von Dentz
  2026-09-18 18:47 ` monitor: Search the frames with a pager bluez.test.bot
  0 siblings, 1 reply; 9+ messages in thread
From: Luiz Augusto von Dentz @ 2026-09-18 16:14 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

A channel keeps a plot of its latencies for as long as it exists, but
destroying one frees only the channel itself, leaking both plots and
everything queued on them. A connection already frees its own.

Assisted-by: opencode:claude-opus-5
---
 monitor/analyze.c | 2 ++
 monitor/l2cap.c   | 6 ++++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/monitor/analyze.c b/monitor/analyze.c
index 154303eb7330..5a3adedc211c 100644
--- a/monitor/analyze.c
+++ b/monitor/analyze.c
@@ -298,6 +298,8 @@ static void chan_destroy(void *data)
 	print_stats(&chan->tx, "TX");
 
 done:
+	queue_destroy(chan->rx.plot, free);
+	queue_destroy(chan->tx.plot, free);
 	free(chan);
 }
 
diff --git a/monitor/l2cap.c b/monitor/l2cap.c
index a132bcf397f4..3eaca5bc226b 100644
--- a/monitor/l2cap.c
+++ b/monitor/l2cap.c
@@ -2913,9 +2913,11 @@ void l2cap_dequeue_frame(struct timeval *delta, struct packet_conn_data *conn)
 			frame->cid, frame->psm, mode2str(frame->mode),
 			frame->mode, frame->chan);
 
-	print_field("Channel Latency: %lld msec (%lld-%lld msec ~%lld msec)",
+	print_field("Channel Latency: %lld msec (%lld-%lld msec ~%lld msec "
+			"+/- %lld msec)",
 			TV_MSEC(*delta), TV_MSEC(chan->tx_l.min),
-			TV_MSEC(chan->tx_l.max), TV_MSEC(chan->tx_l.med));
+			TV_MSEC(chan->tx_l.max), TV_MSEC(chan->tx_l.med),
+			packet_latency_stddev(&chan->tx_l));
 
 	free(frame);
 }
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2026-09-18 18:47 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-17 20:45 [PATCH BlueZ v1 0/6] monitor: Search the frames with a pager Luiz Augusto von Dentz
2026-09-17 20:45 ` [PATCH BlueZ v1 1/6] monitor: Route the decoding output through a single function Luiz Augusto von Dentz
2026-09-17 23:55   ` monitor: Search the frames with a pager bluez.test.bot
2026-09-17 20:45 ` [PATCH BlueZ v1 2/6] monitor: Separate the frames for a pager reading records Luiz Augusto von Dentz
2026-09-17 20:45 ` [PATCH BlueZ v1 3/6] monitor: Hand the captured frames to the pager on Ctrl-R Luiz Augusto von Dentz
2026-09-17 20:45 ` [PATCH BlueZ v1 4/6] doc/btmon: Document searching the frames Luiz Augusto von Dentz
2026-09-17 20:45 ` [PATCH BlueZ v1 5/6] monitor: Prefer fzf as the pager when one is not set Luiz Augusto von Dentz
2026-09-17 20:45 ` [PATCH BlueZ v1 6/6] doc/btmon: Document the pager choice Luiz Augusto von Dentz
  -- strict thread matches above, loose matches on Subject: below --
2026-09-18 16:14 [PATCH BlueZ v2 1/9] monitor/analyze: Free the channel latency plots Luiz Augusto von Dentz
2026-09-18 18:47 ` monitor: Search the frames with a pager bluez.test.bot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.