mirror of
https://git.yoctoproject.org/poky
synced 2026-06-03 13:49:49 +00:00
buildstats*.sh: add accumulate parameter to scripts
Add option to accumulate stats values per recipe, allowing to sum related values such as memory (main process + childs). This is specially useful when debugging the performance of the overall bitbake build system. (From OE-Core rev: e6f1aea6260343cb5194f7f8ab70213b705ab441) Signed-off-by: Luis Martins <luis.martins@criticaltechworks.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
fe1e4a4771
commit
3bd3e23304
@@ -41,6 +41,7 @@ BS_DIR="tmp/buildstats"
|
|||||||
N=10
|
N=10
|
||||||
TASKS="compile:configure:fetch:install:patch:populate_lic:populate_sysroot:unpack"
|
TASKS="compile:configure:fetch:install:patch:populate_lic:populate_sysroot:unpack"
|
||||||
STATS="utime"
|
STATS="utime"
|
||||||
|
ACCUMULATE=""
|
||||||
SUM=""
|
SUM=""
|
||||||
OUTDATA_FILE="$PWD/buildstats-plot.out"
|
OUTDATA_FILE="$PWD/buildstats-plot.out"
|
||||||
|
|
||||||
@@ -59,6 +60,7 @@ Usage: $CMD [-b buildstats_dir] [-t do_task]
|
|||||||
(see buildstats.sh -h for all options) or any other defined
|
(see buildstats.sh -h for all options) or any other defined
|
||||||
(build)stat separated by colons, i.e. stime:utime
|
(build)stat separated by colons, i.e. stime:utime
|
||||||
(default: "$STATS")
|
(default: "$STATS")
|
||||||
|
-a Accumulate all stats values for found recipes
|
||||||
-S Sum values for a particular stat for found recipes
|
-S Sum values for a particular stat for found recipes
|
||||||
-o Output data file.
|
-o Output data file.
|
||||||
(default: "$OUTDATA_FILE")
|
(default: "$OUTDATA_FILE")
|
||||||
@@ -67,7 +69,7 @@ EOM
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Parse and validate arguments
|
# Parse and validate arguments
|
||||||
while getopts "b:n:t:s:o:Sh" OPT; do
|
while getopts "b:n:t:s:o:aSh" OPT; do
|
||||||
case $OPT in
|
case $OPT in
|
||||||
b)
|
b)
|
||||||
BS_DIR="$OPTARG"
|
BS_DIR="$OPTARG"
|
||||||
@@ -81,6 +83,9 @@ while getopts "b:n:t:s:o:Sh" OPT; do
|
|||||||
s)
|
s)
|
||||||
STATS="$OPTARG"
|
STATS="$OPTARG"
|
||||||
;;
|
;;
|
||||||
|
a)
|
||||||
|
ACCUMULATE="-a"
|
||||||
|
;;
|
||||||
S)
|
S)
|
||||||
SUM="y"
|
SUM="y"
|
||||||
;;
|
;;
|
||||||
@@ -107,7 +112,7 @@ CD=$(dirname $0)
|
|||||||
|
|
||||||
# Parse buildstats recipes to produce a single table
|
# Parse buildstats recipes to produce a single table
|
||||||
OUTBUILDSTATS="$PWD/buildstats.log"
|
OUTBUILDSTATS="$PWD/buildstats.log"
|
||||||
$CD/buildstats.sh -b "$BS_DIR" -s "$STATS" -t "$TASKS" -H > $OUTBUILDSTATS
|
$CD/buildstats.sh -b "$BS_DIR" -s "$STATS" -t "$TASKS" $ACCUMULATE -H > $OUTBUILDSTATS
|
||||||
|
|
||||||
# Get headers
|
# Get headers
|
||||||
HEADERS=$(cat $OUTBUILDSTATS | sed -n -e '1s/ /-/g' -e '1s/:/ /gp')
|
HEADERS=$(cat $OUTBUILDSTATS | sed -n -e '1s/ /-/g' -e '1s/:/ /gp')
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ Child rusage ru_nivcsw"
|
|||||||
BS_DIR="tmp/buildstats"
|
BS_DIR="tmp/buildstats"
|
||||||
TASKS="compile:configure:fetch:install:patch:populate_lic:populate_sysroot:unpack"
|
TASKS="compile:configure:fetch:install:patch:populate_lic:populate_sysroot:unpack"
|
||||||
STATS="$TIME"
|
STATS="$TIME"
|
||||||
|
ACCUMULATE=""
|
||||||
HEADER="" # No header by default
|
HEADER="" # No header by default
|
||||||
|
|
||||||
function usage {
|
function usage {
|
||||||
@@ -56,12 +57,13 @@ Usage: $CMD [-b buildstats_dir] [-t do_task]
|
|||||||
IO=$IO
|
IO=$IO
|
||||||
RUSAGE=$RUSAGE
|
RUSAGE=$RUSAGE
|
||||||
CHILD_RUSAGE=$CHILD_RUSAGE
|
CHILD_RUSAGE=$CHILD_RUSAGE
|
||||||
|
-a Accumulate all stats values for found recipes
|
||||||
-h Display this help message
|
-h Display this help message
|
||||||
EOM
|
EOM
|
||||||
}
|
}
|
||||||
|
|
||||||
# Parse and validate arguments
|
# Parse and validate arguments
|
||||||
while getopts "b:t:s:Hh" OPT; do
|
while getopts "b:t:s:aHh" OPT; do
|
||||||
case $OPT in
|
case $OPT in
|
||||||
b)
|
b)
|
||||||
BS_DIR="$OPTARG"
|
BS_DIR="$OPTARG"
|
||||||
@@ -72,6 +74,9 @@ while getopts "b:t:s:Hh" OPT; do
|
|||||||
s)
|
s)
|
||||||
STATS="$OPTARG"
|
STATS="$OPTARG"
|
||||||
;;
|
;;
|
||||||
|
a)
|
||||||
|
ACCUMULATE="y"
|
||||||
|
;;
|
||||||
H)
|
H)
|
||||||
HEADER="y"
|
HEADER="y"
|
||||||
;;
|
;;
|
||||||
@@ -118,7 +123,13 @@ done
|
|||||||
stats="$(echo "$stats" | sed -e 's/^://1')"
|
stats="$(echo "$stats" | sed -e 's/^://1')"
|
||||||
|
|
||||||
# Provide a header if required by the user
|
# Provide a header if required by the user
|
||||||
[ -n "$HEADER" ] && { echo "task:recipe:$stats"; }
|
if [ -n "$HEADER" ] ; then
|
||||||
|
if [ -n "$ACCUMULATE" ]; then
|
||||||
|
echo "task:recipe:accumulated(${stats//:/;})"
|
||||||
|
else
|
||||||
|
echo "task:recipe:$stats"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
for task in ${TASKS}; do
|
for task in ${TASKS}; do
|
||||||
task="do_${task}"
|
task="do_${task}"
|
||||||
@@ -137,6 +148,14 @@ for task in ${TASKS}; do
|
|||||||
times="${times} ${time}"
|
times="${times} ${time}"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
if [ -n "$ACCUMULATE" ]; then
|
||||||
|
IFS=' '; valuesarray=(${times}); IFS=':'
|
||||||
|
times=0
|
||||||
|
for value in "${valuesarray[@]}"; do
|
||||||
|
[ "$value" == "NA" ] && { echo "ERROR: stat is not present."; usage; exit 1; }
|
||||||
|
times=$(( $times + $value ))
|
||||||
|
done
|
||||||
|
fi
|
||||||
echo "${task} ${recipe} ${times}"
|
echo "${task} ${recipe} ${times}"
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
|||||||
Reference in New Issue
Block a user