Small scripts (hacks!) for checking and plotting the Contiki code size

This commit is contained in:
adamdunkels 2008-02-04 23:51:42 +00:00
parent a26d87e09e
commit 264176fe1b
2 changed files with 142 additions and 0 deletions

100
tools/sky/check-size Executable file
View file

@ -0,0 +1,100 @@
#!/usr/bin/perl
@rime = ( "abc", "collect", "ctimer", "ibc", "ipolite", "mesh", "meshconn",
"mh", "neighbor-discovery", "neighbor", "nf", "polite", "queuebuf",
"rime", "rimeaddr", "rimebuf", "rimestats", "rmesh", "rmh",
"route-discovery", "route", "ruc", "rucb",
"rudolph0", "rudolph1", "rudolph2", "sabc", "sibc", "suc",
"trickle", "uc", "timesynch", "nullmac", "xmac" );
@{$rime{$_}} = (0, 0) foreach (@rime);
@sky = ( "battery-sensor", "button-sensor", "cfs-xmem", "clock",
"contiki-sky-main", "ds2411", "energest-arch", "flash", "msp430",
"mtarch",
"i2c", "leds-arch", "light", "radio-sensor", "sht11",
"simple-cc2420-arch", "simple-cc2420", "spi", "slip",
"uart1", "watchdog", "xmem", "rtimer-arch" );
@{$sky{$_}} = (0, 0) foreach (@sky);
@elfloader = ( "elfloader", "elfloader-msp430" );
@{$elfloader{$_}} = (0, 0) foreach (@elfloader);
@core = ( "autostart", "energest", "etimer", "irq", "leds", "list",
"memb", "mt", "print-stats", "process", "procinit",
"profile-aggregates", "profile", "random", "sensors",
"serial", "timer", "timetable", "timetable-aggregate",
"rtimer");
@{$core{$_}} = (0, 0) foreach (@core);
@uip = ( "hc", "psock", "resolv", "slip", "tcpdump", "tcpip", "uaodv-rt", "uaodv",
"uip-fw-drv", "uip-ipchksum", "uip-neighbor", "uip-over-mesh",
"uip-split", "uip-udp-packet", "uip", "uip_arp", "uiplib", "uip-fw");
@{$uip{$_}} = (0, 0) foreach (@uip);
while(<>) {
if(/(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+\w+\s+\w+\/([\w\-]+).o/) {
$filerom = $1;
$fileram = $2 + $3;
$file = $5;
if(defined $rime{$file}) {
@{$rime{$file}} = ($filerom, $fileram);
$rom{"rime"} += $filerom;
$ram{"rime"} += $fileram;
} elsif(defined $sky{$file}) {
@{$sky{$file}} = ($filerom, $fileram);
$rom{"sky"} += $filerom;
$ram{"sky"} += $fileram;
} elsif(defined $elfloader{$file}) {
@{$elfloader{$file}} = ($filerom, $fileram);
$rom{"elfloader"} += $filerom;
$ram{"elfloader"} += $fileram;
} elsif(defined $core{$file}) {
@{$core{$file}} = ($filerom, $fileram);
$rom{"core"} += $filerom;
$ram{"core"} += $fileram;
} elsif(defined $uip{$file}) {
@{$uip{$file}} = ($filerom, $fileram);
$rom{"uip"} += $filerom;
$ram{"uip"} += $fileram;
} else {
@{$other{$file}} = ($filerom, $fileram);
$rom{"other"} += $filerom;
$ram{"other"} += $fileram;
}
}
}
foreach $f (sort keys %rom) {
print "$f $rom{$f} $ram{$f}\n";
}
print "\n\n# core\n";
foreach $f (sort keys %core) {
print "$f $core{$f}[0] $core{$f}[1]\n";
}
print "\n\n# elfloader\n";
foreach $f (sort keys %elfloader) {
print "$f $elfloader{$f}[0] $elfloader{$f}[1]\n";
}
print "\n\n# other\n";
foreach $f (sort keys %other) {
print "$f $other{$f}[0] $other{$f}[1]\n";
}
print "\n\n# rime\n";
foreach $f (sort keys %rime) {
print "$f $rime{$f}[0] $rime{$f}[1]\n";
}
print "\n\n# sky\n";
foreach $f (sort keys %sky) {
print "$f $sky{$f}[0] $sky{$f}[1]\n";
}
print "\n\n# uip\n";
foreach $f (sort keys %uip) {
print "$f $uip{$f}[0] $uip{$f}[1]\n";
}

42
tools/sky/plot-size Normal file
View file

@ -0,0 +1,42 @@
#set terminal x11 persist
#set terminal postscript "Helvetica" 6
set terminal pdf font "Helvetica,5" size 19cm,26cm
set output "size.pdf"
unset xlabel
set ylabel "Bytes"
set boxwidth 0.6
set style fill pattern
#unset xtics
#set key top left Left
set multiplot
set size 1, 0.20
set origin 0, 0.80
set xlabel "Total"
plot \
'size-data' index 0 using :2:xticlabels(1) with boxes title "ROM", \
'size-data' index 0 using :3:xticlabels(1) with boxes title "RAM"
set origin 0, 0.60
set xlabel "Core"
plot \
'size-data' index 1 using :2:xticlabels(1) with boxes title "ROM", \
'size-data' index 1 using :3:xticlabels(1) with boxes title "RAM"
set origin 0, 0.40
set xlabel "Other"
plot \
'size-data' index 3 using :2:xticlabels(1) with boxes title "ROM", \
'size-data' index 3 using :3:xticlabels(1) with boxes title "RAM"
set origin 0, 0.20
set xlabel "Rime"
plot \
'size-data' index 4 using :2:xticlabels(1) with boxes title "ROM", \
'size-data' index 4 using :3:xticlabels(1) with boxes title "RAM"
set origin 0, 0.00
set xlabel "Sky"
plot \
'size-data' index 5 using :2:xticlabels(1) with boxes title "ROM", \
'size-data' index 5 using :3:xticlabels(1) with boxes title "RAM"