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:
Luis Martins
2020-03-24 11:33:11 +00:00
committed by Richard Purdie
parent fe1e4a4771
commit 3bd3e23304
2 changed files with 28 additions and 4 deletions

View File

@@ -41,6 +41,7 @@ BS_DIR="tmp/buildstats"
N=10
TASKS="compile:configure:fetch:install:patch:populate_lic:populate_sysroot:unpack"
STATS="utime"
ACCUMULATE=""
SUM=""
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
(build)stat separated by colons, i.e. stime:utime
(default: "$STATS")
-a Accumulate all stats values for found recipes
-S Sum values for a particular stat for found recipes
-o Output data file.
(default: "$OUTDATA_FILE")
@@ -67,7 +69,7 @@ EOM
}
# 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
b)
BS_DIR="$OPTARG"
@@ -81,6 +83,9 @@ while getopts "b:n:t:s:o:Sh" OPT; do
s)
STATS="$OPTARG"
;;
a)
ACCUMULATE="-a"
;;
S)
SUM="y"
;;
@@ -107,7 +112,7 @@ CD=$(dirname $0)
# Parse buildstats recipes to produce a single table
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
HEADERS=$(cat $OUTBUILDSTATS | sed -n -e '1s/ /-/g' -e '1s/:/ /gp')