All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Alan D. Brunelle" <Alan.Brunelle@hp.com>
To: linux-btrace@vger.kernel.org
Subject: [RFC: blkparse Patch] Implement simple message in blktrace stream
Date: Fri, 23 May 2008 20:43:50 +0000	[thread overview]
Message-ID: <48372C86.1050500@hp.com> (raw)

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



[-- Attachment #2: 0001-Added-in-handling-of-MESSAGE-notes.patch --]
[-- Type: text/x-diff, Size: 2175 bytes --]

From b03cc9f9a75da479d2b37b03fc4554553b8ee6b6 Mon Sep 17 00:00:00 2001
From: Alan D. Brunelle <alan.brunelle@hp.com>
Date: Fri, 23 May 2008 16:25:46 -0400
Subject: [PATCH] Added in handling of MESSAGE notes

Output stream would look like:

  8,16   1   813055    20.259000000  4692  I   R 3088320 + 8 [dd]
  8,16   1   813056    20.259000000  4692  Q   R 3088328 + 8 [dd]
  8,16   1             20.259000000     0  m   N elv switch: deadline
  8,16   1   813057    20.259000000  4692  G   R 3088328 + 8 [dd]
  8,16   1   813058    20.259000000  4692  I   R 3088328 + 8 [dd]

Needs some cleaning up (documentation).

Signed-off-by: Alan D. Brunelle <alan.brunelle@hp.com>
---
 blkparse.c     |   17 +++++++++++++++++
 blktrace_api.h |    2 ++
 2 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/blkparse.c b/blkparse.c
index 517dde5..09a77f6 100644
--- a/blkparse.c
+++ b/blkparse.c
@@ -590,6 +590,23 @@ static void handle_notify(struct blk_io_trace *bit)
 
 		break;
 
+	case BLK_TN_MESSAGE:
+		if (bit->pdu_len > 0) {
+			char msg[bit->pdu_len+1];
+
+			memcpy(msg, (char *)payload, bit->pdu_len);
+			msg[bit->pdu_len] = '\0';
+
+			bit->time -= genesis_time;
+			fprintf(ofp,
+				"%3d,%-3d %2d %8s %5d.%09lu %5u %2s %3s %s\n",
+				MAJOR(bit->device), MINOR(bit->device),
+				bit->cpu, "", (int) SECONDS(bit->time),
+				(unsigned long) NANO_SECONDS(bit->time),
+				0, "m", "N", msg);
+		}
+		break;
+
 	default:
 		/* Ignore unknown notify events */
 		;
diff --git a/blktrace_api.h b/blktrace_api.h
index 61b405a..67720de 100644
--- a/blktrace_api.h
+++ b/blktrace_api.h
@@ -54,6 +54,7 @@ enum {
 enum blktrace_notify {
 	__BLK_TN_PROCESS = 0,		/* establish pid/name mapping */
 	__BLK_TN_TIMESTAMP,		/* include system clock */
+	__BLK_TN_MESSAGE,               /* Character string message */
 };
 
 /*
@@ -77,6 +78,7 @@ enum blktrace_notify {
 
 #define BLK_TN_PROCESS		(__BLK_TN_PROCESS | BLK_TC_ACT(BLK_TC_NOTIFY))
 #define BLK_TN_TIMESTAMP	(__BLK_TN_TIMESTAMP | BLK_TC_ACT(BLK_TC_NOTIFY))
+#define BLK_TN_MESSAGE		(__BLK_TN_MESSAGE | BLK_TC_ACT(BLK_TC_NOTIFY))
 
 #define BLK_IO_TRACE_MAGIC	0x65617400
 #define BLK_IO_TRACE_VERSION	0x07
-- 
1.5.4.3


                 reply	other threads:[~2008-05-23 20:43 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=48372C86.1050500@hp.com \
    --to=alan.brunelle@hp.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.