/usr/bin/parse-ior is in lustre-utils 1.8.5+dfsg-3ubuntu1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | #!/usr/bin/perl -w
# arg 0 is filename
sub usages_msg(){
print "Usage: $0 <results_filename>\n";
print " parses and plots IOR results using gnuplot, and generates a .dat file for\n";
print " simple graphing in spreadhseets\n";
print "e.g.> perl parse-ior.pl ior-log\n";
exit 1;
}
if ( !$ARGV[0] ) {
usages_msg();
}
$file = $ARGV[0];
# Open log file for reading
open ( PFILE, "$file") or die "Can't open results log file";
# Open .csv file for writting required columns from log file.
open ( DATAFILE, "> $file.dat" ) or die "Can't open csv file for writting";
$count = 0;
while ( <PFILE> ) {
chomp;
@line = split( /\s+/ ); # splits line into tokens
if ( $line[0] ) {
# This comparison will be changed if there will be changes log file.
if( $line[0] eq "access" && $line[1] eq "bw(MiB/s)" ) {
print DATAFILE "$count $line[1] $line[4] $line[5] $line[6] br(MiB/s) ropen(s) rd(s) rclose(s)\n";
$count = $count + 1;
}
# Two columns from output file are skiped since
# they are constant and may not be so useful while graphing results.
if( $line[0] eq "write" ) {
print DATAFILE "$count $line[1] $line[4] $line[5] $line[6] ";
}
if( $line[0] eq "read" ) {
print DATAFILE "$line[1] $line[4] $line[5] $line[6]\n";
$count = $count + 1;
}
}
}
close PFILE;
close DATAFILE;
# Open .scr file for writting instructions for gnuplot.
open ( SCRFILE, "> $file.scr" ) or die "Can't open scr file for writting";
# Only two columns bw(MiB/s) and br(MiB/s) are considered for graphing results.
print SCRFILE "plot \"$file.dat\" using 1:2 axes x1y1 title \"bw(MiB/s)\" with line\n";
print SCRFILE "replot \"$file.dat\" using 1:6 axes x1y1 title \"br(MiB/s)\" with line\n";
print SCRFILE "pause -1\n";
close SCRFILE;
# check whether gnuplot exists?
system ("which gnuplot > /dev/null") == 0 or die "gnuplot does not exists, Please install it and try again.\n";
# invoke gnuplot to display graph.
system ("gnuplot $file.scr");
|