summaryrefslogtreecommitdiff
path: root/bin/ios-mapfile-statistics
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2014-04-22 18:24:56 +0300
committerTor Lillqvist <tml@collabora.com>2014-04-22 18:33:53 +0300
commit613699ebaf97e77c77e7bf2e90100be56299b550 (patch)
tree86e66a265b4c08df1257dfe0daebe23b536648e2 /bin/ios-mapfile-statistics
parent16b81b0dbf70876440b3b980b6f8c707126d1740 (diff)
Script to postprocess linker map files for iOS a bit
Show the total size of code and data linked in from each library. Change-Id: Ibd6e0e15259f338addc30f2d821c794d65676637
Diffstat (limited to 'bin/ios-mapfile-statistics')
-rwxr-xr-xbin/ios-mapfile-statistics27
1 files changed, 27 insertions, 0 deletions
diff --git a/bin/ios-mapfile-statistics b/bin/ios-mapfile-statistics
new file mode 100755
index 000000000000..0ae275385ed2
--- /dev/null
+++ b/bin/ios-mapfile-statistics
@@ -0,0 +1,27 @@
+#!/usr/bin/perl -w
+
+use strict;
+
+my $state = 0;
+my %libofnumber;
+my %sizeoflib;
+
+while (<>) {
+ if ($state == 0 && m!^# Object files:!) {
+ $state = 1;
+ } elsif ($state == 1 && m!^\[ *([0-9]+)\] .*/([-_a-z0-9]+\.a)\(.*!i) {
+ $libofnumber{$1} = $2;
+ } elsif ($state == 1 && m!^# Sections:!) {
+ $state = 2;
+ } elsif ($state == 2 && m!^# Address\s+Size\s+File\s+Name!) {
+ $state = 3;
+ } elsif ($state == 3 && m!^0x[0-9A-F]+\s+(0x[0-9A-F]+)\s+\[ *([0-9]+)\] (.*)!) {
+ if (defined($libofnumber{$2})) {
+ $sizeoflib{$libofnumber{$2}} += hex($1);
+ }
+ }
+}
+
+foreach (sort keys(%sizeoflib)) {
+ print $_, ": ", $sizeoflib{$_}, "\n";
+}