Implement simple message in blktrace stream
RFC PATCH 1/1 Implement simple message in blktrace stream
From b03cc9f9a75da479d2b37b03fc4554553b8ee6b6 Mon Sep 17 00:00:00 2001
From: Alan D. Brunelle <[email protected]>
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 <[email protected]>
--- blkparse.c | 17 +++++++++++++++++ blktrace_api.h | 2 ++ 2 files changed, 19 insertions(+), 0 deletions(-)
blkparse.c +17 -0
@@ -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 */ ;
blktrace_api.h +2 -0
@@ -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
Signature · 1 line
1.5.4.3