Add optional CURRENT_ATA in runcurrent(). On MPIO HD200 powering ata takes ~100mA...
[kugel-rb.git] / utils / parse_testcodec.pl
blobc31b54ebd06ba19d87187bce344866fd43011c51
1 #!/usr/bin/perl
3 #parse test codec output files and give wiki formatted results.
6 if(scalar(@ARGV) != 2 && scalar(@ARGV) != 1){
7 print "Usage: parser_testcodec.pl new_results old_results (compares two results)\n".
8 " parser_testcodec.pl new_results (formats just one result)\n";
11 my %newfile;
13 #open new benchmark file
14 open FILE, $ARGV[0];
15 while ($line = <FILE>){
16 chomp $line;
17 $filename=$line;
18 #print $filename."\n";
20 $line = <FILE>;
21 $line = <FILE>;
22 $line =~ m/-\s([0-9\.]*)s/;
23 $decodetime = $1;
25 $line = <FILE>;
26 $line = <FILE>;
27 $line =~ m/([0-9\.]*)\%/;
28 $realtime = $1;
30 $line = <FILE>;
31 $line =~ m/([0-9\.]*)MHz/;
32 $mhz=$1;
33 #consume blank line
34 $line = <FILE>;
36 #store in hash
37 $newfile{$filename} = [$realtime, $mhz, $decodetime];
39 #| flac_5.flac | 175906 of 175906 | Decode time - 27.74s | File duration - 175.90s | 634.10% realtime | 12.61MHz |
40 #print "| $filename | Decode time - $decodetime"."s | $realtime"."% realtime | $mhz"."MHz |\n";
41 #print "$filename\t$realtime\t$mhz\n";
46 #open old benchmark file
47 my %oldfile;
48 open FILE, $ARGV[1];
49 while ($line = <FILE>){
50 chomp $line;
51 $filename=$line;
52 #print $filename."\n";
54 $line = <FILE>;
55 $line = <FILE>;
56 $line =~ m/-\s([0-9\.]*)s/;
57 $decodetime = $1;
59 $line = <FILE>;
60 $line = <FILE>;
61 $line =~ m/([0-9\.]*)\%/;
62 $realtime = $1;
64 $line = <FILE>;
65 $line =~ m/([0-9\.]*)MHz/;
66 $mhz=$1;
68 #consume blank line
69 $line = <FILE>;
71 #store in hash
72 $oldfile{$filename} = [$realtime, $mhz, $decodetime];
78 my @keylist;
80 @keylist = sort {$a cmp $b} keys(%newfile);
81 #print for wiki
82 my $oldkey = "nothing_";
83 foreach $key (@keylist){
85 #check if this is a new format and add the table heading
86 $oldkey =~ m/([a-z1-9]*)/;
88 if(!($key =~ m/$1_/i)){
89 print "| *MP3* |||||\n" if($key =~ m/lame/);
90 print "| *AAC-LC* |||||\n" if($key =~ m/nero/);
91 print "| *Vorbis* |||||\n" if($key =~ m/vorbis/);
92 print "| *WMA Standard* |||||\n" if($key =~ m/wma_/);
93 print "| *WAVPACK* |||||\n" if($key =~ m/wv/);
94 print "| *Nero AAC-HE* |||||\n" if($key =~ m/aache/);
95 print "| *Apple Lossless* |||||\n" if($key =~ m/applelossless/);
96 print "| *Monkeys Audio* |||||\n" if($key =~ m/ape/);
97 print "| *Musepack* |||||\n" if($key =~ m/mpc/);
98 print "| *FLAC* |||||\n" if($key =~ m/flac/);
99 print "| *Cook (RA)* |||||\n" if($key =~ m/cook/);
100 print "| *AC3 (A52)* |||||\n" if($key =~ m/a52/);
101 print "| *atrac3* |||||\n" if($key =~ m/atrac3/);
102 print "| *True Audio* |||||\n" if($key =~ m/true/);
103 print "| *MP2* |||||\n" if($key =~ m/toolame/);
104 #potiential future rockbox codecs
105 print "| *atrac* |||||\n" if($key =~ m/atrac1/);
106 print "| *WMA Professional* |||||\n" if($key =~ m/wmapro/);
107 print "| *WMA Lossless* |||||\n" if($key =~ m/wmal/);
111 if(defined($oldfile{$key})){
112 $str=sprintf("%1.2f",($oldfile{$key}->[1]-$newfile{$key}->[1])/$oldfile{$key}->[1]*100+100 );
113 print "| $key | $newfile{$key}->[0]"."% realtime | Decode time - $newfile{$key}->[2]s | ".sprintf("%2.2f",$newfile{$key}->[1])."MHz | ".$str."%|\n";
114 }elsif(scalar(@ARGV) ==2){
115 print "| $key | $newfile{$key}->[0]"."% realtime | Decode time - $newfile{$key}->[2]s | $newfile{$key}->[1]"."MHz | - |\n";
116 } else{
118 print "| $key | ". $newfile{$key}->[0]."% realtime | Decode time - $newfile{$key}->[2]s | ".sprintf("%2.2f",$newfile{$key}->[1])."MHz |\n";
120 $oldkey=$key;