From c82a8c9d6d21b15732a92f9481ea1bcb45c9ce8c Mon Sep 17 00:00:00 2001 From: Christof Schmitt Date: Wed, 2 Apr 2008 09:21:08 +0200 Subject: [PATCH] blkparse: Add PC requests to depth trace The PC requests use the same queue and also contribute to the queue length, so they should be added to the queue depth trace. Signed-off-by: Christof Schmitt Signed-off-by: Jens Axboe --- blkparse.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/blkparse.c b/blkparse.c index 7b47df0..1b3bc78 100644 --- a/blkparse.c +++ b/blkparse.c @@ -1347,8 +1347,10 @@ static void log_pc(struct per_cpu_info *pci, struct blk_io_trace *t, char *act) process_fmt(act, pci, t, -1ULL, t->pdu_len, buf); } -static void dump_trace_pc(struct blk_io_trace *t, struct per_cpu_info *pci) +static void dump_trace_pc(struct blk_io_trace *t, struct per_dev_info *pdi, + struct per_cpu_info *pci) { + int w = (t->action & BLK_TC_ACT(BLK_TC_WRITE)) != 0; int act = t->action & 0xffff; switch (act) { @@ -1362,12 +1364,23 @@ static void dump_trace_pc(struct blk_io_trace *t, struct per_cpu_info *pci) log_generic(pci, t, "S"); break; case __BLK_TA_REQUEUE: + /* + * can happen if we miss traces, don't let it go + * below zero + */ + if (pdi->cur_depth[w]) + pdi->cur_depth[w]--; log_generic(pci, t, "R"); break; case __BLK_TA_ISSUE: + pdi->cur_depth[w]++; + if (pdi->cur_depth[w] > pdi->max_depth[w]) + pdi->max_depth[w] = pdi->cur_depth[w]; log_pc(pci, t, "D"); break; case __BLK_TA_COMPLETE: + if (pdi->cur_depth[w]) + pdi->cur_depth[w]--; log_pc(pci, t, "C"); break; case __BLK_TA_INSERT: @@ -1463,7 +1476,7 @@ static void dump_trace(struct blk_io_trace *t, struct per_cpu_info *pci, { if (text_output) { if (t->action & BLK_TC_ACT(BLK_TC_PC)) - dump_trace_pc(t, pci); + dump_trace_pc(t, pdi, pci); else dump_trace_fs(t, pdi, pci); } -- 2.25.1