iowatcher: Do not add events out of time range to the plot
authorJan Kara <jack@suse.cz>
Thu, 4 Apr 2013 10:18:24 +0000 (06:18 -0400)
committerChris Mason <clm@fb.com>
Wed, 24 Sep 2014 19:02:08 +0000 (12:02 -0700)
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 <jack@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
iowatcher/plot.c

index 6d652ddcaba4811aae62860cbdd6829e5a9f97b9..e187685a1e40c8092ea81a44b2807e559db44b1f 100644 (file)
@@ -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;