[Libreoffice-commits] core.git: bin/ios-mapfile-statistics

Tor Lillqvist tml at collabora.com
Thu Apr 24 23:28:49 PDT 2014


 bin/ios-mapfile-statistics |   20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

New commits:
commit 48201fc93db1cc49b804eca99bb41f2699e61d1f
Author: Tor Lillqvist <tml at collabora.com>
Date:   Fri Apr 25 09:06:50 2014 +0300

    Add -s option to show a sorted list of symbols by size instead
    
    Change-Id: I2c6c46f4f570f4999154daa7e0f84f6ecd6f2d79

diff --git a/bin/ios-mapfile-statistics b/bin/ios-mapfile-statistics
index 0ae2753..2e16ed7 100755
--- a/bin/ios-mapfile-statistics
+++ b/bin/ios-mapfile-statistics
@@ -2,9 +2,16 @@
 
 use strict;
 
+use Getopt::Std;
+
+my %args;
+
+getopts('s', \%args);
+
 my $state = 0;
 my %libofnumber;
 my %sizeoflib;
+my %sizeofsym;
 
 while (<>) {
   if ($state == 0 && m!^# Object files:!) {
@@ -19,9 +26,18 @@ while (<>) {
     if (defined($libofnumber{$2})) {
       $sizeoflib{$libofnumber{$2}} += hex($1);
     }
+    $sizeofsym{$3} = hex($1);
   }
 }
 
-foreach (sort keys(%sizeoflib)) {
-  print $_, ": ", $sizeoflib{$_}, "\n";
+if ($args{'s'}) {
+  # Print symbols in reverse size order
+  foreach (sort { $sizeofsym{$b} <=> $sizeofsym{$a} } keys(%sizeofsym)) {
+    print $_, ": ", $sizeofsym{$_}, "\n";
+  }
+} else {
+  # Print libraries in reverse size order
+  foreach (sort { $sizeoflib{$b} <=> $sizeoflib{$a} } keys(%sizeoflib)) {
+    print $_, ": ", $sizeoflib{$_}, "\n";
+  }
 }


More information about the Libreoffice-commits mailing list