From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Alan D. Brunelle" Date: Wed, 10 Dec 2008 21:41:12 +0000 Subject: [PATCH] Added no messages option to blkparse.c Message-Id: <49403778.1090802@hp.com> MIME-Version: 1 Content-Type: multipart/mixed; boundary="------------060202040207090203080300" List-Id: To: linux-btrace@vger.kernel.org This is a multi-part message in MIME format. --------------060202040207090203080300 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit --------------060202040207090203080300 Content-Type: text/x-diff; name="0001-Added-no-messages-option-to-blkparse.c.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="0001-Added-no-messages-option-to-blkparse.c.patch" Added a new option (-M, --no-msgs) option to blkparse: I have found that the CFQ I/O scheduler sends a *tremendous* amount of messages, that bloat the .bin file generated when using the -d option. The file sizes can shrink by >50% when using the -M option in those case. Signed-off-by: Alan D. Brunelle --- blkparse.c | 20 +++++++++++++++++--- doc/blkparse.1 | 9 +++++++++ doc/blktrace.tex | 1 + 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/blkparse.c b/blkparse.c index d869da6..ef55697 100644 --- a/blkparse.c +++ b/blkparse.c @@ -104,7 +104,6 @@ static struct per_process_info *ppi_hash_table[PPI_HASH_SIZE]; static struct per_process_info *ppi_list; static int ppi_list_entries; -#define S_OPTS "a:A:b:D:d:f:F:hi:o:Oqstw:vV" static struct option l_opts[] = { { .name = "act-mask", @@ -161,6 +160,12 @@ static struct option l_opts[] = { .val = 'i' }, { + .name = "no-msgs", + .has_arg = no_argument, + .flag = NULL, + .val = 'M' + }, + { .name = "output", .has_arg = required_argument, .flag = NULL, @@ -270,6 +275,7 @@ static int ppi_hash_by_pid = 1; static int verbose; static unsigned int act_mask = -1U; static int stats_printed; +static int bin_output_msgs = 1; int data_is_native = -1; static FILE *dump_fp; @@ -1612,7 +1618,10 @@ static void dump_trace(struct blk_io_trace *t, struct per_cpu_info *pci, pdi->events++; - output_binary(t, sizeof(*t) + t->pdu_len); + if (bin_output_msgs || + !(t->action & BLK_TC_ACT(BLK_TC_NOTIFY) && + t->action == BLK_TN_MESSAGE)) + output_binary(t, sizeof(*t) + t->pdu_len); } /* @@ -2645,7 +2654,7 @@ static int is_pipe(const char *str) return 0; } -#define S_OPTS "a:A:b:D:d:f:F:hi:o:Oqstw:vV" +#define S_OPTS "a:A:b:D:d:f:F:hi:o:Oqstw:vVM" static char usage_str[] = "\n\n" \ "-i | --input=\n" \ "[ -a | --act-mask= ]\n" \ @@ -2662,6 +2671,7 @@ static char usage_str[] = "\n\n" \ "[ -s | --per-program-stats ]\n" \ "[ -t | --track-ios ]\n" \ "[ -w