X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=tools%2Fplot%2Ffio2gnuplot;h=5d31f13ab6c623a8427d7d6f2bcab3f765740e19;hp=f1e6a9833e00733c913924fa15345cfdb9c73370;hb=fa07eaa6913d7171c4259b3b0cd76dae3e76ca00;hpb=265a202706aaa538297599f4c683b781a3ecaedb diff --git a/tools/plot/fio2gnuplot b/tools/plot/fio2gnuplot index f1e6a983..5d31f13a 100755 --- a/tools/plot/fio2gnuplot +++ b/tools/plot/fio2gnuplot @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python2.7 # # Copyright (C) 2013 eNovance SAS # Author: Erwan Velu @@ -17,7 +17,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. import os import fnmatch @@ -31,7 +31,7 @@ def find_file(path, pattern): fio_data_file=[] # For all the local files for file in os.listdir(path): - # If the file math the regexp + # If the file matches the glob if fnmatch.fnmatch(file, pattern): # Let's consider this file fio_data_file.append(file) @@ -361,7 +361,7 @@ def print_help(): print 'fio2gnuplot -ghbiodvk -t -o <outputfile> -p <pattern> -G <type> -m <time> -M <time>' print print '-h --help : Print this help' - print '-p <pattern> or --pattern <pattern> : A pattern in regexp to select fio input files' + print '-p <pattern> or --pattern <pattern> : A glob pattern to select fio input files' print '-b or --bandwidth : A predefined pattern for selecting *_bw.log files' print '-i or --iops : A predefined pattern for selecting *_iops.log files' print '-g or --gnuplot : Render gnuplot traces before exiting' @@ -403,13 +403,13 @@ def main(argv): if not os.path.isfile(gpm_dir+'math.gpm'): gpm_dir="/usr/local/share/fio/" if not os.path.isfile(gpm_dir+'math.gpm'): - print "Looks like fio didn't got installed properly as no gpm files found in '/usr/share/fio' or '/usr/local/share/fio'\n" + print "Looks like fio didn't get installed properly as no gpm files found in '/usr/share/fio' or '/usr/local/share/fio'\n" sys.exit(3) try: 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']) except getopt.GetoptError: - print "Error: One of the option passed to the cmdline was not supported" + print "Error: One of the options passed to the cmdline was not supported" print "Please fix your command line or read the help (-h option)" sys.exit(2) @@ -458,7 +458,15 @@ def main(argv): fio_data_file=find_file('.',pattern) if len(fio_data_file) == 0: print "No log file found with pattern %s!" % pattern - sys.exit(1) + # 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" else: print "%d files Selected with pattern '%s'" % (len(fio_data_file), pattern) @@ -479,7 +487,7 @@ def main(argv): #We need to adjust the output filename regarding the pattern required by the user if (pattern_set_by_user == True): gnuplot_output_filename=pattern - # As we do have some regexp in the pattern, let's make this simpliest + # 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('*','-') @@ -488,6 +496,8 @@ def main(argv): # 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' if parse_global==True: parse_global_files(fio_data_file, global_search)