Advertisement
Guest User

Untitled

a guest
Feb 20th, 2010
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 1.97 KB | None | 0 0
  1.  
  2. #parse test codec output files.  
  3.  
  4. # flac_5.flac
  5. # 175906 of 175906
  6. # Decode time - 27.74s
  7. # File duration - 175.90s
  8. # 634.10% realtime
  9. #12.61MHz needed for realtime
  10.  
  11. if(scalar(@ARGV) != 2 && scalar(@ARGV) != 1){
  12.     print "Ussage: parser_testcodec.pl new_results old_results\n        parser_testcodec.pl new_results\n";  
  13. }
  14.  
  15. my %newfile;
  16.  
  17. #open new benchmark file
  18. open FILE, $ARGV[0];
  19. while ($line = <FILE>){
  20.     chomp $line;
  21.     $filename=$line;
  22.     #print $filename."\n";
  23.    
  24.     $line = <FILE>;
  25.     $line = <FILE>;
  26.     $line =~ m/-\s([0-9\.]*)s/;
  27.     $decodetime = $1;
  28.    
  29.     $line = <FILE>;
  30.     $line = <FILE>;
  31.     $line =~ m/([0-9\.]*)\%/;
  32.     $realtime = $1;
  33.    
  34.     $line = <FILE>;
  35.     $line =~ m/([0-9\.]*)MHz/;
  36.     $mhz=$1;
  37.     #consume blank line
  38.     $line = <FILE>;
  39.    
  40.     #store in hash
  41.     $newfile{$filename} = [$realtime, $mhz, $decodetime];
  42.    
  43.     #| flac_5.flac | 175906 of 175906 | Decode time - 27.74s | File duration - 175.90s | 634.10% realtime | 12.61MHz |
  44.     #print "| $filename | Decode time - $decodetime"."s | $realtime"."% realtime | $mhz"."MHz |\n";
  45.     #print "$filename\t$realtime\n";
  46.  
  47.    
  48. }  
  49.  
  50. #open old benchmark file
  51. my %oldfile;
  52. open FILE, $ARGV[1];
  53. while ($line = <FILE>){
  54.     chomp $line;
  55.     $filename=$line;
  56.     #print $filename."\n";
  57.    
  58.     $line = <FILE>;
  59.     $line = <FILE>;
  60.     $line =~ m/-\s([0-9\.]*)s/;
  61.     $decodetime = $1;
  62.    
  63.     $line = <FILE>;
  64.     $line = <FILE>;
  65.     $line =~ m/([0-9\.]*)\%/;
  66.     $realtime = $1;
  67.    
  68.     $line = <FILE>;
  69.     $line =~ m/([0-9\.]*)MHz/;
  70.     $mhz=$1;
  71.        
  72.     #consume blank line
  73.     $line = <FILE>;
  74.    
  75.     #store in hash
  76.     $oldfile{$filename} = [$realtime, $mhz, $decodetime];
  77.    
  78.  
  79.    
  80. }
  81.  
  82. #print for wiki
  83.  
  84. foreach $key (keys(%newfile)){
  85.     if(defined($oldfile{$key})){
  86.         print "| $key | $newfile{$key}->[0]"."% realtime | Decode time - $newfile{$key}->[2]s | $newfile{$key}->[1]"."MHz | ".$newfile{$key}->[1]/$oldfile{$key}->[1] ."|\n";
  87.     }else{
  88.         print "| $key | $newfile{$key}->[0]"."% realtime | Decode time - $newfile{$key}->[2]s | $newfile{$key}->[1]"."MHz | - |\n";
  89.     }
  90.  
  91. }
  92.  
  93.    
  94.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement