aboutsummaryrefslogtreecommitdiffstats
path: root/misc/scripts/combine_bmarks.pl
blob: b6436496e855636603443c2abda38944e962d0fa (plain)
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#!/usr/bin/perl -w

use strict;

my %results;
my %pk;

my %pk_algos;
my %algos;

my %filename_to_desc;

for my $filename (@ARGV) {

    open IN, "<$filename" or die "Couldn't read $filename ($!)\n";

    my $desc = <IN>;
    chomp $desc;

    $results{$desc} = {};

    while(<IN>) {
        if(/(.*): +(.*) Mbytes\/sec/) {
            $results{$desc}{$1} = $2;
            $algos{$1} = undef;
        }
        if(/(.*): (.*) ops \/ second \((.*)\)/) {
            my $alg = "$1";
            $alg = "$alg $3" if defined($3);
            $pk{$desc}{$alg} = $2;
            $pk_algos{$alg} = undef;
        }
    }
}


sub print_table {
    my @columns = sort keys %results;

    print "\n<P>All results are in MiB / second:\n";
    print "<TABLE BORDER CELLSPACING=1>\n<THEAD>\n";

    my %col_index = ();

    my $line = "<TR><TH>Algorithm              ";

    foreach my $col (@columns) {
        $col_index{$col} = length($line);
        $line .= "<TH>" . $col . "   ";
    }

    $line .= "\n<TBODY>\n";

    print $line;

    $line = '';

    foreach my $algo (sort keys %algos) {
        $line = "   <TR><TH>$algo   ";

        for my $col (@columns) {
            my $result = $results{$col}{$algo};
            $result = "-" if not defined($result);

            $result = "<TH>$result";

            $line .= ' ' while(length($line) < ($col_index{$col}));
            $line .= $result;

        }

        print $line, "\n";
        $line = '';
    }

    print "</TABLE>\n";
}


sub print_pk_table {
    my @columns = sort keys %pk;

    print "\n<P>All results are in operations per second:\n";
    print "<TABLE BORDER CELLSPACING=1>\n<THEAD>\n";

    my %col_index = ();

    my $line = "<TR><TH>Algorithm                        ";

    foreach my $col (@columns) {
        $col_index{$col} = length($line);
        $line .= "<TH>" . $col . "   ";
    }

    $line .= "\n<TBODY>\n";

    print $line;

    foreach my $algo (sort keys %pk_algos) {
        my $line = "   <TR><TH>$algo   ";

        for my $col (@columns) {
            my $result = $pk{$col}{$algo};
            $result = '-' if not defined($result);

            $result = "<TH>$result";

            $line .= ' ' while(length($line) < ($col_index{$col}));
            $line .= $result;

        }

        print $line, "\n";
    }

    print "</TABLE>\n";
}

print_table();
print_pk_table();