All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-trace-devel@vger.kernel.org
Subject: [PATCH 5/5] trace-cmd: Print raw hex for flags when trace-cmd report -R
Date: Wed, 08 Jul 2020 16:28:55 -0400	[thread overview]
Message-ID: <20200708203017.461261635@goodmis.org> (raw)
In-Reply-To: 20200708202850.764168067@goodmis.org

From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

When the '-R' raw flag is specified on the command line for trace-cmd
report, show the latency flags as a raw hex number. This is useful for
seeing exactly what was saved in the flags field.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=204703
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 tracecmd/trace-read.c | 32 ++++++++++++++++++--------------
 1 file changed, 18 insertions(+), 14 deletions(-)

diff --git a/tracecmd/trace-read.c b/tracecmd/trace-read.c
index 2ab89ab57c6e..e18110745d37 100644
--- a/tracecmd/trace-read.c
+++ b/tracecmd/trace-read.c
@@ -101,6 +101,7 @@ static int no_softirqs;
 static int tsdiff;
 
 static int latency_format;
+static bool raw_format;
 static const char *format_type = TEP_PRINT_INFO;
 
 static struct tep_format_field *wakeup_task;
@@ -807,6 +808,7 @@ void trace_show_data(struct tracecmd_input *handle, struct tep_record *record)
 {
 	tracecmd_show_data_func func = tracecmd_get_show_data_func(handle);
 	const char *tfmt = time_format(handle, TIME_FMT_NORMAL);
+	const char *cfmt = latency_format ? "%8.8s-%-5d %3d" : "%16s-%-5d [%03d]";
 	struct tep_handle *pevent;
 	struct tep_event *event;
 	struct trace_seq s;
@@ -847,17 +849,20 @@ void trace_show_data(struct tracecmd_input *handle, struct tep_record *record)
 		}
 	}
 
-	if (latency_format)
-		tep_print_event(pevent, &s, record, "%8.8s-%-5d %3d%s",
-				TEP_PRINT_COMM,
-				TEP_PRINT_PID,
-				TEP_PRINT_CPU,
-				TEP_PRINT_LATENCY);
-	else
-		tep_print_event(pevent, &s, record, "%16s-%-5d [%03d]",
-				TEP_PRINT_COMM,
-				TEP_PRINT_PID,
-				TEP_PRINT_CPU);
+	tep_print_event(pevent, &s, record, cfmt,
+			TEP_PRINT_COMM,
+			TEP_PRINT_PID,
+			TEP_PRINT_CPU);
+
+	if (latency_format) {
+		if (raw_format)
+			trace_seq_printf(&s, "-0x%x",
+					 tep_data_flags(pevent, record));
+		else
+			tep_print_event(pevent, &s, record, "%s",
+					TEP_PRINT_LATENCY);
+	}
+
 	tep_print_event(pevent, &s, record, tfmt, TEP_PRINT_TIME);
 
 	if (tsdiff) {
@@ -1506,7 +1511,6 @@ void trace_report (int argc, char **argv)
 	int nanosec = 0;
 	int no_date = 0;
 	int global = 0;
-	int raw = 0;
 	int neg = 0;
 	int ret = 0;
 	int check_event_parsing = 0;
@@ -1618,7 +1622,7 @@ void trace_report (int argc, char **argv)
 			global = 1;
 			break;
 		case 'R':
-			raw = 1;
+			raw_format = true;
 			break;
 		case 'r':
 			*raw_ptr = malloc(sizeof(struct event_str));
@@ -1769,7 +1773,7 @@ void trace_report (int argc, char **argv)
 		if (nanosec)
 			tep_set_flag(pevent, TEP_NSEC_OUTPUT);
 
-		if (raw)
+		if (raw_format)
 			format_type = TEP_PRINT_INFO_RAW;
 
 		if (test_filters_mode)
-- 
2.26.2



      parent reply	other threads:[~2020-07-08 20:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-08 20:28 [PATCH 0/5] trace-cmd: Triaging bugzillas and fixes Steven Rostedt
2020-07-08 20:28 ` [PATCH 1/5] trace-cmd: Fix trace-cmd report -t to show full timestamp Steven Rostedt
2020-07-08 20:28 ` [PATCH 2/5] tools lib traceveent: Fix kbuffer_start_of_data() to return the first record Steven Rostedt
2020-07-08 20:28 ` [PATCH 3/5] trace-cmd: Explicitly state what trace-cmd report -f does Steven Rostedt
2020-07-08 20:28 ` [PATCH 4/5] tools lib traceevent: Let function symbols be used in operations Steven Rostedt
2020-07-08 20:28 ` Steven Rostedt [this message]

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=20200708203017.461261635@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=linux-trace-devel@vger.kernel.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.