All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Adding read/write flag to per-io output.
@ 2011-09-28 17:59 Adam Crume
  0 siblings, 0 replies; only message in thread
From: Adam Crume @ 2011-09-28 17:59 UTC (permalink / raw)
  To: linux-btrace

[-- 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");
 }
 

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2011-09-28 17:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-28 17:59 [PATCH] Adding read/write flag to per-io output Adam Crume

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.