File: perfscript.sh

package info (click to toggle)
p4est 2.3.6-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 8,536 kB
  • sloc: ansic: 87,528; makefile: 855; sh: 635; perl: 272; python: 226; awk: 40; javascript: 23
file content (42 lines) | stat: -rwxr-xr-x 1,222 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash

command -v perf >/dev/null 2>&1 || { echo >&2 "Could not find perf.  Aborting."; exit 1; }

STATS="instructions,cache-misses,branch-misses"
REPCOUNT=30

SPACESTATS=`echo $STATS | sed 's/,/ /g'`
echo "type level time $SPACESTATS" > p8.perf

for i in 5 6 7 8; do
  for type in "base" "nodes" "lnodes"; do
    if [ $type = "nodes" ]; then
      othertype="lnodes"
    elif [ $type = "base" ]; then
      othertype="lnodes --skip-nodes"
    else
      othertype="nodes"
    fi
    perf stat -o p8.$type.$i -e "$STATS" -r $REPCOUNT ./p8est_timings \
      -c unit --skip-$othertype --level $i > p8.$type.$i.stdout
    runtime=`egrep "[0-9.]+ seconds time elapsed" p8.$type.$i | awk '{print $1;}'`
    accum=$runtime
    for stat in $SPACESTATS; do
      count=`egrep "[0-9,]+ $stat" p8.$type.$i | awk '{print $1;}' | sed 's/,//g'`
      accum="$accum $count"
    done
    if [ $type = "base" ]; then
      baseaccum=$accum
    else
      read -a basearray <<< "$baseaccum"
      read -a array <<< "$accum"
      for j in "${!array[@]}"; do
        val=`echo "${array[j]}-${basearray[j]}" | bc -l`
        array[j]=$val
      done
      diff="${array[*]}"
      echo "$type $i $diff" >> p8.perf
    fi
  done
done