All of lore.kernel.org
 help / color / mirror / Atom feed
From: Adam Crume <adamcrume@gmail.com>
To: linux-btrace@vger.kernel.org
Subject: [PATCH] Adding read/write flag to per-io output.
Date: Wed, 28 Sep 2011 17:59:03 +0000	[thread overview]
Message-ID: <4e836c93.1dc4e70a.6d9d.093b@mx.google.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 255 bytes --]


The per-io dump option for btt (-p) does not print the read/write flag.  This patch adds that flag.

Signed-off-by: Adam Crume <adamcrume@gmail.com>
---
 btt/trace_complete.c |   19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Adding-read-write-flag-to-per-io-output.patch --]
[-- Type: text/x-patch; name="0001-Adding-read-write-flag-to-per-io-output.patch", Size: 1826 bytes --]

diff --git a/btt/trace_complete.c b/btt/trace_complete.c
index 44732c5..ac10480 100644
--- a/btt/trace_complete.c
+++ b/btt/trace_complete.c
@@ -21,31 +21,32 @@
 #include "globals.h"
 
 static inline void __out(FILE *ofp, __u64 tm, enum iop_type type,
-					__u64 sec, __u32 nsec, int indent)
+					__u64 sec, __u32 nsec, int write, int indent)
 {
 	if (tm != (__u64)-1) {
 		if (indent)
 			fprintf(ofp, "         ");
-		fprintf(ofp, "%5d.%09lu %c %10llu+%-4u\n",
+		fprintf(ofp, "%5d.%09lu %c %10llu+%-4u %c\n",
 			(int)SECONDS(tm), (unsigned long)NANO_SECONDS(tm),
-			type2c(type), (unsigned long long)sec, nsec);
+			type2c(type), (unsigned long long)sec, nsec, write?'W':'R');
 	}
 }
 
 static void display_io_track(FILE *ofp, struct io *iop)
 {
+	int w = (iop->t.action & BLK_TC_ACT(BLK_TC_WRITE)) != 0;
 	fprintf(ofp, "%3d,%-3d: ", MAJOR(iop->t.device), MINOR(iop->t.device));
-	__out(ofp, iop->t.time, IOP_Q, iop->t.sector, t_sec(&iop->t), 0);
+	__out(ofp, iop->t.time, IOP_Q, iop->t.sector, t_sec(&iop->t), w, 0);
 
 	if (iop->g_time != (__u64)-1)
-		__out(ofp, iop->g_time, IOP_G, iop->t.sector, t_sec(&iop->t),1);
+		__out(ofp, iop->g_time, IOP_G, iop->t.sector, t_sec(&iop->t), w, 1);
 	if (iop->i_time != (__u64)-1)
-		__out(ofp, iop->i_time, IOP_I, iop->t.sector, t_sec(&iop->t),1);
+		__out(ofp, iop->i_time, IOP_I, iop->t.sector, t_sec(&iop->t), w, 1);
 	if (iop->m_time != (__u64)-1)
-		__out(ofp, iop->m_time, IOP_M, iop->t.sector, t_sec(&iop->t),1);
+		__out(ofp, iop->m_time, IOP_M, iop->t.sector, t_sec(&iop->t), w, 1);
 
-	__out(ofp, iop->d_time, IOP_D, iop->d_sec, iop->d_nsec, 1);
-	__out(ofp, iop->c_time, IOP_C, iop->c_sec, iop->c_nsec, 1);
+	__out(ofp, iop->d_time, IOP_D, iop->d_sec, iop->d_nsec, w, 1);
+	__out(ofp, iop->c_time, IOP_C, iop->c_sec, iop->c_nsec, w, 1);
 	fprintf(ofp, "\n");
 }
 

                 reply	other threads:[~2011-09-28 17:59 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=4e836c93.1dc4e70a.6d9d.093b@mx.google.com \
    --to=adamcrume@gmail.com \
    --cc=linux-btrace@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.