From e7eed7c5fd34d09aa03b97d31e96a4b66e223322 Mon Sep 17 00:00:00 2001 From: Kou Wenqi Date: Thu, 17 Apr 2025 15:12:29 +0800 Subject: [PATCH] btt: eliminate redundant separators in btt -p display --- ...edundant-separators-in-btt-p-display.patch | 105 ++++++++++++++++++ blktrace.spec | 6 +- 2 files changed, 110 insertions(+), 1 deletion(-) create mode 100644 0008-btt-eliminate-redundant-separators-in-btt-p-display.patch diff --git a/0008-btt-eliminate-redundant-separators-in-btt-p-display.patch b/0008-btt-eliminate-redundant-separators-in-btt-p-display.patch new file mode 100644 index 0000000..6306219 --- /dev/null +++ b/0008-btt-eliminate-redundant-separators-in-btt-p-display.patch @@ -0,0 +1,105 @@ +From 0c2fb104f4875a28af41072f457e0204171dd0fb Mon Sep 17 00:00:00 2001 +From: Kou Wenqi +Date: Wed, 9 Apr 2025 17:27:42 +0800 +Subject: [PATCH] btt: eliminate redundant separators in btt -p display + +8,0 1 1 0.000000000 5315 Q WS 0 + 375 [dd] +8,0 1 2 0.000005314 5315 X WS 0 / 128 [dd] +8,0 1 3 0.000012623 5315 G WS 0 + 128 [dd] +8,0 1 4 0.000030582 5315 I WS 0 + 128 [dd] +8,0 1 5 0.000046089 5315 X WS 128 / 256 [dd] +8,0 1 6 0.000047072 5315 G WS 128 + 128 [dd] +8,0 1 7 0.000047513 5315 I WS 128 + 128 [dd] +8,0 1 8 0.000051336 5315 G WS 256 + 119 [dd] +8,0 1 9 0.000051562 5315 I WS 256 + 119 [dd] +8,0 1 10 0.000079209 109 D WS 0 + 128 [kworker/1:1H] +8,0 1 11 0.000308966 109 D WS 128 + 128 [kworker/1:1H] +8,0 1 12 0.000467117 109 D WS 256 + 119 [kworker/1:1H] +8,0 2 1 0.000596478 0 C WS 0 + 128 [0] +8,0 2 2 0.000616049 0 C WS 0 + 256 [0] +8,0 2 3 0.000618701 0 C WS 0 + 375 [0] +8,0 1 13 0.000909790 5315 Q WS 375 + 375 [dd] +8,0 1 14 0.000913783 5315 X WS 375 / 503 [dd] +8,0 1 15 0.000918960 5315 G WS 375 + 128 [dd] +8,0 1 16 0.000933605 5315 I WS 375 + 128 [dd] +8,0 1 17 0.000945282 5315 X WS 503 / 631 [dd] +8,0 1 18 0.000946635 5315 G WS 503 + 128 [dd] +8,0 1 19 0.000947169 5315 I WS 503 + 128 [dd] +8,0 1 20 0.000950159 5315 G WS 631 + 119 [dd] +8,0 1 21 0.000950570 5315 I WS 631 + 119 [dd] +8,0 1 22 0.000973481 109 D WS 375 + 128 [kworker/1:1H] +8,0 1 23 0.001133980 109 D WS 503 + 128 [kworker/1:1H] +8,0 1 24 0.001228540 109 D WS 631 + 119 [kworker/1:1H] +8,0 2 4 0.001377897 0 C WS 375 + 128 [0] +8,0 2 5 0.001385818 0 C WS 375 + 256 [0] +8,0 2 6 0.001389308 0 C WS 375 + 375 [0] + +Before this patch, the output of btt -p is as follows: +----------------------------------------- +----------------------------------------- + 8,0 : 0.000000000 Q 0+375 + 0.000012623 G 0+375 + 0.000030582 I 0+375 + 0.000618701 C 0+375 + +----------------------------------------- +----------------------------------------- +----------------------------------------- + 8,0 : 0.000909790 Q 375+375 + 0.000918960 G 375+375 + 0.000933605 I 375+375 + 0.001389308 C 375+375 + +----------------------------------------- + +After this patch, the output of btt -p is as follows: + 8,0 : 0.000000000 Q 0+375 + 0.000012623 G 0+375 + 0.000030582 I 0+375 + 0.000618701 C 0+375 + +----------------------------------------- + 8,0 : 0.000909790 Q 375+375 + 0.000918960 G 375+375 + 0.000933605 I 375+375 + 0.001389308 C 375+375 + +----------------------------------------- + +Signed-off-by: Kou Wenqi +--- + btt/trace_complete.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/btt/trace_complete.c b/btt/trace_complete.c +index 44732c5..6fb2347 100644 +--- a/btt/trace_complete.c ++++ b/btt/trace_complete.c +@@ -56,6 +56,7 @@ static void handle_complete(struct io *c_iop) + __u64 d_time = (__u64)-1; + FILE *pit_fp = c_iop->dip->pit_fp; + double cur = BIT_TIME(c_iop->t.time); ++ int q_iop_matched = 0; + + update_blks(c_iop); + update_cregion(&all_regions, c_iop->t.time); +@@ -67,6 +68,7 @@ static void handle_complete(struct io *c_iop) + + dip_foreach_list(c_iop, IOP_Q, &head); + list_for_each_safe(p, q, &head) { ++ q_iop_matched = 1; + struct io *q_iop = list_entry(p, struct io, f_head); + __u64 q2c = tdelta(q_iop->t.time, c_iop->t.time); + +@@ -103,7 +105,7 @@ static void handle_complete(struct io *c_iop) + io_release(q_iop); + } + +- if (per_io_ofp) ++ if (per_io_ofp && q_iop_matched) + fprintf(per_io_ofp, + "-----------------------------------------\n"); + +-- +2.43.0 + diff --git a/blktrace.spec b/blktrace.spec index d4283e5..a5b6e46 100644 --- a/blktrace.spec +++ b/blktrace.spec @@ -1,6 +1,6 @@ Name: blktrace Version: 1.3.0 -Release: 4 +Release: 5 Summary: Block IO tracer in the Linux kernel License: GPLv2+ Source: http://brick.kernel.dk/snaps/blktrace-%{version}.tar.bz2 @@ -18,6 +18,7 @@ Patch4: 0004-blkparse-skip-check_cpu_map-with-pipe-input.patch Patch5: 0005-blkparse-fix-incorrectly-sized-memset-in-check_cpu_m.patch Patch6: 0006-fix-hang-when-BLKTRACESETUP-fails-and-o-is-used.patch Patch7: 0007-blkparse-Fix-a-potential-coredump-issue.patch +Patch8: 0008-btt-eliminate-redundant-separators-in-btt-p-display.patch %description blktrace is a block layer IO tracing mechanism which provides detailed @@ -54,6 +55,9 @@ make dest=%{buildroot} prefix=%{buildroot}/%{_prefix} mandir=%{buildroot}/%{_man %changelog +* Thu Apr 17 2025 kouwenqi - 1.3.0-5 +- btt: eliminate redundant separators in btt -p display + * Fri Mar 21 2025 kouwenqi - 1.3.0-4 - blkparse: Fix a potential coredump issue -- Gitee