Update S3P tests for xacml-pdp
[policy/xacml-pdp.git] / testsuites / performance / src / main / resources / testplans / results.sh
1 #!/bin/bash
2
3 #============LICENSE_START=======================================================
4 #ONAP Policy API Performance
5 #================================================================================
6 #Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
7 #================================================================================
8 #Licensed under the Apache License, Version 2.0 (the "License");
9 #you may not use this file except in compliance with the License.
10 #You may obtain a copy of the License at
11 #
12 #     http://www.apache.org/licenses/LICENSE-2.0
13 #
14 #Unless required by applicable law or agreed to in writing, software
15 #distributed under the License is distributed on an "AS IS" BASIS,
16 #WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 #See the License for the specific language governing permissions and
18 #limitations under the License.
19 #============LICENSE_END=========================================================
20
21 LOGFILE=$1
22 if [[ ! -f $LOGFILE ]]; then
23   echo "The file '$LOGFILE' in not provided."
24   echo "Please provide log file to process."
25   exit 1
26 fi
27
28 echo "File being processed: " $LOGFILE
29 MS=$(awk -F "," 'NR==2 { tbeg = $1 }
30     NR>1 { tend = $1 }
31     END { print tend-tbeg }' $LOGFILE)
32 RES=$(awk -F "," 'NR>1 { total += $15 } END { print total/NR }' $LOGFILE)
33 echo "Average Latency (ms): " $RES
34 LC=$(awk 'END{print NR}' $LOGFILE)
35 echo "Total Requests:" $LC
36 MPS=$(echo $LC $MS | awk '{ print 1000*$1/$2 }')
37 echo "Measured requests/sec:" $MPS
38