stat: Sort by dwz-dt, not dwz/dt.
authorJan Kratochvil <jan.kratochvil@redhat.com>
Mon, 3 Aug 2020 08:35:04 +0000 (10:35 +0200)
committerJan Kratochvil <jan.kratochvil@redhat.com>
Mon, 3 Aug 2020 08:35:04 +0000 (10:35 +0200)
stat

diff --git a/stat b/stat
index 4972065..fe70111 100755 (executable)
--- a/stat
+++ b/stat
@@ -72,7 +72,7 @@ sub onesrcrpm($) {
   } else {
     ++$equalbyfile;
   }
   } else {
     ++$equalbyfile;
   }
-  push @{$filestat{$dwzfilesize/$dtfilesize}},"$srcrpm dwzfilesize=$dwzfilesize dtfilesize=$dtfilesize" if $dtfilesize;
+  push @{$filestat{$dwzfilesize-$dtfilesize}},sprintf("%.2f",100*$dwzfilesize/$dtfilesize).": $srcrpm dwzfilesize=$dwzfilesize dtfilesize=$dtfilesize" if $dtfilesize;
   if ($dwzrpmsize==0&&$dtrpmsize==0) {
     ++$emptybyrpm;
   } elsif ($dwzrpmsize<$dtrpmsize) {
   if ($dwzrpmsize==0&&$dtrpmsize==0) {
     ++$emptybyrpm;
   } elsif ($dwzrpmsize<$dtrpmsize) {
@@ -130,20 +130,17 @@ print "dwzwinbyrpm =$dwzwinbyrpm" ." dtwinbyrpm =$dtwinbyrpm" ." equalbyrpm =$eq
 print "dwzfilesizetot=$dwzfilesizetot"." dtfilesizetot=$dtfilesizetot"." = ".($dwzfilesizetot/$dtfilesizetot*100)."%\n";
 print " dwzrpmsizetot=$dwzrpmsizetot" ."  dtrpmsizetot=$dtrpmsizetot" ." = ".( $dwzrpmsizetot/ $dtrpmsizetot*100)."%\n";
 #print "equal: $_\n" for @{$filestat{1}};
 print "dwzfilesizetot=$dwzfilesizetot"." dtfilesizetot=$dtfilesizetot"." = ".($dwzfilesizetot/$dtfilesizetot*100)."%\n";
 print " dwzrpmsizetot=$dwzrpmsizetot" ."  dtrpmsizetot=$dtrpmsizetot" ." = ".( $dwzrpmsizetot/ $dtrpmsizetot*100)."%\n";
 #print "equal: $_\n" for @{$filestat{1}};
-my @sorted=map({ my $r=$_; map(($_,$r),@{$filestat{$_}}); } sort {$a<=>$b;} keys %filestat);
+my @sorted=map @{$filestat{$_}},sort {$a<=>$b;} keys(%filestat);
 sub out($) {
   my($ix)=@_;
 sub out($) {
   my($ix)=@_;
-  my $name=$sorted[2*$ix+0];
-  my $ratio=$sorted[2*$ix+1];
-  print(sprintf("%.2f",$ratio*100)."%: $name\n");
+  print($sorted[$ix]."\n");
 }
 }
-my $sorted=@sorted/2;
 if (@ARGV) {
 if (@ARGV) {
-  out $_ for 0..$sorted-1;
+  out $_ for 0..$#sorted;
 } else {
   my $p=5;
   out $_ for 0..$p-1;
 } else {
   my $p=5;
   out $_ for 0..$p-1;
-  out $_ for $sorted-$p..$sorted-1;
+  out $_ for @sorted-$p..$#sorted;
 }
 print "debuginfod download size: ";
 my $dwzsizetot=0;
 }
 print "debuginfod download size: ";
 my $dwzsizetot=0;