summaryrefslogtreecommitdiff
path: root/2019/rust/time_all.sh
blob: 4b96bae443bc7f5c3e20e09c040318e95c6db84d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/zsh -e

for DIR in day??
do
  cd "${DIR}"
  cargo build --release

  for PART in ./both*part*sh
  do
    for I in `seq 10`; do
      time "${PART}" >/dev/null
    done 2> timing.txt
  done
  
  ALL_TIMINGS="`cat timing.txt | sed 's/.* \([0-9.]*\) total/\1 +/'`"
  NO_OF_TIMINGS=`echo "${ALL_TIMINGS}" | wc -l`
  MEAN_TIMING=`echo $[ (${ALL_TIMINGS} 0.0005)/${NO_OF_TIMINGS} ]`

  cd ..
  echo "${DIR} ${MEAN_TIMING}"
  echo "${DIR} ${MEAN_TIMING}" > mean_timings.txt
done