Debian Codegraph @

tools/testing/reporting/scripts/calcJarFootprint

raw
1 #!/bin/bash
2
3 # Licensed to the Apache Software Foundation (ASF) under one or more
4 # contributor license agreements. See the NOTICE file distributed with
5 # this work for additional information regarding copyright ownership.
6 # The ASF licenses this file to you under the Apache License, Version 2.0
7 # (the "License"); you may not use this file except in compliance with
8 # the License. You may obtain a copy of the License at
9 #
10 # http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17
18 # $0 [jardir]. No jardir: uses ${SRCDIR}/jars/insane
19 JARDIR=$1
20 # You should NOT need to modify anything below.
21 # derby_source must be defined.
22 # NB: Assumes . ./env.sh is done to set DERBYDIR etc. correctly.
23 #---------------------------------------------
24 TOOLDIR="${DERBYDIR}/${BRANCH_DIR}/tools/testing/reporting/scripts"
25 . ${TOOLDIR}/env
26
27 SRCDIR=${derby_source}
28
29 if [ "${DERBYDIR}" == "" ]
30 then
31 echo "DERBYDIR is not defined"
32 exit
33 fi
34 if [ ! -e ${DERBYDIR} ]
35 then
36 echo "${DERBYDIR} does not exist."
37 exit
38 fi
39
40 if [ "${JARDIR}" == "" ]
41 then
42 if [ ! -e ${SRCDIR} ]
43 then
44 echo "${SRCDIR} does not exist."
45 exit
46 fi
47 JARDIR=${SRCDIR}/jars/insane
48 fi
49 cd ${JARDIR}
50 BASEREV=`head -1 ${DERBYDIR}/testing/builds/baseline.size | gawk '{ print $2 }'`
51 echo "Baseline ${BASEREV}"
52 JARS="derby.jar derbynet.jar derbyclient.jar derbytools.jar derbyrun.jar derbyTesting.jar"
53
54 OS=`uname -s | gawk -F_ '{ print $1 }'`
55
56 for JAR in ${JARS}
57 do
58 SIZE=0
59 PERCENT=0
60 if [ -e ${JAR} ]
61 then
62 # DU=`du -sk ${JAR}`
63 # SIZE=`echo ${DU} | gawk '{ print $1 }'`
64 # NAME=`echo ${DU} | gawk '{ print $2 }'`
65 DU=`ls -l ${JAR}`
66 if [ "${OS}" = "SunOS" ]
67 then
68 SIZE=`echo ${DU} | gawk '{ print $4 }'`
69 else
70 SIZE=`echo ${DU} | gawk '{ print $5 }'`
71 fi
72 NAME=${JAR}
73 BASESIZE=`grep ${JAR} ${DERBYDIR}/testing/builds/baseline.size | gawk '{ print $2 }'`
74 PERCENT=`${TOOLDIR}/calcPercent ${SIZE} ${BASESIZE}`
75 fi
76 echo "${NAME} ${SIZE} ${PERCENT}%"
77 done
78