diff options
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 |