First version, development moved to 5110-connected machine
[gnokii.git] / bigfunc
diff --git a/bigfunc b/bigfunc
new file mode 100755 (executable)
index 0000000..231e964
--- /dev/null
+++ b/bigfunc
@@ -0,0 +1,28 @@
+#! /usr/bin/perl
+
+use strict;
+use warnings;
+
+open NM,"-|",'m68k-pic-coff-nm gnokii/gnokii.coff|sort'
+               or die "nm: $!";
+my(%big,$prevhex,$prevsym,$tot);
+while (<NM>) {
+       chomp;
+       /^([0-9a-f]+) (\w) (.*)$/ or die "parse: $_";
+       my $hex=hex $1;
+       my $type=$2;
+       my $sym=$3;
+       next if $type!~/[tT]/ || $sym=~/^\./ || $sym=~/^L\d+$/ || $sym eq "__gnu_compiled_c" || $sym eq "gcc2_compiled.";
+       if ($prevhex) {
+               warn "dup: $prevsym" if exists $big{$prevsym};
+               $big{$prevsym}=$hex-$prevhex;
+               $tot+=$hex-$prevhex;
+               }
+       $prevhex=$hex;
+       $prevsym=$sym;
+       }
+close NM;
+$big{"_TOTAL"}=$tot;
+for (sort { $big{$b} <=> $big{$a} } keys %big) {
+       printf "%4u %s\n",$big{$_},$_;
+       }