1 | #!/bin/bash
|
---|
2 |
|
---|
3 | NAME=$1
|
---|
4 |
|
---|
5 | if [ ! -f "raw/${NAME}.out" ]; then
|
---|
6 | echo "Not output for ${NAME}"
|
---|
7 | exit 1
|
---|
8 | fi
|
---|
9 |
|
---|
10 | if [ ! -f "raw/${NAME}.data" ]; then
|
---|
11 | echo "Not perf record for ${NAME}"
|
---|
12 | exit 1
|
---|
13 | fi
|
---|
14 |
|
---|
15 | echo "Processing perf data for ${NAME}"
|
---|
16 |
|
---|
17 | OPS=$(grep -e 'Total ops' raw/${NAME}.out)
|
---|
18 | CPOP=$( echo "Hello $OPS" | \grep -oP ", \K[0-9,]+(?=o)" --color | tr -d ',')
|
---|
19 | CPUSH=$(echo "Hello $OPS" | \grep -oP "\(\K[0-9,]+(?=i)" --color | tr -d ',')
|
---|
20 |
|
---|
21 | REPORT=''
|
---|
22 | perf report -n --percent-limit 5 --stdio --no-children -i raw/${NAME}.data > raw/.temp
|
---|
23 | EVENT=$(cat raw/.temp | grep -e '^# Samples'| cut -d ' ' -f 6)
|
---|
24 | SPOP=$( cat raw/.temp | grep -e '] relaxed_list<Node>::pop' | tr -s ' ' | cut -d ' ' -f 3)
|
---|
25 | SPUSH=$(cat raw/.temp | grep -e '] relaxed_list<Node>::push' | tr -s ' ' | cut -d ' ' -f 3)
|
---|
26 | SARR=$( cat raw/.temp | grep -e '] snz[i|m]_t::node::arrive_h' | tr -s ' ' | cut -d ' ' -f 3)
|
---|
27 |
|
---|
28 | echo "$OPS"
|
---|
29 | echo "Push count: $CPUSH"
|
---|
30 | echo "Pop count: $CPOP"
|
---|
31 |
|
---|
32 | echo "Pop samples: $SPOP"
|
---|
33 | echo "Push samples: $SPUSH"
|
---|
34 | echo "Arrive samples: $SARR"
|
---|
35 |
|
---|
36 | SpPUSH=$(bc -l <<< "scale=9; $SPUSH / $CPUSH")
|
---|
37 | SpPOP=$( bc -l <<< "scale=9; $SPOP / $CPOP" )
|
---|
38 | SpARR=$( bc -l <<< "scale=9; $SARR / $CPUSH")
|
---|
39 |
|
---|
40 | printf "%s per push() : %.9f\n" $EVENT $SpPUSH | sed ':a;s/\B[0-9]\{3\}\>/,&/;ta'
|
---|
41 | printf "%s per pop() : %.9f\n" $EVENT $SpPOP | sed ':a;s/\B[0-9]\{3\}\>/,&/;ta'
|
---|
42 | printf "%s per arrive(): %.9f\n" $EVENT $SpARR | sed ':a;s/\B[0-9]\{3\}\>/,&/;ta'
|
---|