diff options
Diffstat (limited to 'scripts/contrib')
-rwxr-xr-x | scripts/contrib/bb-perf/buildstats-plot.sh | 9 | ||||
-rwxr-xr-x | scripts/contrib/bb-perf/buildstats.sh | 23 |
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" | |||
41 | N=10 | 41 | N=10 |
42 | TASKS="compile:configure:fetch:install:patch:populate_lic:populate_sysroot:unpack" | 42 | TASKS="compile:configure:fetch:install:patch:populate_lic:populate_sysroot:unpack" |
43 | STATS="utime" | 43 | STATS="utime" |
44 | ACCUMULATE="" | ||
44 | SUM="" | 45 | SUM="" |
45 | OUTDATA_FILE="$PWD/buildstats-plot.out" | 46 | OUTDATA_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 |
70 | while getopts "b:n:t:s:o:Sh" OPT; do | 72 | while 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 |
109 | OUTBUILDSTATS="$PWD/buildstats.log" | 114 | OUTBUILDSTATS="$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 |
113 | HEADERS=$(cat $OUTBUILDSTATS | sed -n -e '1s/ /-/g' -e '1s/:/ /gp') | 118 | HEADERS=$(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" | |||
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 |