summaryrefslogtreecommitdiffstats
path: root/scripts/contrib
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/contrib')
-rwxr-xr-xscripts/contrib/bb-perf/buildstats-plot.sh56
-rwxr-xr-xscripts/contrib/bb-perf/buildstats.sh131
2 files changed, 94 insertions, 93 deletions
diff --git a/scripts/contrib/bb-perf/buildstats-plot.sh b/scripts/contrib/bb-perf/buildstats-plot.sh
index 320c4910a1..80fd30960c 100755
--- a/scripts/contrib/bb-perf/buildstats-plot.sh
+++ b/scripts/contrib/bb-perf/buildstats-plot.sh
@@ -72,40 +72,40 @@ EOM
72 72
73# Parse and validate arguments 73# Parse and validate arguments
74while getopts "b:n:r:t:s:o:aSh" OPT; do 74while getopts "b:n:r:t:s:o:aSh" OPT; do
75 case $OPT in 75 case $OPT in
76 b) 76 b)
77 BS_DIR="$OPTARG" 77 BS_DIR="$OPTARG"
78 ;; 78 ;;
79 n) 79 n)
80 N="$OPTARG" 80 N="$OPTARG"
81 ;; 81 ;;
82 r) 82 r)
83 RECIPE="-r $OPTARG" 83 RECIPE="-r $OPTARG"
84 ;; 84 ;;
85 t) 85 t)
86 TASKS="$OPTARG" 86 TASKS="$OPTARG"
87 ;; 87 ;;
88 s) 88 s)
89 STATS="$OPTARG" 89 STATS="$OPTARG"
90 ;; 90 ;;
91 a) 91 a)
92 ACCUMULATE="-a" 92 ACCUMULATE="-a"
93 ;; 93 ;;
94 S) 94 S)
95 SUM="y" 95 SUM="y"
96 ;; 96 ;;
97 o) 97 o)
98 OUTDATA_FILE="$OPTARG" 98 OUTDATA_FILE="$OPTARG"
99 ;; 99 ;;
100 h) 100 h)
101 usage 101 usage
102 exit 0 102 exit 0
103 ;; 103 ;;
104 *) 104 *)
105 usage 105 usage
106 exit 1 106 exit 1
107 ;; 107 ;;
108 esac 108 esac
109done 109done
110 110
111# Get number of stats 111# Get number of stats
@@ -141,8 +141,8 @@ else
141 declare -a sumargs 141 declare -a sumargs
142 j=0 142 j=0
143 for i in `seq $nstats`; do 143 for i in `seq $nstats`; do
144 sumargs[j]=sum; j=$(( $j + 1 )) 144 sumargs[j]=sum; j=$(( $j + 1 ))
145 sumargs[j]=`expr 3 + $i - 1`; j=$(( $j + 1 )) 145 sumargs[j]=`expr 3 + $i - 1`; j=$(( $j + 1 ))
146 done 146 done
147 147
148 # Do the processing with datamash 148 # Do the processing with datamash
diff --git a/scripts/contrib/bb-perf/buildstats.sh b/scripts/contrib/bb-perf/buildstats.sh
index 2f017efeb8..e45cfc146d 100755
--- a/scripts/contrib/bb-perf/buildstats.sh
+++ b/scripts/contrib/bb-perf/buildstats.sh
@@ -66,62 +66,63 @@ EOM
66 66
67# Parse and validate arguments 67# Parse and validate arguments
68while getopts "b:r:t:s:aHh" OPT; do 68while getopts "b:r:t:s:aHh" OPT; do
69 case $OPT in 69 case $OPT in
70 b) 70 b)
71 BS_DIR="$OPTARG" 71 BS_DIR="$OPTARG"
72 ;; 72 ;;
73 r) 73 r)
74 RECIPE="$OPTARG" 74 RECIPE="$OPTARG"
75 ;; 75 ;;
76 t) 76 t)
77 TASKS="$OPTARG" 77 TASKS="$OPTARG"
78 ;; 78 ;;
79 s) 79 s)
80 STATS="$OPTARG" 80 STATS="$OPTARG"
81 ;; 81 ;;
82 a) 82 a)
83 ACCUMULATE="y" 83 ACCUMULATE="y"
84 ;; 84 ;;
85 H) 85 H)
86 HEADER="y" 86 HEADER="y"
87 ;; 87 ;;
88 h) 88 h)
89 usage 89 usage
90 exit 0 90 exit 0
91 ;; 91 ;;
92 *) 92 *)
93 usage 93 usage
94 exit 1 94 exit 1
95 ;; 95 ;;
96 esac 96 esac
97done 97done
98 98
99# Ensure the buildstats folder exists 99# Ensure the buildstats folder exists
100if [ ! -d "$BS_DIR" ]; then 100if [ ! -d "$BS_DIR" ]; then
101 echo "ERROR: $BS_DIR does not exist" 101 echo "ERROR: $BS_DIR does not exist"
102 usage 102 usage
103 exit 1 103 exit 1
104fi 104fi
105 105
106stats="" 106stats=""
107IFS=":" 107IFS=":"
108for stat in ${STATS}; do 108for stat in ${STATS}; do
109 case $stat in 109 case $stat in
110 TIME) 110 TIME)
111 stats="${stats}:${TIME}" 111 stats="${stats}:${TIME}"
112 ;; 112 ;;
113 IO) 113 IO)
114 stats="${stats}:${IO}" 114 stats="${stats}:${IO}"
115 ;; 115 ;;
116 RUSAGE) 116 RUSAGE)
117 stats="${stats}:${RUSAGE}" 117 stats="${stats}:${RUSAGE}"
118 ;; 118 ;;
119 CHILD_RUSAGE) 119 CHILD_RUSAGE)
120 stats="${stats}:${CHILD_RUSAGE}" 120 stats="${stats}:${CHILD_RUSAGE}"
121 ;; 121 ;;
122 *) 122 *)
123 stats="${STATS}" 123 stats="${STATS}"
124 esac 124 ;;
125 esac
125done 126done
126 127
127# remove possible colon at the beginning 128# remove possible colon at the beginning
@@ -140,27 +141,27 @@ for task in ${TASKS}; do
140 task="do_${task}" 141 task="do_${task}"
141 for file in $(find ${BS_DIR} -type f -path *${RECIPE}*/${task} | awk 'BEGIN{ ORS=""; OFS=":" } { print $0,"" }'); do 142 for file in $(find ${BS_DIR} -type f -path *${RECIPE}*/${task} | awk 'BEGIN{ ORS=""; OFS=":" } { print $0,"" }'); do
142 recipe="$(basename $(dirname $file))" 143 recipe="$(basename $(dirname $file))"
143 times="" 144 times=""
144 for stat in ${stats}; do 145 for stat in ${stats}; do
145 [ -z "$stat" ] && { echo "empty stats"; } 146 [ -z "$stat" ] && { echo "empty stats"; }
146 time=$(sed -n -e "s/^\($stat\): \\(.*\\)/\\2/p" $file) 147 time=$(sed -n -e "s/^\($stat\): \\(.*\\)/\\2/p" $file)
147 # in case the stat is not present, set the value as NA 148 # in case the stat is not present, set the value as NA
148 [ -z "$time" ] && { time="NA"; } 149 [ -z "$time" ] && { time="NA"; }
149 # Append it to times 150 # Append it to times
150 if [ -z "$times" ]; then 151 if [ -z "$times" ]; then
151 times="${time}" 152 times="${time}"
152 else 153 else
153 times="${times} ${time}" 154 times="${times} ${time}"
154 fi 155 fi
155 done
156 if [ -n "$ACCUMULATE" ]; then
157 IFS=' '; valuesarray=(${times}); IFS=':'
158 times=0
159 for value in "${valuesarray[@]}"; do
160 [ "$value" == "NA" ] && { echo "ERROR: stat is not present."; usage; exit 1; }
161 times=$(( $times + $value ))
162 done 156 done
163 fi 157 if [ -n "$ACCUMULATE" ]; then
158 IFS=' '; valuesarray=(${times}); IFS=':'
159 times=0
160 for value in "${valuesarray[@]}"; do
161 [ "$value" == "NA" ] && { echo "ERROR: stat is not present."; usage; exit 1; }
162 times=$(( $times + $value ))
163 done
164 fi
164 echo "${task} ${recipe} ${times}" 165 echo "${task} ${recipe} ${times}"
165 done 166 done
166done 167done