2002-10-04 06:33:15 +04:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
2005-12-13 16:25:40 +03:00
|
|
|
# ***** BEGIN LICENSE BLOCK *****
|
|
|
|
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
2002-10-04 06:51:13 +04:00
|
|
|
#
|
2005-12-13 16:25:40 +03:00
|
|
|
# The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
# 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
# the License. You may obtain a copy of the License at
|
|
|
|
# http://www.mozilla.org/MPL/
|
|
|
|
#
|
|
|
|
# Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
# for the specific language governing rights and limitations under the
|
|
|
|
# License.
|
2002-10-04 06:51:13 +04:00
|
|
|
#
|
|
|
|
# The Original Code is autosummary.win.bash code, released
|
|
|
|
# Oct 3, 2002.
|
|
|
|
#
|
2005-12-13 16:25:40 +03:00
|
|
|
# The Initial Developer of the Original Code is
|
|
|
|
# Netscape Communications Corporation.
|
|
|
|
# Portions created by the Initial Developer are Copyright (C) 2002
|
|
|
|
# the Initial Developer. All Rights Reserved.
|
2002-10-04 06:51:13 +04:00
|
|
|
#
|
|
|
|
# Contributor(s):
|
2005-12-13 16:25:40 +03:00
|
|
|
# Garrett Arch Blythe, 03-October-2002
|
2002-10-04 06:51:13 +04:00
|
|
|
#
|
2005-12-13 16:25:40 +03:00
|
|
|
# Alternatively, the contents of this file may be used under the terms of
|
|
|
|
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
|
|
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
|
# in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
# of those above. If you wish to allow use of your version of this file only
|
|
|
|
# under the terms of either the GPL or the LGPL, and not to allow others to
|
|
|
|
# use your version of this file under the terms of the MPL, indicate your
|
|
|
|
# decision by deleting the provisions above and replace them with the notice
|
|
|
|
# and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
# the provisions above, a recipient may use your version of this file under
|
|
|
|
# the terms of any one of the MPL, the GPL or the LGPL.
|
2002-10-04 06:33:15 +04:00
|
|
|
#
|
2005-12-13 16:25:40 +03:00
|
|
|
# ***** END LICENSE BLOCK *****
|
2002-10-04 06:33:15 +04:00
|
|
|
|
2003-03-26 00:39:35 +03:00
|
|
|
#
|
|
|
|
# Check for optional objdir
|
|
|
|
#
|
|
|
|
if [ "$1" = "-o" ]; then
|
|
|
|
OBJROOT="$2"
|
|
|
|
shift
|
|
|
|
shift
|
|
|
|
else
|
|
|
|
OBJROOT="./mozilla"
|
|
|
|
fi
|
|
|
|
|
2002-10-04 06:33:15 +04:00
|
|
|
#
|
|
|
|
# A little help for my friends.
|
|
|
|
#
|
|
|
|
if [ "-h" == "$1" ];then
|
|
|
|
SHOWHELP="1"
|
|
|
|
fi
|
|
|
|
if [ "--help" == "$1" ];then
|
|
|
|
SHOWHELP="1"
|
|
|
|
fi
|
|
|
|
if [ "" == "$1" ]; then
|
|
|
|
SHOWHELP="1"
|
|
|
|
fi
|
|
|
|
if [ "" == "$2" ]; then
|
|
|
|
SHOWHELP="1"
|
|
|
|
fi
|
|
|
|
if [ "" == "$3" ]; then
|
|
|
|
SHOWHELP="1"
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# Show the help if required.
|
|
|
|
#
|
|
|
|
if [ $SHOWHELP ]; then
|
|
|
|
echo "usage: $0 <save_results> <old_results> <summary>"
|
|
|
|
echo " <save_results> is a file that will receive the results of this run."
|
|
|
|
echo " This file can be used in a future run as the old results."
|
|
|
|
echo " <old_results> is a results file from a previous run."
|
|
|
|
echo " It is used to diff with current results and come up with a summary"
|
|
|
|
echo " of changes."
|
|
|
|
echo " It is OK if the file does not exist, just supply the argument."
|
|
|
|
echo " <summary> is a file which will contain a human readable report."
|
|
|
|
echo " This file is most useful by providing more information than the"
|
|
|
|
echo " normally single digit output of this script."
|
|
|
|
echo ""
|
|
|
|
echo "Run this command from the parent directory of the mozilla tree."
|
|
|
|
echo ""
|
|
|
|
echo "This command will output two numbers to stdout that will represent"
|
|
|
|
echo " the total size of all code and data, and a delta from the prior."
|
|
|
|
echo " the old results."
|
2002-10-04 07:14:25 +04:00
|
|
|
echo "For much more detail on size drifts refer to the summary report."
|
2002-11-16 03:51:56 +03:00
|
|
|
echo ""
|
|
|
|
echo "This tool reports on all executables in the directory tree."
|
2002-10-04 06:33:15 +04:00
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# Stash our arguments away.
|
|
|
|
#
|
|
|
|
COPYSORTTSV="$1"
|
|
|
|
OLDTSVFILE="$2"
|
|
|
|
SUMMARYFILE="$3"
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# Create our temporary directory.
|
|
|
|
#
|
2002-10-30 20:46:03 +03:00
|
|
|
MYTMPDIR=`mktemp -d ./codesighs.tmp.XXXXXXXX`
|
2002-10-04 06:33:15 +04:00
|
|
|
|
|
|
|
|
2003-01-23 18:13:24 +03:00
|
|
|
#
|
|
|
|
# Find the types of files we are interested in.
|
|
|
|
#
|
|
|
|
ONEFINDPASS="$MYTMPDIR/onefind.list"
|
2005-02-03 17:11:54 +03:00
|
|
|
/usr/bin/find $OBJROOT -type f -name "*.obj" -or -name "*.map" | while read FNAME; do
|
2003-09-13 10:19:43 +04:00
|
|
|
cygpath -m $FNAME >> $ONEFINDPASS
|
|
|
|
done
|
2003-01-23 18:13:24 +03:00
|
|
|
|
|
|
|
|
2003-01-22 17:06:15 +03:00
|
|
|
#
|
|
|
|
# Find all object files.
|
|
|
|
#
|
|
|
|
ALLOBJSFILE="$MYTMPDIR/allobjs.list"
|
2003-01-23 18:13:24 +03:00
|
|
|
grep -i "\.obj$" < $ONEFINDPASS > $ALLOBJSFILE
|
2003-01-22 17:06:15 +03:00
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# Get a dump of the symbols in every object file.
|
|
|
|
#
|
|
|
|
ALLOBJSYMSFILE="$MYTMPDIR/allobjsyms.list"
|
|
|
|
xargs -n 1 dumpbin.exe /symbols < $ALLOBJSFILE > $ALLOBJSYMSFILE 2> /dev/null
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# Produce the symdb for the symbols in all object files.
|
|
|
|
#
|
|
|
|
SYMDBFILE="$MYTMPDIR/symdb.tsv"
|
2005-02-03 17:11:54 +03:00
|
|
|
$OBJROOT/dist/bin/msdump2symdb --input $ALLOBJSYMSFILE | /usr/bin/sort > $SYMDBFILE 2> /dev/null
|
2003-01-22 17:06:15 +03:00
|
|
|
|
|
|
|
|
2002-10-04 06:33:15 +04:00
|
|
|
#
|
|
|
|
# Find all map files.
|
|
|
|
#
|
2002-10-30 20:46:03 +03:00
|
|
|
ALLMAPSFILE="$MYTMPDIR/allmaps.list"
|
2003-01-23 18:13:24 +03:00
|
|
|
grep -i "\.map$" < $ONEFINDPASS > $ALLMAPSFILE
|
2002-10-04 06:33:15 +04:00
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# Produce the TSV output.
|
|
|
|
#
|
2002-10-30 20:46:03 +03:00
|
|
|
RAWTSVFILE="$MYTMPDIR/raw.tsv"
|
2003-03-26 00:39:35 +03:00
|
|
|
$OBJROOT/dist/bin/msmap2tsv --symdb $SYMDBFILE --batch < $ALLMAPSFILE > $RAWTSVFILE 2> /dev/null
|
2002-10-04 06:33:15 +04:00
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# Sort the TSV output for useful diffing and eyeballing in general.
|
|
|
|
#
|
2005-02-03 17:11:54 +03:00
|
|
|
/usr/bin/sort -r $RAWTSVFILE > $COPYSORTTSV
|
2002-10-04 06:33:15 +04:00
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# If a historical file was specified, diff it with our sorted tsv values.
|
|
|
|
# Run it through a tool to summaries the diffs to the module
|
|
|
|
# level report.
|
2002-12-03 22:07:55 +03:00
|
|
|
# Otherwise, generate the module level report from our new data.
|
2002-10-04 06:33:15 +04:00
|
|
|
#
|
|
|
|
rm -f $SUMMARYFILE
|
2002-10-30 20:46:03 +03:00
|
|
|
DIFFFILE="$MYTMPDIR/diff.txt"
|
2002-10-04 06:33:15 +04:00
|
|
|
if [ -e $OLDTSVFILE ]; then
|
|
|
|
diff $OLDTSVFILE $COPYSORTTSV > $DIFFFILE
|
2003-03-26 00:39:35 +03:00
|
|
|
$OBJROOT/dist/bin/maptsvdifftool --negation --input $DIFFFILE | dos2unix >> $SUMMARYFILE
|
2002-12-03 22:07:55 +03:00
|
|
|
else
|
2003-03-26 00:39:35 +03:00
|
|
|
$OBJROOT/dist/bin/codesighs --modules --input $COPYSORTTSV | dos2unix >> $SUMMARYFILE
|
2002-10-04 06:33:15 +04:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# Output our numbers, that will let tinderbox specify everything all
|
|
|
|
# at once.
|
|
|
|
# First number is in fact the total size of all code and data in the map
|
|
|
|
# files parsed.
|
|
|
|
# Second number, if present, is growth/shrinkage.
|
|
|
|
#
|
2002-12-13 05:03:24 +03:00
|
|
|
|
|
|
|
if [ $TINDERBOX_OUTPUT ]; then
|
|
|
|
echo -n "__codesize:"
|
|
|
|
fi
|
2003-03-26 00:39:35 +03:00
|
|
|
$OBJROOT/dist/bin/codesighs --totalonly --input $COPYSORTTSV | dos2unix
|
2002-12-13 05:03:24 +03:00
|
|
|
|
|
|
|
|
2002-10-04 06:33:15 +04:00
|
|
|
if [ -e $DIFFFILE ]; then
|
2002-12-13 05:03:24 +03:00
|
|
|
if [ $TINDERBOX_OUTPUT ]; then
|
|
|
|
echo -n "__codesizeDiff:"
|
|
|
|
fi
|
2003-03-26 00:39:35 +03:00
|
|
|
$OBJROOT/dist/bin/maptsvdifftool --negation --summary --input $DIFFFILE | dos2unix
|
2002-10-04 06:33:15 +04:00
|
|
|
fi
|
|
|
|
|
|
|
|
#
|
|
|
|
# Remove our temporary directory.
|
|
|
|
#
|
2002-10-30 20:46:03 +03:00
|
|
|
rm -rf $MYTMPDIR
|