summaryrefslogtreecommitdiff
path: root/blkparse.c
diff options
context:
space:
mode:
authorAlan D. Brunelle <Alan.Brunelle@hp.com>2006-11-13 14:52:53 +0100
committerJens Axboe <jens.axboe@oracle.com>2006-11-13 14:52:53 +0100
commit8091de936d9c64d6da1c7dccb031e8e6296e2205 (patch)
treed2e8df897386bab453ecf5667cad330db1ed3e47 /blkparse.c
parentcfa8ef19ab702e05797173f9255fd188e8581a94 (diff)
downloadblktrace-8091de936d9c64d6da1c7dccb031e8e6296e2205.tar.gz
blktrace-8091de936d9c64d6da1c7dccb031e8e6296e2205.tar.bz2
[PATCH] blkparse: A couple of fixes: correct time output & flush files.
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'blkparse.c')
-rw-r--r--blkparse.c16
1 files changed, 14 insertions, 2 deletions
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);
@@ -2257,6 +2259,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
*/
while (!is_done() && ms_head && handle(ms_head))
@@ -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;
}