fio2gnuplot: Print line if int() conversion fails
authorErwan Velu <erwan@enovance.com>
Thu, 1 Aug 2013 11:41:02 +0000 (13:41 +0200)
committerErwan Velu <erwan@enovance.com>
Mon, 5 Aug 2013 15:09:59 +0000 (17:09 +0200)
When data aren't properly formated the int() conversion could fails but
doesn't print the impacted line which is pretty difficult to estimate
where the bug is.

This patch simply reports the line that cause the trouble.

tools/plot/fio2gnuplot.py

index 4be011d2349fab151fd68581f6410fc53d30108b..c05799173b7dfde35e908ead4b7d685b88dfb487 100755 (executable)
@@ -179,7 +179,12 @@ def compute_temp_file(fio_data_file,disk_perf,gnuplot_output_dir):
                for line in current_line:
                        time, perf, x, block_size = line
                        if (blk_size == 0):
                for line in current_line:
                        time, perf, x, block_size = line
                        if (blk_size == 0):
-                               blk_size=int(block_size)
+                               try:
+                                       blk_size=int(block_size)
+                               except:
+                                       print "Error while reading the following line :"
+                                       print line
+                                       sys.exit(1);
 
                        # We ignore the first 500msec as it doesn't seems to be part of the real benchmark
                        # Time < 500 usually reports BW=0 breaking the min computing
 
                        # We ignore the first 500msec as it doesn't seems to be part of the real benchmark
                        # Time < 500 usually reports BW=0 breaking the min computing