diff -urN linux-2.6.5-tiny.orig/scripts/inline_hunter/00.driver linux-2.6.5-tiny/scripts/inline_hunter/00.driver --- linux-2.6.5-tiny.orig/scripts/inline_hunter/00.driver Thu Jan 1 03:00:00 1970 +++ linux-2.6.5-tiny/scripts/inline_hunter/00.driver Mon Apr 12 08:52:21 2004 @@ -0,0 +1,30 @@ +#!/bin/sh + +. ./conf + +function doit() { + echo "#" "$@" + "./$@" +} + +echo "*** This will take lots of time - kernel compile x3 ***" +echo +echo "Please configure kernel in $prefix with MEASURE_INLINES and, optionally," +echo "allyesconfig. Please disable CONFIG_DEBUG_SPINLOCK, CONFIG_DEBUG_PAGEALLOC" +echo "and CONFIG_DEBUG_SPINLOCK_SLEEP" +echo +echo "Make sure you did NOT ran make in the $prefix!" +echo +echo -n "Press to start or Ctrl-C to exit: "; read junk + +{ +doit 10.build_and_log +doit 15.find_inlines +doit 20.add_measuring_functions +doit 30.build_and_find_errors +doit 40.comment_errors_out +doit 50.build +doit 60.calculate_inline_sizes +doit 70.sort_by_size +doit 80.match +} 2>&1 # | tee driver.log diff -urN linux-2.6.5-tiny.orig/scripts/inline_hunter/10.build_and_log linux-2.6.5-tiny/scripts/inline_hunter/10.build_and_log --- linux-2.6.5-tiny.orig/scripts/inline_hunter/10.build_and_log Thu Jan 1 03:00:00 1970 +++ linux-2.6.5-tiny/scripts/inline_hunter/10.build_and_log Sun Apr 11 23:32:42 2004 @@ -0,0 +1,23 @@ +#!/bin/sh + +. ./conf + +( +cd $prefix +$make 2>&1 +) \ +| grep -E '.c:[0-9]+: warning: ' \ +| grep -F ' is deprecated (declared at ' \ +| sed 's/:[0-9]*: warning: `/ /' \ +| sed "s/' is deprecated (declared at / /" \ +| sed 's/:[0-9]*)$//' \ +>make_stage1_temp.log +# We got here: +# +#init/main.c strlen include/asm/string.h +#init/main.c strncmp include/asm/string.h +#init/main.c strchr include/asm/string.h +#init/main.c strchr include/asm/string.h +#init/main.c unlock_kernel include/linux/smp_lock.h +#init/main.c lock_kernel include/linux/smp_lock.h +#init/main.c setup_per_cpu_areas init/main.c diff -urN linux-2.6.5-tiny.orig/scripts/inline_hunter/15.find_inlines linux-2.6.5-tiny/scripts/inline_hunter/15.find_inlines --- linux-2.6.5-tiny.orig/scripts/inline_hunter/15.find_inlines Thu Jan 1 03:00:00 1970 +++ linux-2.6.5-tiny/scripts/inline_hunter/15.find_inlines Mon Apr 12 08:00:26 2004 @@ -0,0 +1,49 @@ +#!/bin/sh + +. ./conf + +cat make_stage1_temp.log \ +| sort | uniq \ +>make_stage1.log +# This is used in next stage +# +#arch/i386/kernel/acpi/boot.c acpi_blacklisted include/linux/acpi.h +#arch/i386/kernel/acpi/boot.c acpi_irq_balance_set include/asm/acpi.h +#arch/i386/kernel/acpi/boot.c acpi_madt_oem_check include/asm-i386/mach-default/mach_mpparse.h +#arch/i386/kernel/acpi/boot.c acpi_parse_madt_ioapic_entries arch/i386/kernel/acpi/boot.c +#arch/i386/kernel/acpi/boot.c clustered_apic_check include/asm-i386/mach-default/mach_apic.h +#arch/i386/kernel/acpi/boot.c disable_acpi include/asm/acpi.h +#arch/i386/kernel/acpi/boot.c fix_to_virt include/asm/fixmap.h +#arch/i386/kernel/acpi/boot.c strncmp include/asm/string.h + +cat make_stage1.log \ +| cut -d' ' -f2-3 \ +| sort | uniq \ +>inline_defined_in.log +# FYI only +# +#BDEV_I fs/block_dev.c +#BLEND_OP crypto/sha256.c +#BLEND_OP crypto/sha512.c +#CA drivers/net/82596.c +#CA drivers/net/lp486e.c +#CIFS_I fs/cifs/cifsglob.h +#CIFS_SB fs/cifs/cifsglob.h + +cat make_stage1.log \ +| cut -d' ' -f2-99 \ +| sort | uniq -c | sort -r \ +| sed $'s/\x9/ /g' \ +| sed 's/^ +//' \ +>inline_count.log +# Note that there can be different inlines with the same name +# +#322 __memset_generic include/asm/string.h +#322 __constant_c_memset include/asm/string.h +#322 __constant_c_and_count_memset include/asm/string.h +#266 kmalloc include/linux/slab.h +#262 __memcpy include/asm/string.h +#249 __constant_memcpy include/asm/string.h +#203 get_current include/asm/current.h +#150 current_thread_info include/asm/thread_info.h +#120 variable_test_bit include/asm/bitops.h diff -urN linux-2.6.5-tiny.orig/scripts/inline_hunter/20.add_measuring_functions linux-2.6.5-tiny/scripts/inline_hunter/20.add_measuring_functions --- linux-2.6.5-tiny.orig/scripts/inline_hunter/20.add_measuring_functions Thu Jan 1 03:00:00 1970 +++ linux-2.6.5-tiny/scripts/inline_hunter/20.add_measuring_functions Sun Apr 11 23:37:16 2004 @@ -0,0 +1,36 @@ +#!/bin/sh + +. ./conf + +function add_test() { + echo "void inline_${1}_0(void) { ${1}(); }" + echo "void inline_${1}_1(void) { ${1}(0); }" + echo "void inline_${1}_2(void) { ${1}(0,0); }" + echo "void inline_${1}_3(void) { ${1}(0,0,0); }" + echo "void inline_${1}_4(void) { ${1}(0,0,0,0); }" + echo "void inline_${1}_5(void) { ${1}(0,0,0,0,0); }" + echo "void inline_${1}_6(void) { ${1}(0,0,0,0,0,0); }" +} + +{ +cat make_stage1.log +echo +} | { +old_file='' +while read file func include junk; do + if test "$old_file" != "$file"; then + if test "$old_file"; then + echo "void inline_end(void) {}" >>"$prefix$old_file" + fi + echo -n "$file " + old_file="$file" + if test "$file"; then + echo >>"$prefix$file" + fi + fi + if test "$file"; then + add_test "$func" >>"$prefix$file" + fi +done +} +echo diff -urN linux-2.6.5-tiny.orig/scripts/inline_hunter/30.build_and_find_errors linux-2.6.5-tiny/scripts/inline_hunter/30.build_and_find_errors --- linux-2.6.5-tiny.orig/scripts/inline_hunter/30.build_and_find_errors Thu Jan 1 03:00:00 1970 +++ linux-2.6.5-tiny/scripts/inline_hunter/30.build_and_find_errors Sun Apr 11 22:55:30 2004 @@ -0,0 +1,12 @@ +#!/bin/sh + +. ./conf + +( +cd tree +$make 2>&1 +) \ +| grep -E '.c:[0-9]+: error: too [a-z]* arguments to function `' \ +| sed 's/: error: .*$//' \ +| sed 's/:/ /g' \ +>errors_at.log diff -urN linux-2.6.5-tiny.orig/scripts/inline_hunter/40.comment_errors_out linux-2.6.5-tiny/scripts/inline_hunter/40.comment_errors_out --- linux-2.6.5-tiny.orig/scripts/inline_hunter/40.comment_errors_out Thu Jan 1 03:00:00 1970 +++ linux-2.6.5-tiny/scripts/inline_hunter/40.comment_errors_out Sun Apr 11 23:18:28 2004 @@ -0,0 +1,48 @@ +#!/bin/sh + +. ./conf + +tmp=/tmp/$$.c + +function remove_lines() { + local file="$1" + shift + local cnt=1 + local line + + # TODO: read -r strips leading spaces. fix this + cat "$file" \ + | while read -r line; do + if test "$cnt" = "$1"; then + printf "%s\n" "//$line" + shift + while test "$1" && test "$cnt" -ge "$1"; do + shift + done + else + printf "%s\n" "$line" + fi + cnt=$((cnt+1)) + done >$tmp + mv $tmp "$file" +} + +{ +cat errors_at.log +echo +} | { +old_file='' +lines='' +while read file line junk; do + if test "$old_file" != "$file"; then + if test "$old_file"; then + echo -n "$old_file " + remove_lines "$prefix$old_file" $lines + fi + old_file="$file" + lines='' + fi + lines="$lines$line " +done +} +echo diff -urN linux-2.6.5-tiny.orig/scripts/inline_hunter/50.build linux-2.6.5-tiny/scripts/inline_hunter/50.build --- linux-2.6.5-tiny.orig/scripts/inline_hunter/50.build Thu Jan 1 03:00:00 1970 +++ linux-2.6.5-tiny/scripts/inline_hunter/50.build Sun Apr 11 23:18:38 2004 @@ -0,0 +1,8 @@ +#!/bin/sh + +. ./conf + +( +cd tree +$make +) diff -urN linux-2.6.5-tiny.orig/scripts/inline_hunter/60.calculate_inline_sizes linux-2.6.5-tiny/scripts/inline_hunter/60.calculate_inline_sizes --- linux-2.6.5-tiny.orig/scripts/inline_hunter/60.calculate_inline_sizes Thu Jan 1 03:00:00 1970 +++ linux-2.6.5-tiny/scripts/inline_hunter/60.calculate_inline_sizes Sun Apr 11 23:21:00 2004 @@ -0,0 +1,33 @@ +#!/bin/sh + +. ./conf + +find $prefix -name '*.o' \ +| grep -Fv 'built-in.o' \ +| { +while read file; do + echo "$file" >&2 + nm "$file" | grep ' T inline_' | sort \ + | while read -r line; do + echo "$line $file" + done +done +} | { +old_name='inline_end' +old_addr=0 +old_junk='' +while read -r addr t name junk; do + diff=$(( 0x$addr - 0x$old_addr )) + if test "$old_name" != "inline_end"; then + #printf "%s %8i %s\n" "$old_addr" "$diff" "$old_name" + printf "%i %s %s\n" "$diff" "$old_name" "$old_junk" + fi + old_name="$name" + old_addr="$addr" + old_junk="$junk" +done +} \ +| sed 's/ inline_/ /' \ +| sed 's/_[0-9] / /' \ +| sort | uniq \ +> inline_sizes.log diff -urN linux-2.6.5-tiny.orig/scripts/inline_hunter/70.sort_by_size linux-2.6.5-tiny/scripts/inline_hunter/70.sort_by_size --- linux-2.6.5-tiny.orig/scripts/inline_hunter/70.sort_by_size Thu Jan 1 03:00:00 1970 +++ linux-2.6.5-tiny/scripts/inline_hunter/70.sort_by_size Sun Apr 11 23:13:21 2004 @@ -0,0 +1,8 @@ +#!/bin/sh + +. ./conf + +cat inline_sizes.log \ +| cut -d' ' -f1-2 \ +| sort -nr | uniq \ +>inline_sizes_sorted.log diff -urN linux-2.6.5-tiny.orig/scripts/inline_hunter/80.match linux-2.6.5-tiny/scripts/inline_hunter/80.match --- linux-2.6.5-tiny.orig/scripts/inline_hunter/80.match Thu Jan 1 03:00:00 1970 +++ linux-2.6.5-tiny/scripts/inline_hunter/80.match Mon Apr 12 08:39:25 2004 @@ -0,0 +1,22 @@ +#!/bin/sh + +./helper.80 inline_count.log inline_sizes_sorted.log \ +| { +wasted=0 +# Pretty printing +echo "Large inlines with multiple callers:" +echo +echo "Size Uses Wasted Name and definition" +echo "===== ==== ====== ================================================" +while read -r size count name defined; do + if test "$size" -gt 39 && test "$count" -gt 1; then + # Formula is a bit arbitrary + w=$(( (size-20)*(count-1) )) + wasted=$(( wasted + w )) + printf "%5i %4i %6i %s\t%s\n" "$size" "$count" "$w" "$name" "$defined" + fi +done +echo " ======" +printf "%5s %4s %6i %s\n" " " " " "$wasted" "Total bytes wasted" +} \ +>inline_sizes_count_defloc.log diff -urN linux-2.6.5-tiny.orig/scripts/inline_hunter/conf linux-2.6.5-tiny/scripts/inline_hunter/conf --- linux-2.6.5-tiny.orig/scripts/inline_hunter/conf Thu Jan 1 03:00:00 1970 +++ linux-2.6.5-tiny/scripts/inline_hunter/conf Sun Apr 11 23:33:37 2004 @@ -0,0 +1,12 @@ +#!/bin/sh + +prefix=tree/ + +function mk() { + CFLAGS=-std=gnu99 \ + GCC_EXEC_PREFIX=/usr/app/gcc-3.3.3/lib/gcc-lib/ \ + QTDIR=/usr/app/qt-3.0.3posix \ + make -k bzImage +} + +make=mk diff -urN linux-2.6.5-tiny.orig/scripts/inline_hunter/helper.80 linux-2.6.5-tiny/scripts/inline_hunter/helper.80 --- linux-2.6.5-tiny.orig/scripts/inline_hunter/helper.80 Thu Jan 1 03:00:00 1970 +++ linux-2.6.5-tiny/scripts/inline_hunter/helper.80 Mon Apr 12 08:39:06 2004 @@ -0,0 +1,37 @@ +#!/usr/bin/python2.1 + +import sys, re + +count={} +defined={} + +f_count_func_defined = open(sys.argv[1]) +f_size_func = open(sys.argv[2]) + +count_func_defined = re.compile(r" *(\d+) (\S+) (\S+)") +size_func = re.compile(r" *(\d+) (\S+)") + +for l in f_count_func_defined.xreadlines(): + g = count_func_defined.match(l) + if not g: + print "error" + sys.exit(1) + c, name, d = g.groups() + if count.has_key(name): + count[name] += int(c) + defined[name] += " "+d + else: + count[name] = int(c) + defined[name] = d + +while 1: + l=f_size_func.readline() + if l=='': + break + l=l[:len(l)-1] + g = size_func.match(l) + if not g: + print "error" + sys.exit(1) + sz, name = g.groups() + print sz, count[name], name, defined[name]