All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com>
To: rostedt@goodmis.org
Cc: linux-trace-devel@vger.kernel.org
Subject: [PATCH v6 02/11] trace-cmd dump: Print compression header
Date: Fri, 10 Dec 2021 13:05:02 +0200	[thread overview]
Message-ID: <20211210110511.98856-3-tz.stoyanov@gmail.com> (raw)
In-Reply-To: <20211210110511.98856-1-tz.stoyanov@gmail.com>

Dump the compression header of trace file version 7

Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>
---
 tracecmd/trace-dump.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/tracecmd/trace-dump.c b/tracecmd/trace-dump.c
index 23733194..1503e2bf 100644
--- a/tracecmd/trace-dump.c
+++ b/tracecmd/trace-dump.c
@@ -217,6 +217,29 @@ static void dump_initial_format(int fd)
 	do_print(SUMMARY, "\t\t%d\t[Page size, bytes]\n", val4);
 }
 
+static void dump_compress(int fd)
+{
+	char zname[DUMP_SIZE];
+	char zver[DUMP_SIZE];
+
+	if (file_version < FILE_VERSION_COMPRESSION)
+		return;
+
+	/* get compression header */
+	if (read_file_string(fd, zname, DUMP_SIZE))
+		die("no compression header");
+	if (read_file_string(fd, zver, DUMP_SIZE))
+		die("no compression version");
+	do_print((SUMMARY), "\t\t%s\t[Compression algorithm]\n", zname);
+	do_print((SUMMARY), "\t\t%s\t[Compression version]\n", zver);
+
+	if (strcmp(zname, "none")) {
+		compress = tracecmd_compress_alloc(zname, zver, fd, tep, NULL);
+		if (!compress)
+			die("cannot uncompress the file");
+	}
+}
+
 static void dump_header_page(int fd)
 {
 	unsigned long long size;
@@ -760,6 +783,7 @@ static void dump_file(const char *file)
 	do_print(SUMMARY, "\n Tracing meta data in file %s:\n", file);
 
 	dump_initial_format(fd);
+	dump_compress(fd);
 	dump_header_page(fd);
 	dump_header_event(fd);
 	dump_ftrace_events_format(fd);
-- 
2.33.1


  parent reply	other threads:[~2021-12-10 11:05 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-10 11:05 [PATCH v6 00/11] trace-cmd dump - v7 update Tzvetomir Stoyanov (VMware)
2021-12-10 11:05 ` [PATCH v6 01/11] trace-cmd dump: Add helpers for processing trace file version 7 Tzvetomir Stoyanov (VMware)
2021-12-10 11:05 ` Tzvetomir Stoyanov (VMware) [this message]
2021-12-10 11:05 ` [PATCH v6 03/11] trace-cmd dump: Add helpers for processing trace file sections Tzvetomir Stoyanov (VMware)
2021-12-10 11:05 ` [PATCH v6 04/11] trace-cmd dump: Read recursively all options sections Tzvetomir Stoyanov (VMware)
2021-12-10 11:05 ` [PATCH v6 05/11] trace-cmd dump: Read extended BUFFER option Tzvetomir Stoyanov (VMware)
2021-12-10 11:05 ` [PATCH v6 06/11] trace-cmd dump: Dump sections Tzvetomir Stoyanov (VMware)
2021-12-10 11:05 ` [PATCH v6 07/11] trace-cmd dump: Dump trace file version 7 Tzvetomir Stoyanov (VMware)
2021-12-10 11:05 ` [PATCH v6 08/11] trace-cmd dump: Read strings sections from v7 trace files Tzvetomir Stoyanov (VMware)
2021-12-10 11:05 ` [PATCH v6 09/11] trace-cmd dump: Dump sections content Tzvetomir Stoyanov (VMware)
2021-12-10 11:05 ` [PATCH v6 10/11] trace-cmd dump: Add new argument --sections Tzvetomir Stoyanov (VMware)
2021-12-10 11:05 ` [PATCH v6 11/11] trace-cmd dump: Align better the output of flyrecord dump Tzvetomir Stoyanov (VMware)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211210110511.98856-3-tz.stoyanov@gmail.com \
    --to=tz.stoyanov@gmail.com \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.