diff options
author | Luis Martins <luis.martins@criticaltechworks.com> | 2020-03-24 11:33:11 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2020-03-24 16:39:40 +0000 |
commit | 3bd3e23304a41c2cabab4dd7994af2e2bfcc7dca (patch) | |
tree | 0d78ba86260351863635b11ec667af022909a153 /scripts/contrib/bb-perf/buildstats.sh | |
parent | fe1e4a47718a78063cb31a7ba50889ed6a7a353c (diff) | |
download | poky-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/contrib/bb-perf/buildstats.sh')
-rwxr-xr-x | scripts/contrib/bb-perf/buildstats.sh | 23 |
1 files changed, 21 insertions, 2 deletions
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" | |||
38 | BS_DIR="tmp/buildstats" | 38 | BS_DIR="tmp/buildstats" |
39 | TASKS="compile:configure:fetch:install:patch:populate_lic:populate_sysroot:unpack" | 39 | TASKS="compile:configure:fetch:install:patch:populate_lic:populate_sysroot:unpack" |
40 | STATS="$TIME" | 40 | STATS="$TIME" |
41 | ACCUMULATE="" | ||
41 | HEADER="" # No header by default | 42 | HEADER="" # No header by default |
42 | 43 | ||
43 | function usage { | 44 | function 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 |
60 | EOM | 62 | EOM |
61 | } | 63 | } |
62 | 64 | ||
63 | # Parse and validate arguments | 65 | # Parse and validate arguments |
64 | while getopts "b:t:s:Hh" OPT; do | 66 | while 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 | |||
118 | stats="$(echo "$stats" | sed -e 's/^://1')" | 123 | stats="$(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"; } | 126 | if [ -n "$HEADER" ] ; then |
127 | if [ -n "$ACCUMULATE" ]; then | ||
128 | echo "task:recipe:accumulated(${stats//:/;})" | ||
129 | else | ||
130 | echo "task:recipe:$stats" | ||
131 | fi | ||
132 | fi | ||
122 | 133 | ||
123 | for task in ${TASKS}; do | 134 | for 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 |
142 | done | 161 | done |