- # If the file matches the glob
- if fnmatch.fnmatch(file, pattern):
- # Let's consider this file
- fio_data_file.append(file)
+ # If the file matches the glob
+ if fnmatch.fnmatch(file, pattern):
+ # Let's consider this file
+ fio_data_file.append(file)
- raw_filename = "%s-2Draw" % (png_file)
- 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\' \'%s\' \'%f\'\n" % (gpm_dir,title,tmp_filename,fio_data_file[pos],raw_filename,mode,smooth_filename,trend_filename,avg))
- pos = pos +1
+ raw_filename = "%s-2Draw" % (png_file)
+ 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\' \'%s\' \'%f\'\n" % (gpm_dir,title,tmp_filename,fio_data_file[pos],raw_filename,mode,smooth_filename,trend_filename,avg))
+ pos = pos +1
- min_file.write("# Disk%d was coming from %s\n" % (disk,fio_data_file[disk]))
- max_file.write("# Disk%d was coming from %s\n" % (disk,fio_data_file[disk]))
- average_file.write("# Disk%d was coming from %s\n" % (disk,fio_data_file[disk]))
- stddev_file.write("# Disk%d was coming from %s\n" % (disk,fio_data_file[disk]))
+ min_file.write("# Disk%d was coming from %s\n" % (disk,fio_data_file[disk]))
+ max_file.write("# Disk%d was coming from %s\n" % (disk,fio_data_file[disk]))
+ average_file.write("# Disk%d was coming from %s\n" % (disk,fio_data_file[disk]))
+ stddev_file.write("# Disk%d was coming from %s\n" % (disk,fio_data_file[disk]))
- opts, args = getopt.getopt(argv[1:],"ghkbivo:d:t:p:G:m:M:",['bandwidth', 'iops', 'pattern', 'outputfile', 'outputdir', 'title', 'min_time', 'max_time', 'gnuplot', 'Global', 'help', 'verbose','keep'])
+ opts, args = getopt.getopt(argv[1:],"ghkbivo:d:t:p:G:m:M:",['bandwidth', 'iops', 'pattern', 'outputfile', 'outputdir', 'title', 'min_time', 'max_time', 'gnuplot', 'Global', 'help', 'verbose','keep'])
- if opt in ("-b", "--bandwidth"):
- pattern='*_bw.log'
- elif opt in ("-i", "--iops"):
- pattern='*_iops.log'
- elif opt in ("-v", "--verbose"):
- verbose=True
- elif opt in ("-k", "--keep"):
- #User really wants to keep the temporary files
- force_keep_temp_files=True
- elif opt in ("-p", "--pattern"):
- pattern_set_by_user=True
- pattern=arg
- pattern=pattern.replace('\\','')
- elif opt in ("-o", "--outputfile"):
- gnuplot_output_filename=arg
- elif opt in ("-d", "--outputdir"):
- gnuplot_output_dir=arg
- if not gnuplot_output_dir.endswith('/'):
- gnuplot_output_dir=gnuplot_output_dir+'/'
- if not os.path.exists(gnuplot_output_dir):
- os.makedirs(gnuplot_output_dir)
- elif opt in ("-t", "--title"):
- title=arg
- elif opt in ("-m", "--min_time"):
- min_time=arg
- elif opt in ("-M", "--max_time"):
- max_time=arg
- elif opt in ("-g", "--gnuplot"):
- run_gnuplot=True
- elif opt in ("-G", "--Global"):
- parse_global=True
- global_search=arg
- elif opt in ("-h", "--help"):
- print_help()
- sys.exit(1)
+ if opt in ("-b", "--bandwidth"):
+ pattern='*_bw.log'
+ elif opt in ("-i", "--iops"):
+ pattern='*_iops.log'
+ elif opt in ("-v", "--verbose"):
+ verbose=True
+ elif opt in ("-k", "--keep"):
+ #User really wants to keep the temporary files
+ force_keep_temp_files=True
+ elif opt in ("-p", "--pattern"):
+ pattern_set_by_user=True
+ pattern=arg
+ pattern=pattern.replace('\\','')
+ elif opt in ("-o", "--outputfile"):
+ gnuplot_output_filename=arg
+ elif opt in ("-d", "--outputdir"):
+ gnuplot_output_dir=arg
+ if not gnuplot_output_dir.endswith('/'):
+ gnuplot_output_dir=gnuplot_output_dir+'/'
+ if not os.path.exists(gnuplot_output_dir):
+ os.makedirs(gnuplot_output_dir)
+ elif opt in ("-t", "--title"):
+ title=arg
+ elif opt in ("-m", "--min_time"):
+ min_time=arg
+ elif opt in ("-M", "--max_time"):
+ max_time=arg
+ elif opt in ("-g", "--gnuplot"):
+ run_gnuplot=True
+ elif opt in ("-G", "--Global"):
+ parse_global=True
+ global_search=arg
+ elif opt in ("-h", "--help"):
+ print_help()
+ sys.exit(1)
- print("No log file found with pattern %s!" % pattern)
- # Try numjob log file format if per_numjob_logs=1
- if (pattern == '*_bw.log'):
- fio_data_file=find_file('.','*_bw.*.log')
- if (pattern == '*_iops.log'):
- fio_data_file=find_file('.','*_iops.*.log')
- if len(fio_data_file) == 0:
- sys.exit(1)
- else:
- print("Using log file per job format instead")
+ print("No log file found with pattern %s!" % pattern)
+ # Try numjob log file format if per_numjob_logs=1
+ if (pattern == '*_bw.log'):
+ fio_data_file=find_file('.','*_bw.*.log')
+ if (pattern == '*_iops.log'):
+ fio_data_file=find_file('.','*_iops.*.log')
+ if len(fio_data_file) == 0:
+ sys.exit(1)
+ else:
+ print("Using log file per job format instead")
- gnuplot_output_filename=pattern
- # As we do have some glob in the pattern, let's make this simpliest
- # We do remove the simpliest parts of the expression to get a clear file name
- gnuplot_output_filename=gnuplot_output_filename.replace('-*-','-')
- gnuplot_output_filename=gnuplot_output_filename.replace('*','-')
- gnuplot_output_filename=gnuplot_output_filename.replace('--','-')
- gnuplot_output_filename=gnuplot_output_filename.replace('.log','')
- # Insure that we don't have any starting or trailing dash to the filename
- gnuplot_output_filename = gnuplot_output_filename[:-1] if gnuplot_output_filename.endswith('-') else gnuplot_output_filename
- gnuplot_output_filename = gnuplot_output_filename[1:] if gnuplot_output_filename.startswith('-') else gnuplot_output_filename
- if (gnuplot_output_filename == ''):
- gnuplot_output_filename='default'
+ gnuplot_output_filename=pattern
+ # As we do have some glob in the pattern, let's make this simpliest
+ # We do remove the simpliest parts of the expression to get a clear file name
+ gnuplot_output_filename=gnuplot_output_filename.replace('-*-','-')
+ gnuplot_output_filename=gnuplot_output_filename.replace('*','-')
+ gnuplot_output_filename=gnuplot_output_filename.replace('--','-')
+ gnuplot_output_filename=gnuplot_output_filename.replace('.log','')
+ # Insure that we don't have any starting or trailing dash to the filename
+ gnuplot_output_filename = gnuplot_output_filename[:-1] if gnuplot_output_filename.endswith('-') else gnuplot_output_filename
+ gnuplot_output_filename = gnuplot_output_filename[1:] if gnuplot_output_filename.startswith('-') else gnuplot_output_filename
+ if (gnuplot_output_filename == ''):
+ gnuplot_output_filename='default'
- blk_size=compute_temp_file(fio_data_file,disk_perf,gnuplot_output_dir,min_time,max_time)
- title="%s @ Blocksize = %dK" % (title,blk_size/1024)
- compute_aggregated_file(fio_data_file, gnuplot_output_filename, gnuplot_output_dir)
- compute_math(fio_data_file,title,gnuplot_output_filename,gnuplot_output_dir,mode,disk_perf,gpm_dir)
- generate_gnuplot_script(fio_data_file,title,gnuplot_output_filename,gnuplot_output_dir,mode,disk_perf,gpm_dir)
-
- if (run_gnuplot==True):
- render_gnuplot(fio_data_file, gnuplot_output_dir)
-
- # Shall we clean the temporary files ?
- if keep_temp_files==False and force_keep_temp_files==False:
- # Cleaning temporary files
- if verbose: print("Cleaning temporary files")
- for f in enumerate(temporary_files):
- if verbose: print(" -> %s"%f[1])
- try:
- os.remove(f[1])
- except:
- True
+ blk_size=compute_temp_file(fio_data_file,disk_perf,gnuplot_output_dir,min_time,max_time)
+ title="%s @ Blocksize = %dK" % (title,blk_size/1024)
+ compute_aggregated_file(fio_data_file, gnuplot_output_filename, gnuplot_output_dir)
+ compute_math(fio_data_file,title,gnuplot_output_filename,gnuplot_output_dir,mode,disk_perf,gpm_dir)
+ generate_gnuplot_script(fio_data_file,title,gnuplot_output_filename,gnuplot_output_dir,mode,disk_perf,gpm_dir)
+
+ if (run_gnuplot==True):
+ render_gnuplot(fio_data_file, gnuplot_output_dir)
+
+ # Shall we clean the temporary files ?
+ if keep_temp_files==False and force_keep_temp_files==False:
+ # Cleaning temporary files
+ if verbose: print("Cleaning temporary files")
+ for f in enumerate(temporary_files):
+ if verbose: print(" -> %s"%f[1])
+ try:
+ os.remove(f[1])
+ except:
+ True