"Fossies" - the Fresh Open Source Software Archive

Member "bonnie++-1.04/bon_csv2html.in" (1 Nov 2000, 2558 Bytes) of package /linux/privat/bonnie++_1.04.tgz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Perl source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 #!/usr/bin/perl
    2 
    3 {
    4   header();
    5   my $line;
    6   while($line = <STDIN>)
    7   {
    8     while($line =~ /^name,/)
    9     {
   10       $line = <STDIN>;
   11     }
   12     process($line);
   13   }
   14   footer();
   15 }
   16 
   17 sub header
   18 {
   19   print <<END;
   20 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
   21 <HTML>
   22 <HEAD><TITLE>Bonnie++ V@version@ Benchmark results</TITLE>
   23 <STYLE type="text/css">
   24 TD.header {text-align: center; backgroundcolor: "#CCFFFF" }
   25 TD.rowheader {text-align: center; backgroundcolor: "#CCCFFF" }
   26 TD.size {text-align: center; backgroundcolor: "#CCCFFF" }
   27 TD.ksec {text-align: center; fontstyle: italic }
   28 </STYLE>
   29 <BODY>
   30 <TABLE ALIGN=center BORDER=3 CELLPADDING=2 CELLSPACING=1>
   31 <TR><TD COLSPAN=2 class="header"></TD>
   32 <TD COLSPAN=6 class="header"><FONT SIZE=+2><B>Sequential Output</B></FONT></TD>
   33 <TD COLSPAN=4 class="header"><FONT SIZE=+2><B>Sequential Input</B></FONT></TD>
   34 <TD COLSPAN=2 ROWSPAN=2 class="header"><FONT SIZE=+2><B>Random<BR>Seeks</B></FONT></TD>
   35 <TD COLSPAN=1 class="header"></TD>
   36 <TD COLSPAN=6 class="header"><FONT SIZE=+2><B>Sequential Create</B></FONT></TD>
   37 <TD COLSPAN=6 class="header"><FONT SIZE=+2><B>Random Create</B></FONT></TD>
   38 </tr>
   39 END
   40   print "<TR><TD></TD>";
   41   print "<TD>Size:Chunk Size</TD>";
   42   heading("Per Char"); heading("Block"); heading("Rewrite");
   43   heading("Per Char"); heading("Block");
   44   print "<TD>Num Files</TD>";
   45   heading("Create"); heading("Read"); heading("Delete");
   46   heading("Create"); heading("Read"); heading("Delete");
   47   print "</TR>";
   48 
   49   print "<TR><TD COLSPAN=2></TD>";
   50   my $i;
   51 
   52   for($i = 0; $i < 5; $i++)
   53   {
   54     print '<TD class="ksec"><FONT SIZE=-2>K/sec</FONT></TD>'
   55         . '<TD class="ksec"><FONT SIZE=-2>% CPU</FONT></TD>';
   56   }
   57   print '<TD class="ksec"><FONT SIZE=-2>/ sec</FONT></TD>'
   58       . '<TD class="ksec"><FONT SIZE=-2>% CPU</FONT></TD>';
   59   print "<TD></TD>";
   60   for($i = 0; $i < 6; $i++)
   61   {
   62     print '<TD class="ksec"><FONT SIZE=-2>/ sec</FONT></TD>'
   63         . '<TD class="ksec"><FONT SIZE=-2>% CPU</FONT></TD>';
   64   }
   65   print "</TR>\n";
   66 }
   67 
   68 sub heading
   69 {
   70   my($item) = @_;
   71   print "<TD COLSPAN=2>" . $item . "</TD>";
   72 }
   73 
   74 sub footer
   75 {
   76   print <<END;
   77 </TABLE>
   78 </BODY>
   79 </HTML>
   80 END
   81 }
   82 
   83 sub process
   84 {
   85   my($line) = @_;
   86 
   87   chop($line);
   88   my $name = $line;
   89   $name =~ s/,.*$//;
   90   $line =~ s/$name,//;
   91   my $size = $line;
   92   $size =~ s/,.*$//;
   93   $line =~ s/$size,//;
   94   print '<TR><TD class="rowheader"><FONT SIZE=+1><B>'
   95          . $name . "</B></FONT></TD>";
   96   print '<TD class="size">' . $size . "</TD>";
   97 
   98 
   99   $line =~ s/,/<\/TD><TD>/g;
  100   print "<TD>" . $line . "</TD></TR>\n";
  101 }