diff mbox series

trace-cmd: Show uncompressed size at end of record

Message ID 20220221181405.2dae5930@rorschach.local.home (mailing list archive)
State Accepted
Commit 473fd6398118ba4ab2d6ab25d2603f231226db4c
Headers show
Series trace-cmd: Show uncompressed size at end of record | expand

Commit Message

Steven Rostedt Feb. 21, 2022, 11:14 p.m. UTC
From: "Steven Rostedt (Google)" <rostedt@goodmis.org>

Instead of showing just the size of the compressed data at the end of the
record, also show the uncompressed size, but only for when compression is
done. It also lets the user know that the file is compressed, as the
writing of the compressed data takes much longer than just appending the
data straight.

CPU0 data recorded at offset=0x161000
    17123100 bytes in size (101777408 uncompressed)
CPU1 data recorded at offset=0x11b6000
    13519375 bytes in size (81039360 uncompressed)
CPU2 data recorded at offset=0x1e9b000
    14297750 bytes in size (91959296 uncompressed)
CPU3 data recorded at offset=0x2c3e000
    3926 bytes in size (20480 uncompressed)
CPU4 data recorded at offset=0x2c3f000
    13216913 bytes in size (78225408 uncompressed)
CPU5 data recorded at offset=0x38da000
    11489333 bytes in size (67829760 uncompressed)
CPU6 data recorded at offset=0x43d0000
    9342842 bytes in size (54976512 uncompressed)
CPU7 data recorded at offset=0x4cb9000
    14085776 bytes in size (94261248 uncompressed)

Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 lib/trace-cmd/trace-output.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/lib/trace-cmd/trace-output.c b/lib/trace-cmd/trace-output.c
index e7915aa6376e..de9198a54cea 100644
--- a/lib/trace-cmd/trace-output.c
+++ b/lib/trace-cmd/trace-output.c
@@ -2452,9 +2452,14 @@  __hidden int out_write_cpu_data(struct tracecmd_output *handle,
 			if (do_lseek(handle, offset, SEEK_SET) == (off64_t)-1)
 				goto out_free;
 		}
-		if (!tracecmd_get_quiet(handle))
-			fprintf(stderr, "    %llu bytes in size\n",
+		if (!tracecmd_get_quiet(handle)) {
+			fprintf(stderr, "    %llu bytes in size",
 				(unsigned long long)data_files[i].write_size);
+			if (flags & TRACECMD_SEC_FL_COMPRESS)
+				fprintf(stderr, " (%llu uncompressed)",
+					(unsigned long long)data_files[i].file_size);
+			fprintf(stderr, "\n");
+		}
 	}
 
 	if (HAS_SECTIONS(handle) &&