VirtualBox

source: vbox/trunk/src/VBox/VMM/pure_test.sh@ 100658

Last change on this file since 100658 was 98103, checked in by vboxsync, 22 months ago

Copyright year updates by scm.

  • Property svn:eol-style set to LF
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 3.3 KB
Line 
1#!/bin/bash
2# $Id: pure_test.sh 98103 2023-01-17 14:15:46Z vboxsync $
3## @file
4# pure_test.sh - test the effect of __attribute__((pure)) on a set of
5# functions.
6#
7# Mark the functions with EXPERIMENT_PURE where the attribute normally would,
8# go update this script so it points to the right header and execute it. At
9# the end you'll get a pt-report.txt showing the fluctuations in the text size.
10#
11
12#
13# Copyright (C) 2010-2023 Oracle and/or its affiliates.
14#
15# This file is part of VirtualBox base platform packages, as
16# available from https://www.virtualbox.org.
17#
18# This program is free software; you can redistribute it and/or
19# modify it under the terms of the GNU General Public License
20# as published by the Free Software Foundation, in version 3 of the
21# License.
22#
23# This program is distributed in the hope that it will be useful, but
24# WITHOUT ANY WARRANTY; without even the implied warranty of
25# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
26# General Public License for more details.
27#
28# You should have received a copy of the GNU General Public License
29# along with this program; if not, see <https://www.gnu.org/licenses>.
30#
31# SPDX-License-Identifier: GPL-3.0-only
32#
33
34set -e
35set -x
36
37BINDIR="../../../out/linux.amd64/release/bin/"
38DLLEXT="so"
39HEADER="../../../include/VBox/cpum.h"
40REPORT="pt-report.txt"
41
42test -e ${HEADER}.bak || kmk_cp $HEADER ${HEADER}.bak
43NAMES=`kmk_sed -e '/EXPERIMENT_PURE/!d' -e '/^#/d' -e 's/^[^()]*([^()]*)[[:space:]]*\([^() ]*\)(.*$/\1/' ${HEADER}.bak `
44echo NAMES=$NAMES
45
46
47#
48# baseline
49#
50kmk_sed -e 's/EXPERIMENT_PURE//' ${HEADER}.bak --output ${HEADER}
51kmk KBUILD_TYPE=release VBoxVMM VMMR0 VMMGC
52size ${BINDIR}/VMMR0.r0 ${BINDIR}/VMMGC.gc ${BINDIR}/VBoxVMM.${DLLEXT} > pt-baseline.txt
53
54exec < "pt-baseline.txt"
55read buf # ignore
56read buf; baseline_r0=`echo $buf | kmk_sed -e 's/^[[:space:]]*\([^[[:space:]]*\).*$/\1/' `
57read buf; baseline_rc=`echo $buf | kmk_sed -e 's/^[[:space:]]*\([^[[:space:]]*\).*$/\1/' `
58read buf; baseline_r3=`echo $buf | kmk_sed -e 's/^[[:space:]]*\([^[[:space:]]*\).*$/\1/' `
59
60kmk_cp -f "pt-baseline.txt" "${REPORT}"
61kmk_printf -- "\n" >> "${REPORT}"
62kmk_printf -- "%7s %7s %7s Name\n" "VMMR0" "VMMGC" "VBoxVMM" >> "${REPORT}"
63kmk_printf -- "-------------------------------\n" >> "${REPORT}"
64kmk_printf -- "%7d %7d %7d baseline\n" ${baseline_r0} ${baseline_rc} ${baseline_r3} >> "${REPORT}"
65
66#
67# Now, do each of the names.
68#
69for name in $NAMES;
70do
71 kmk_sed \
72 -e '/'"${name}"'/s/EXPERIMENT_PURE/__attribute__((pure))/' \
73 -e 's/EXPERIMENT_PURE//' \
74 ${HEADER}.bak --output ${HEADER}
75 kmk KBUILD_TYPE=release VBoxVMM VMMR0 VMMGC
76 size ${BINDIR}/VMMR0.r0 ${BINDIR}/VMMGC.gc ${BINDIR}/VBoxVMM.${DLLEXT} > "pt-${name}.txt"
77
78 exec < "pt-${name}.txt"
79 read buf # ignore
80 read buf; cur_r0=`echo $buf | kmk_sed -e 's/^[[:space:]]*\([^[[:space:]]*\).*$/\1/' `
81 read buf; cur_rc=`echo $buf | kmk_sed -e 's/^[[:space:]]*\([^[[:space:]]*\).*$/\1/' `
82 read buf; cur_r3=`echo $buf | kmk_sed -e 's/^[[:space:]]*\([^[[:space:]]*\).*$/\1/' `
83 kmk_printf -- "%7d %7d %7d ${name}\n" \
84 `kmk_expr ${baseline_r0} - ${cur_r0} ` \
85 `kmk_expr ${baseline_rc} - ${cur_rc} ` \
86 `kmk_expr ${baseline_r3} - ${cur_r3} ` \
87 >> "${REPORT}"
88done
89
90# clean up
91kmk_mv -f ${HEADER}.bak ${HEADER}
92
93
94
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette