X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=tools%2Fplot%2Ffio2gnuplot.py;h=c05799173b7dfde35e908ead4b7d685b88dfb487;hp=e749c515edae593cc901c1000384731f9d0cbec7;hb=32deaac975b42586e329c1d280c2afedd095b153;hpb=795ae7064af3252750f57c5da667361e9c628687 diff --git a/tools/plot/fio2gnuplot.py b/tools/plot/fio2gnuplot.py index e749c515..c0579917 100755 --- a/tools/plot/fio2gnuplot.py +++ b/tools/plot/fio2gnuplot.py @@ -39,6 +39,7 @@ def find_file(path, pattern): return fio_data_file def generate_gnuplot_script(fio_data_file,title,gnuplot_output_filename,gnuplot_output_dir,mode,disk_perf,gpm_dir): + print "Generating rendering scripts" filename=gnuplot_output_dir+'mygraph' f=open(filename,'w') @@ -97,7 +98,7 @@ set yrange [0:] smooth_filename = "%s-2Dsmooth" % (png_file) trend_filename = "%s-2Dtrend" % (png_file) avg = average(disk_perf[pos]) - f.write("call \'%s/graph2D.gpm\' \'%s' \'%s\' \'\' \'%s\' \'%s\' \'%s\' \'%s\' \'%f\'\n" % (gpm_dir,title,tmp_filename,raw_filename,mode,smooth_filename,trend_filename,avg)) + f.write("call \'%s/graph2D.gpm\' \'%s' \'%s\' \'%s\' \'%s\' \'%s\' \'%s\' \'%s\' \'%f\'\n" % (gpm_dir,title,tmp_filename,fio_data_file[pos],raw_filename,mode,smooth_filename,trend_filename,avg)) pos = pos +1 # Plotting comparing graphs doesn't have a meaning unless if there is at least 2 traces @@ -115,6 +116,7 @@ def generate_gnuplot_math_script(title,gnuplot_output_filename,mode,average,gnup f.close() def compute_aggregated_file(fio_data_file, gnuplot_output_filename, gnuplot_output_dir): + print "Processing data file 2/2" temp_files=[] pos=0 @@ -138,6 +140,7 @@ def compute_aggregated_file(fio_data_file, gnuplot_output_filename, gnuplot_outp def average(s): return sum(s) * 1.0 / len(s) def compute_temp_file(fio_data_file,disk_perf,gnuplot_output_dir): + print "Processing data file 1/2" files=[] temp_outfile=[] blk_size=0 @@ -159,7 +162,7 @@ def compute_temp_file(fio_data_file,disk_perf,gnuplot_output_dir): s=file.readline().replace(',',' ').split() if not s: nb_empty_files+=1 - s="-1, 0, 0, 0'".replace(',',' ').split() + s="-1, 0, 0, 0".replace(',',' ').split() if (nb_empty_files == nb_files): shall_break=True @@ -176,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): - 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 @@ -199,6 +207,7 @@ def compute_temp_file(fio_data_file,disk_perf,gnuplot_output_dir): return blk_size def compute_math(fio_data_file, title,gnuplot_output_filename,gnuplot_output_dir,mode,disk_perf,gpm_dir): + print "Computing Maths" global_min=[] global_max=[] average_file=open(gnuplot_output_dir+gnuplot_output_filename+'.average', 'w') @@ -314,12 +323,17 @@ def render_gnuplot(fio_data_file, gnuplot_output_dir): os.system("cd %s; gnuplot mymath" % gnuplot_output_dir) print " |-> Rendering 2D & 3D traces" os.system("cd %s; gnuplot mygraph" % gnuplot_output_dir) + + name_of_directory="the current" + if gnuplot_output_dir != "./": + name_of_directory=gnuplot_output_dir + print "\nRendering traces are available in %s directory" % name_of_directory except: print "Could not run gnuplot on mymath or mygraph !\n" sys.exit(1); def print_help(): - print 'fio2gnuplot.py -ghbio -t -o <outputfile> -p <pattern>' + print 'fio2gnuplot.py -ghbiod -t <title> -o <outputfile> -p <pattern> -G <type>' print print '-h --help : Print this help' print '-p <pattern> or --pattern <pattern> : A pattern in regexp to select fio input files'