fio2gnuplot: Fixing plotting issues on shorten files

fio2gnuplot was mixing files when some got shorten.

The position inside the array was used to remember what file was read
leading to mistakes once some values got ignored.

As a fix, we shall count the index for every single line we read and add
to the time & perf we keep. While writing data to the temporary files,
the extraction of the index insure we write to the proper file.

Before this patch, we observed at the end of the traces some stupid artefacts like loops... was
looking like a 4years old kid drawing...

That's now fixed.
diff --git a/tools/plot/fio2gnuplot.py b/tools/plot/fio2gnuplot.py
index 6ce5e36..efd9681 100755
--- a/tools/plot/fio2gnuplot.py
+++ b/tools/plot/fio2gnuplot.py
@@ -176,10 +176,13 @@
 			break
 
 		last_time = -1
-		index=0
+		index=-1
 		perfs=[]
-		for line in current_line:
-			time, perf, x, block_size = line
+		for line in enumerate(current_line):
+			# Index will be used to remember what file was featuring what value
+			index=index+1
+
+			time, perf, x, block_size = line[1]
 			if (blk_size == 0):
 				try:
 					blk_size=int(block_size)
@@ -190,18 +193,18 @@
 
 			# 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
-			if (((int(time)) > 500) or (int(time)==-1)):
-				# Now it's time to estimate if the data we got is part of the time range we want to plot
-				if ((int(time)>(int(min_time)*1000)) and ((int(time) < (int(max_time)*1000)) or max_time=="-1")):
+			if (min_time == 0):
+				min_time==0.5
+
+			# Then we estimate if the data we got is part of the time range we want to plot
+			if ((float(time)>(float(min_time)*1000)) and ((int(time) < (int(max_time)*1000)) or max_time==-1)):
 					disk_perf[index].append(int(perf))
-					perfs.append("%s %s"% (time, perf))
-					index = index + 1
+					perfs.append("%d %s %s"% (index, time, perf))
 
 		# If we reach this point, it means that all the traces are coherent
 		for p in enumerate(perfs):
-			perf_time,perf = p[1].split()
-			if (perf_time != "-1"):
-				temp_outfile[p[0]].write("%s %.2f %s\n" % (p[0], float(float(perf_time)/1000), perf))
+			index, perf_time,perf = p[1].split()
+			temp_outfile[int(index)].write("%s %.2f %s\n" % (index, float(float(perf_time)/1000), perf))
 
 
 	for file in files: