• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2
3#usage  runGetPerformanceInfo   ${PerformanceLogFile}
4runGetPerformanceInfo_openh264()
5{
6
7        if [ ! $# -eq 2 ]
8        then
9                echo "not enough parameters!"
10                echo "usage: ${0} [android/ios] ${PerformanceLogFile}"
11                return 1
12        fi
13
14        local PerformanceLogFile=$2
15    local FileName=""
16        local Width=""
17        local Height=""
18        local Frames=""
19        local FPS=""
20        local EncodeTime=""
21    if [ $1 = "android" ]
22    then seperatorNum=3
23    else
24        seperatorNum=2
25    fi
26
27        while read line
28        do
29                if [[ $line =~ "enc yuv file"  ]]
30                then
31            FileName=`echo $line | awk 'BEGIN {FS="enc yuv file"} {print $2}'`
32            FileName=`echo $FileName | awk 'BEGIN {FS=":"} {print $2}'`
33        fi
34        if [[ $line =~ "Width" ]]
35        then
36            Width=`echo $line | awk 'BEGIN {FS=":"} {print $'${seperatorNum}'}'`
37        fi
38        if [[ $line =~ "Height" ]]
39        then
40            Height=`echo $line | awk 'BEGIN {FS=":"} {print $'${seperatorNum}'}'`
41        fi
42        if [[ $line =~ "Frames" ]]
43        then
44            Frames=`echo $line | awk 'BEGIN {FS=":"} {print $'${seperatorNum}'}'`
45        fi
46        if [[ $line =~ "FPS" ]]
47        then
48            FPS=`echo $line | awk 'BEGIN {FS=":"} {print $'${seperatorNum}'}'`
49            FPS=`echo $FPS | awk 'BEGIN {FS="fps"} {print $1}'`
50        echo "${FileName},"${Width}x${Height}",${Frames},${FPS}"
51        fi
52
53        if [[  $line =~ "encode time"  ]]
54                then
55                        EncodeTime=`echo $line | awk 'BEGIN {FS=":"} {print $'${seperatorNum}'}'`
56                fi
57        if [[ $line =~ "height" ]]
58        then
59            Height=`echo $line | awk 'BEGIN {FS=":"} {print $'${seperatorNum}'}'`
60        fi
61        if [[ $line =~ "H264 source file name" ]]
62        then
63            FileName=`echo $line | awk 'BEGIN {FS=":"} {print $'${seperatorNum}'}'`
64       if [ $1 = "ios" ]
65       then
66            FileName=`echo $FileName | awk -F"DecoderPerfTestRes" '{print $2}'`
67            FileName=`echo $FileName | awk -F"/" '{print $2}'`
68       else
69            FileName=`echo $FileName | awk -F"/" '{print $4}'`
70       fi
71      fi
72
73        done <${PerformanceLogFile}
74
75
76}
77AUTO_TEST_RESULT_PATH="./TestResultCSV/"
78
79
80parseLogToCSV()
81{
82if [ $# -ne 1 ]
83then echo "Please input $0 [android/ios]"
84fi
85if [ $* = "android" ]
86then
87     Result_log_path="./android/report/"
88     suffix=android
89     dos2unix ${Result_log_path}*.*
90else
91Result_log_path="./ios/report/"
92suffix=ios
93fi
94Result_log=`ls ${Result_log_path}`
95
96for log in ${Result_log}
97do
98  PerformFile=`echo $log |awk -F"." '{print $1}'`
99  PerformFile=${PerformFile}_${suffix}.csv
100 #inital perfermance file
101 echo "$log,,,">>${AUTO_TEST_RESULT_PATH}${PerformFile}
102 echo "YUV,Resolution,Encodedframes,FPS">>${AUTO_TEST_RESULT_PATH}${PerformFile}
103  runGetPerformanceInfo_openh264 ${suffix} ${Result_log_path}${log}>>${AUTO_TEST_RESULT_PATH}${PerformFile}
104done
105}
106parseLogToCSV android
107parseLogToCSV ios
108