summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorLuis Martins <luis.martins@criticaltechworks.com>2020-03-24 11:33:11 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-03-24 16:39:40 +0000
commit3bd3e23304a41c2cabab4dd7994af2e2bfcc7dca (patch)
tree0d78ba86260351863635b11ec667af022909a153 /scripts
parentfe1e4a47718a78063cb31a7ba50889ed6a7a353c (diff)
downloadpoky-3bd3e23304a41c2cabab4dd7994af2e2bfcc7dca.tar.gz
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>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/contrib/bb-perf/buildstats-plot.sh9
-rwxr-xr-xscripts/contrib/bb-perf/buildstats.sh23
2 files changed, 28 insertions, 4 deletions
diff --git a/scripts/contrib/bb-perf/buildstats-plot.sh b/scripts/contrib/bb-perf/buildstats-plot.sh
index 1d22e60d73..f26312f355 100755
--- a/scripts/contrib/bb-perf/buildstats-plot.sh
+++ b/scripts/contrib/bb-perf/buildstats-plot.sh
@@ -41,6 +41,7 @@ BS_DIR="tmp/buildstats"
41N=10 41N=10
42TASKS="compile:configure:fetch:install:patch:populate_lic:populate_sysroot:unpack" 42TASKS="compile:configure:fetch:install:patch:populate_lic:populate_sysroot:unpack"
43STATS="utime" 43STATS="utime"
44ACCUMULATE=""
44SUM="" 45SUM=""
45OUTDATA_FILE="$PWD/buildstats-plot.out" 46OUTDATA_FILE="$PWD/buildstats-plot.out"
46 47
@@ -59,6 +60,7 @@ Usage: $CMD [-b buildstats_dir] [-t do_task]
59 (see buildstats.sh -h for all options) or any other defined 60 (see buildstats.sh -h for all options) or any other defined
60 (build)stat separated by colons, i.e. stime:utime 61 (build)stat separated by colons, i.e. stime:utime
61 (default: "$STATS") 62 (default: "$STATS")
63 -a Accumulate all stats values for found recipes
62 -S Sum values for a particular stat for found recipes 64 -S Sum values for a particular stat for found recipes
63 -o Output data file. 65 -o Output data file.
64 (default: "$OUTDATA_FILE") 66 (default: "$OUTDATA_FILE")
@@ -67,7 +69,7 @@ EOM
67} 69}
68 70
69# Parse and validate arguments 71# Parse and validate arguments
70while getopts "b:n:t:s:o:Sh" OPT; do 72while getopts "b:n:t:s:o:aSh" OPT; do
71 case $OPT in 73 case $OPT in
72 b) 74 b)
73 BS_DIR="$OPTARG" 75 BS_DIR="$OPTARG"
@@ -81,6 +83,9 @@ while getopts "b:n:t:s:o:Sh" OPT; do
81 s) 83 s)
82 STATS="$OPTARG" 84 STATS="$OPTARG"
83 ;; 85 ;;
86 a)
87 ACCUMULATE="-a"
88 ;;
84 S) 89 S)
85 SUM="y" 90 SUM="y"
86 ;; 91 ;;
@@ -107,7 +112,7 @@ CD=$(dirname $0)
107 112
108# Parse buildstats recipes to produce a single table 113# Parse buildstats recipes to produce a single table
109OUTBUILDSTATS="$PWD/buildstats.log" 114OUTBUILDSTATS="$PWD/buildstats.log"
110$CD/buildstats.sh -b "$BS_DIR" -s "$STATS" -t "$TASKS" -H > $OUTBUILDSTATS 115$CD/buildstats.sh -b "$BS_DIR" -s "$STATS" -t "$TASKS" $ACCUMULATE -H > $OUTBUILDSTATS
111 116
112# Get headers 117# Get headers
113HEADERS=$(cat $OUTBUILDSTATS | sed -n -e '1s/ /-/g' -e '1s/:/ /gp') 118HEADERS=$(cat $OUTBUILDSTATS | sed -n -e '1s/ /-/g' -e '1s/:/ /gp')
diff --git a/scripts/contrib/bb-perf/buildstats.sh b/scripts/contrib/bb-perf/buildstats.sh
index e9ec2d476a..26bfaca86b 100755
--- a/scripts/contrib/bb-perf/buildstats.sh
+++ b/scripts/contrib/bb-perf/buildstats.sh
@@ -38,6 +38,7 @@ Child rusage ru_nivcsw"
38BS_DIR="tmp/buildstats" 38BS_DIR="tmp/buildstats"
39TASKS="compile:configure:fetch:install:patch:populate_lic:populate_sysroot:unpack" 39TASKS="compile:configure:fetch:install:patch:populate_lic:populate_sysroot:unpack"
40STATS="$TIME" 40STATS="$TIME"
41ACCUMULATE=""
41HEADER="" # No header by default 42HEADER="" # No header by default
42 43
43function usage { 44function usage {
@@ -56,12 +57,13 @@ Usage: $CMD [-b buildstats_dir] [-t do_task]
56 IO=$IO 57 IO=$IO
57 RUSAGE=$RUSAGE 58 RUSAGE=$RUSAGE
58 CHILD_RUSAGE=$CHILD_RUSAGE 59 CHILD_RUSAGE=$CHILD_RUSAGE
60 -a Accumulate all stats values for found recipes
59 -h Display this help message 61 -h Display this help message
60EOM 62EOM
61} 63}
62 64
63# Parse and validate arguments 65# Parse and validate arguments
64while getopts "b:t:s:Hh" OPT; do 66while getopts "b:t:s:aHh" OPT; do
65 case $OPT in 67 case $OPT in
66 b) 68 b)
67 BS_DIR="$OPTARG" 69 BS_DIR="$OPTARG"
@@ -72,6 +74,9 @@ while getopts "b:t:s:Hh" OPT; do
72 s) 74 s)
73 STATS="$OPTARG" 75 STATS="$OPTARG"
74 ;; 76 ;;
77 a)
78 ACCUMULATE="y"
79 ;;
75 H) 80 H)
76 HEADER="y" 81 HEADER="y"
77 ;; 82 ;;
@@ -118,7 +123,13 @@ done
118stats="$(echo "$stats" | sed -e 's/^://1')" 123stats="$(echo "$stats" | sed -e 's/^://1')"
119 124
120# Provide a header if required by the user 125# Provide a header if required by the user
121[ -n "$HEADER" ] && { echo "task:recipe:$stats"; } 126if [ -n "$HEADER" ] ; then
127 if [ -n "$ACCUMULATE" ]; then
128 echo "task:recipe:accumulated(${stats//:/;})"
129 else
130 echo "task:recipe:$stats"
131 fi
132fi
122 133
123for task in ${TASKS}; do 134for task in ${TASKS}; do
124 task="do_${task}" 135 task="do_${task}"
@@ -137,6 +148,14 @@ for task in ${TASKS}; do
137 times="${times} ${time}" 148 times="${times} ${time}"
138 fi 149 fi
139 done 150 done
151 if [ -n "$ACCUMULATE" ]; then
152 IFS=' '; valuesarray=(${times}); IFS=':'
153 times=0
154 for value in "${valuesarray[@]}"; do
155 [ "$value" == "NA" ] && { echo "ERROR: stat is not present."; usage; exit 1; }
156 times=$(( $times + $value ))
157 done
158 fi
140 echo "${task} ${recipe} ${times}" 159 echo "${task} ${recipe} ${times}"
141 done 160 done
142done 161done