summaryrefslogtreecommitdiff
path: root/tools/codecscan.pl
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2008-10-20 12:11:29 +0000
committerDaniel Stenberg <daniel@haxx.se>2008-10-20 12:11:29 +0000
commit761366d8b84e523a39d182779d4824fefa6aae7f (patch)
tree028820f1d16cb9e0169e0d9fb6dddc89db3548aa /tools/codecscan.pl
parent6c19b8824518619b7fbfb6dfd1061539e3c9cb82 (diff)
run this script in your build dir to get a summary table presented with memory
consumptions used by all the codecs built git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18846 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'tools/codecscan.pl')
-rwxr-xr-xtools/codecscan.pl58
1 files changed, 58 insertions, 0 deletions
diff --git a/tools/codecscan.pl b/tools/codecscan.pl
new file mode 100755
index 0000000000..c21295d49f
--- /dev/null
+++ b/tools/codecscan.pl
@@ -0,0 +1,58 @@
+#!/usr/bin/perl
+
+$codecs="apps/codecs";
+
+opendir(DIR, $codecs) || die "can't opendir $some_dir: $!";
+my @maps = sort grep { /\.map/ && -f "$codecs/$_" } readdir(DIR);
+closedir DIR;
+
+print "Codec IRAM IBSS BSS Text \n";
+
+
+for my $m (@maps) {
+ my ($iram, $ibss, $bss, $text)=scanmap($m);
+ printf("%-15s: %5d %5d %6d %6d\n",
+ $m, $iram, $ibss, $bss, $text);
+}
+
+sub scanmap {
+ my ($file)=@_;
+
+ open(F, "<$codecs/$file");
+
+ while(<F>) {
+ if(/[ \t]*0x([0-9a-f]+) *_plugin_start_addr/) {
+ #print "CODEC START: $1\n";
+ $codec = hex($1);
+ }
+ elsif(/[ \t]*0x([0-9a-f]+) *plugin_bss_start/) {
+ #print "CODEC BSS START: $1\n";
+ $codecbss = hex($1);
+ }
+ elsif(/[ \t]*0x([0-9a-f]+) *_plugin_end_addr/) {
+ #print "CODEC END: $1\n";
+ $bss = (hex($1) - $codecbss);
+ $codec = (hex($1) - $codec - $bss);
+ }
+ elsif(/[ \t]*0x([0-9a-f]+) *iramstart/) {
+ #print "IRAM START: $1\n";
+ $iram = hex($1);
+ }
+ elsif(/[ \t]*0x([0-9a-f]+) *iramend/) {
+ #print "IRAM END: $1\n";
+ $iram = (hex($1) - $iram);
+ }
+ elsif(/[ \t]*0x([0-9a-f]+) *iedata/) {
+ #print "IBSS START: $1\n";
+ $ibss = hex($1);
+ }
+ elsif(/[ \t]*0x([0-9a-f]+) *iend/) {
+ #print "IBSS END: $1\n";
+ $ibss = (hex($1) - $ibss);
+ }
+ }
+
+ close(F);
+
+ return ($iram, $ibss, $bss, $codec);
+}