-
Notifications
You must be signed in to change notification settings - Fork 1
/
bon_csv2html
101 lines (91 loc) · 2.49 KB
/
bon_csv2html
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#!/usr/bin/perl
{
header();
my $line;
while($line = <STDIN>)
{
while($line =~ /^name,/)
{
$line = <STDIN>;
}
process($line);
}
footer();
}
sub header
{
print <<END;
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<HTML>
<HEAD><TITLE>Bonnie++ V1.04 Benchmark results</TITLE>
<STYLE type="text/css">
TD.header {text-align: center; backgroundcolor: "#CCFFFF" }
TD.rowheader {text-align: center; backgroundcolor: "#CCCFFF" }
TD.size {text-align: center; backgroundcolor: "#CCCFFF" }
TD.ksec {text-align: center; fontstyle: italic }
</STYLE>
<BODY>
<TABLE ALIGN=center BORDER=3 CELLPADDING=2 CELLSPACING=1>
<TR><TD COLSPAN=2 class="header"></TD>
<TD COLSPAN=6 class="header"><FONT SIZE=+2><B>Sequential Output</B></FONT></TD>
<TD COLSPAN=4 class="header"><FONT SIZE=+2><B>Sequential Input</B></FONT></TD>
<TD COLSPAN=2 ROWSPAN=2 class="header"><FONT SIZE=+2><B>Random<BR>Seeks</B></FONT></TD>
<TD COLSPAN=1 class="header"></TD>
<TD COLSPAN=6 class="header"><FONT SIZE=+2><B>Sequential Create</B></FONT></TD>
<TD COLSPAN=6 class="header"><FONT SIZE=+2><B>Random Create</B></FONT></TD>
</tr>
END
print "<TR><TD></TD>";
print "<TD>Size:Chunk Size</TD>";
heading("Per Char"); heading("Block"); heading("Rewrite");
heading("Per Char"); heading("Block");
print "<TD>Num Files</TD>";
heading("Create"); heading("Read"); heading("Delete");
heading("Create"); heading("Read"); heading("Delete");
print "</TR>";
print "<TR><TD COLSPAN=2></TD>";
my $i;
for($i = 0; $i < 5; $i++)
{
print '<TD class="ksec"><FONT SIZE=-2>K/sec</FONT></TD>'
. '<TD class="ksec"><FONT SIZE=-2>% CPU</FONT></TD>';
}
print '<TD class="ksec"><FONT SIZE=-2>/ sec</FONT></TD>'
. '<TD class="ksec"><FONT SIZE=-2>% CPU</FONT></TD>';
print "<TD></TD>";
for($i = 0; $i < 6; $i++)
{
print '<TD class="ksec"><FONT SIZE=-2>/ sec</FONT></TD>'
. '<TD class="ksec"><FONT SIZE=-2>% CPU</FONT></TD>';
}
print "</TR>\n";
}
sub heading
{
my($item) = @_;
print "<TD COLSPAN=2>" . $item . "</TD>";
}
sub footer
{
print <<END;
</TABLE>
</BODY>
</HTML>
END
}
sub process
{
my($line) = @_;
chop($line);
my $name = $line;
$name =~ s/,.*$//;
$line =~ s/$name,//;
my $size = $line;
$size =~ s/,.*$//;
$line =~ s/$size,//;
print '<TR><TD class="rowheader"><FONT SIZE=+1><B>'
. $name . "</B></FONT></TD>";
print '<TD class="size">' . $size . "</TD>";
$line =~ s/,/<\/TD><TD>/g;
print "<TD>" . $line . "</TD></TR>\n";
}