From: Jan Kara Date: Thu, 4 Apr 2013 10:18:24 +0000 (-0400) Subject: iowatcher: Do not add events out of time range to the plot X-Git-Tag: blktrace-1.1.0~2^2~17 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=7c883a9412d9dad32c23084c86272602bb7ffd5c;p=blktrace.git iowatcher: Do not add events out of time range to the plot If the event is out of time range that should be plotted, do not add it. It will corrupt memory... Signed-off-by: Jan Kara Signed-off-by: Chris Mason --- diff --git a/iowatcher/plot.c b/iowatcher/plot.c index 6d652dd..e187685 100644 --- a/iowatcher/plot.c +++ b/iowatcher/plot.c @@ -206,8 +206,10 @@ void set_gdd_bit(struct graph_dot_data *gdd, u64 offset, double bytes, double ti if (offset > gdd->max_offset || offset < gdd->min_offset) return; - gdd->total_ios++; time = time / 1000000000.0; + if (time < gdd->min_seconds || time > gdd->max_seconds) + return; + gdd->total_ios++; while (bytes > 0 && offset <= gdd->max_offset) { row = (double)(offset - gdd->min_offset) / bytes_per_row; col = (time - gdd->min_seconds) / secs_per_col;