From: Alan D. Brunelle Date: Mon, 13 Nov 2006 13:52:53 +0000 (+0100) Subject: [PATCH] blkparse: A couple of fixes: correct time output & flush files. X-Git-Tag: blktrace-0.99.2~8 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=8091de936d9c64d6da1c7dccb031e8e6296e2205;p=blktrace.git [PATCH] blkparse: A couple of fixes: correct time output & flush files. Signed-off-by: Jens Axboe --- diff --git a/blkparse.c b/blkparse.c index 07ea8ce..f029341 100644 --- a/blkparse.c +++ b/blkparse.c @@ -2227,6 +2227,8 @@ static int handle(struct ms_stream *msp) pci = get_cpu_info(pdi, msp->cpu); pci->nelems++; + bit->time -= genesis_time; + pdi->last_reported_time = bit->time; if (bit->action & (act_mask << BLK_TC_SHIFT)) dump_trace(bit, pci, pdi); @@ -2256,6 +2258,12 @@ static int do_file(void) ; } + /* + * Get the initial time stamp + */ + if (ms_head) + genesis_time = ms_peek_time(ms_head); + /* * Keep processing traces while any are left */ @@ -2560,9 +2568,13 @@ int main(int argc, char *argv[]) ret = do_file(); show_stats(); - if (ofp_buffer) + if (ofp_buffer) { + fflush(ofp); free(ofp_buffer); - if (bin_ofp_buffer) + } + if (bin_ofp_buffer) { + fflush(dump_fp); free(bin_ofp_buffer); + } return ret; }