summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2014-04-25 09:06:50 +0300
committerTor Lillqvist <tml@collabora.com>2014-04-25 09:28:15 +0300
commit48201fc93db1cc49b804eca99bb41f2699e61d1f (patch)
treef11359f75412e55fd962aef13e9bbca819b9f3ee /bin
parent5d55ebe8849c6005e90d78811473b228e615f8cf (diff)
Add -s option to show a sorted list of symbols by size instead
Change-Id: I2c6c46f4f570f4999154daa7e0f84f6ecd6f2d79
Diffstat (limited to 'bin')
-rwxr-xr-xbin/ios-mapfile-statistics20
1 files changed, 18 insertions, 2 deletions
diff --git a/bin/ios-mapfile-statistics b/bin/ios-mapfile-statistics
index 0ae275385ed2..2e16ed72f940 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";
+ }
}