pure_test.sh revision 3b018dd88828ff4d87147b8f84cb273dde310339
3b018dd88828ff4d87147b8f84cb273dde310339vboxsync# pure_test.sh - test the effect of __attribute__((pure)) on a set of
3b018dd88828ff4d87147b8f84cb273dde310339vboxsync# functions.
3b018dd88828ff4d87147b8f84cb273dde310339vboxsync# Mark the functions with EXPERIMENT_PURE where the attribute normally would,
3b018dd88828ff4d87147b8f84cb273dde310339vboxsync# go update this script so it points to the right header and execute it. At
3b018dd88828ff4d87147b8f84cb273dde310339vboxsync# the end you'll get a pt-report.txt showing the fluctuations in the text size.
3b018dd88828ff4d87147b8f84cb273dde310339vboxsync# Copyright (C) 2010 Sun Microsystems, Inc.
3b018dd88828ff4d87147b8f84cb273dde310339vboxsync# This file is part of VirtualBox Open Source Edition (OSE), as
3b018dd88828ff4d87147b8f84cb273dde310339vboxsync# available from http://www.virtualbox.org. This file is free software;
3b018dd88828ff4d87147b8f84cb273dde310339vboxsync# you can redistribute it and/or modify it under the terms of the GNU
3b018dd88828ff4d87147b8f84cb273dde310339vboxsync# General Public License (GPL) as published by the Free Software
3b018dd88828ff4d87147b8f84cb273dde310339vboxsync# Foundation, in version 2 as it comes in the "COPYING" file of the
3b018dd88828ff4d87147b8f84cb273dde310339vboxsync# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
3b018dd88828ff4d87147b8f84cb273dde310339vboxsync# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
3b018dd88828ff4d87147b8f84cb273dde310339vboxsync# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
3b018dd88828ff4d87147b8f84cb273dde310339vboxsync# Clara, CA 95054 USA or visit http://www.sun.com if you need
3b018dd88828ff4d87147b8f84cb273dde310339vboxsync# additional information or have any questions.
3b018dd88828ff4d87147b8f84cb273dde310339vboxsynctest -e ${HEADER}.bak || kmk_cp $HEADER ${HEADER}.bak
3b018dd88828ff4d87147b8f84cb273dde310339vboxsyncNAMES=`kmk_sed -e '/EXPERIMENT_PURE/!d' -e '/^#/d' -e 's/^[^()]*([^()]*)[[:space:]]*\([^() ]*\)(.*$/\1/' ${HEADER}.bak `
3b018dd88828ff4d87147b8f84cb273dde310339vboxsynckmk_sed -e 's/EXPERIMENT_PURE//' ${HEADER}.bak --output ${HEADER}
3b018dd88828ff4d87147b8f84cb273dde310339vboxsyncsize ${BINDIR}/VMMR0.r0 ${BINDIR}/VMMGC.gc ${BINDIR}/VBoxVMM.${DLLEXT} > pt-baseline.txt
3b018dd88828ff4d87147b8f84cb273dde310339vboxsyncread buf; baseline_r0=`echo $buf | kmk_sed -e 's/^[[:space:]]*\([^[[:space:]]*\).*$/\1/' `
3b018dd88828ff4d87147b8f84cb273dde310339vboxsyncread buf; baseline_rc=`echo $buf | kmk_sed -e 's/^[[:space:]]*\([^[[:space:]]*\).*$/\1/' `
3b018dd88828ff4d87147b8f84cb273dde310339vboxsyncread buf; baseline_r3=`echo $buf | kmk_sed -e 's/^[[:space:]]*\([^[[:space:]]*\).*$/\1/' `
3b018dd88828ff4d87147b8f84cb273dde310339vboxsynckmk_printf -- "%7s %7s %7s Name\n" "VMMR0" "VMMGC" "VBoxVMM" >> "${REPORT}"
3b018dd88828ff4d87147b8f84cb273dde310339vboxsynckmk_printf -- "-------------------------------\n" >> "${REPORT}"
3b018dd88828ff4d87147b8f84cb273dde310339vboxsynckmk_printf -- "%7d %7d %7d baseline\n" ${baseline_r0} ${baseline_rc} ${baseline_r3} >> "${REPORT}"
3b018dd88828ff4d87147b8f84cb273dde310339vboxsync# Now, do each of the names.
3b018dd88828ff4d87147b8f84cb273dde310339vboxsync -e '/'"${name}"'/s/EXPERIMENT_PURE/__attribute__((pure))/' \
3b018dd88828ff4d87147b8f84cb273dde310339vboxsync size ${BINDIR}/VMMR0.r0 ${BINDIR}/VMMGC.gc ${BINDIR}/VBoxVMM.${DLLEXT} > "pt-${name}.txt"
3b018dd88828ff4d87147b8f84cb273dde310339vboxsync exec < "pt-${name}.txt"
3b018dd88828ff4d87147b8f84cb273dde310339vboxsync read buf; cur_r0=`echo $buf | kmk_sed -e 's/^[[:space:]]*\([^[[:space:]]*\).*$/\1/' `
3b018dd88828ff4d87147b8f84cb273dde310339vboxsync read buf; cur_rc=`echo $buf | kmk_sed -e 's/^[[:space:]]*\([^[[:space:]]*\).*$/\1/' `
3b018dd88828ff4d87147b8f84cb273dde310339vboxsync read buf; cur_r3=`echo $buf | kmk_sed -e 's/^[[:space:]]*\([^[[:space:]]*\).*$/\1/' `
3b018dd88828ff4d87147b8f84cb273dde310339vboxsync >> "${REPORT}"