Archivio mensile:ottobre 2010

Bonnie++ and gnuplot

To whom it may concern,

A simple perl script to parse bonnie++ 1.92 CSV file and produce data files and command files for gnuplot.

#!/usr/bin/perl

$dataFilename='bon';
$gpltFilename='bon.gplt';

while (<>) {
 chomp;
 push @AoA, [ split /,/];
}

sub print_col {
 $col=shift;
 for $i ( 0 .. $#AoA ) {
 print OUT "$AoA[$i][$col],";
 }
 print OUT "n";

}

open (OUT, ">$dataFilename-1.dat");
print OUT "FS,";
print_col(2);
print OUT "Seq Create,";
print_col(24);
print OUT "Seq Delete,";
print_col(28);
print OUT "Rnd Create,";
print_col(30);
print OUT "Rnd Delete,";
print_col(34);
close OUT;

open (OUT, ">$dataFilename-2.dat");
print OUT "FS,";
print_col(2);
print OUT "Seq Read,";
print_col(26);
print OUT "Random Read,";
print_col(32);
close OUT;

open (OUT, ">$dataFilename-3.dat");
print OUT "FS,";
print_col(2);
print OUT "Block Out,";
print_col(9);
print OUT "Block Rewrite,";
print_col(11);
print OUT "Block Input,";
print_col(15);
close OUT;

open (OUT, ">$gpltFilename");
print OUT '#
#!/usr/bin/gnuplot

set datafile separator ","
set style data histogram
set style histogram cluster gap 1
set style fill solid border -1
set boxwidth 0.9
';

for $data (1..3) {
 print OUT "plot '$dataFilename-$data.dat' using 2:xtic(1) ti col";
 for $i ( 3 .. ($#AoA+2) ) {
 print OUT ', '' u ' . $i . ' ti col';
 }
 print OUT "npause -1n";
}
close OUT;