6 print "Usage: $0 <results_filename>\n"
7 print " parses and plots IOR results using gnuplot, and generates a .dat file for\n"
8 print " simple graphing in spreadhseets\n"
9 print "e.g.> perl iokit-parse-ior ior-log\n"
18 # Open log file for reading
19 open ( PFILE, "$file") or die "Can't open results log file";
20 # Open .csv file for writting required columns from log file.
21 open ( DATAFILE, "> $file.dat" ) or die "Can't open csv file for writting";
25 @line = split( /\s+/ ); # splits line into tokens
27 # This comparison will be changed if there will be changes log file.
28 if ( $line[0] eq "access" && $line[1] eq "bw(MiB/s)" ) {
29 print DATAFILE "$count $line[1] $line[4] $line[5] $line[6] br(MiB/s) ropen(s) rd(s) rclose(s)\n";
32 # Two columns from output file are skiped since
33 # they are constant and may not be so useful while graphing results.
34 if ( $line[0] eq "write" ) {
35 print DATAFILE "$count $line[1] $line[4] $line[5] $line[6] ";
37 if ( $line[0] eq "read" ) {
38 print DATAFILE "$line[1] $line[4] $line[5] $line[6]\n";
46 # Open .scr file for writting instructions for gnuplot.
47 open ( SCRFILE, "> $file.scr" ) or die "Can't open scr file for writting";
48 # Only two columns bw(MiB/s) and br(MiB/s) are considered for graphing results.
49 print SCRFILE "plot \"$file.dat\" using 1:2 axes x1y1 title \"bw(MiB/s)\" with line\n";
50 print SCRFILE "replot \"$file.dat\" using 1:6 axes x1y1 title \"br(MiB/s)\" with line\n";
51 print SCRFILE "pause -1\n";
53 # check whether gnuplot exists?
54 system ("which gnuplot > /dev/null") == 0 or die "gnuplot does not exists, Please install it and try again.\n";
55 # invoke gnuplot to display graph.
56 system ("gnuplot $file.scr");