ref: 2ac973474ab6e8298e1d6ffea422acc2e0720925
parent: 0b85855e986f44d40adce62f607aa2950b8f277e
author: syureyi <[email protected]>
date: Tue Aug 12 10:29:39 EDT 2014
improve perf
--- a/autotest/performanceTest/android/run_AutoTest_android.sh
+++ b/autotest/performanceTest/android/run_AutoTest_android.sh
@@ -77,7 +77,7 @@
test_path="/sdcard/welsdec"
log_grep_params="welsdec"
test_res=${AUTO_TEST_ANDROID_PATH}/../DecoderPerfTestRes
- report_file=${AUTO_TEST_RES_PATH}/decPerf_${rand}
+ report_file=${AUTO_TEST_RES_PATH}/decPerf
fi
if [[ "${apk}" =~ "WelsEncTest-debug.apk" ]]
@@ -87,9 +87,9 @@
test_path="/sdcard/welsenc"
log_grep_params="welsenc"
test_res=${AUTO_TEST_ANDROID_PATH}/../EncoderPerfTestRes
- report_file=${AUTO_TEST_RES_PATH}/encPerf_${rand}
+ report_file=${AUTO_TEST_RES_PATH}/encPerf
fi
-
+space="limit"
for dev in $devices; do
dev_info_file=${AUTO_TEST_RES_PATH}/${dev}.log
$ADB -s $dev uninstall ${apk_id}
@@ -97,22 +97,62 @@
#TODO: output more info about android device such as name,cpu,memory,and also power comsumption.
echo `$ADB -s $dev shell cat /system/build.prop |grep ro.product.model | awk -F"=" '{print $2}'`>${dev_info_file}
#push resources
+ #For limited devices space
+ if [ ${space} = "limit" ]
+ then
+ test_res_bak=${test_res}_bak
+ mv ${test_res} ${test_res_bak}
+ mkdir -p ${test_res}
+ test_case=`ls ${test_res_bak}`
+ for case in ${test_case}
+ do
+ echo ${case}
+ cp -r ${test_res_bak}/${case} ${test_res}/.
+ $ADB -s $dev push ${test_res} ${test_path}
+ #before start logcat,kill logcat
+ pid=`$ADB -s $dev shell ps | grep logcat | awk '{print $2;}'`
+ [ "#$pid" != "#" ] && $ADB -s $dev shell kill $pid >/dev/null
+ $ADB -s $dev logcat -c
+ $ADB -s $dev logcat |grep ${log_grep_params} >>${report_file}_${dev}_${rand}.log &
+ $ADB -s $dev shell am start -n ${apk_main}
+ # check whetehr the app is finished every 2 sec
+ for (( ; ; )); do
+ $ADB -s $dev shell ps | grep ${apk_id}
+ if [ $? -ne 0 ]; then
+ sleep 2
+ $ADB -s $dev shell ps | grep ${apk_id}
+ [ $? -ne 0 ] && break
+ fi
+ sleep 2
+ done
+
+ # kill logcat
+ pid=`$ADB -s $dev shell ps | grep logcat | awk '{print $2;}'`
+ [ "#$pid" != "#" ] && $ADB -s $dev shell kill $pid >/dev/null
+
+ #delete the res
+ $ADB -s $dev shell rm -rf ${test_path}
+ rm -rf ${test_res}/${case}
+ done
+ rm -rf ${test_res}
+ mv ${test_res_bak} ${test_res}
+ else
$ADB -s $dev push ${test_res} ${test_path}
#before start logcat,kill logcat
pid=`$ADB -s $dev shell ps | grep logcat | awk '{print $2;}'`
[ "#$pid" != "#" ] && $ADB -s $dev shell kill $pid >/dev/null
$ADB -s $dev logcat -c
- $ADB -s $dev logcat |grep ${log_grep_params} >${report_file}_${dev}.log &
+ $ADB -s $dev logcat |grep ${log_grep_params} >${report_file}_${dev}_${rand}.log &
$ADB -s $dev shell am start -n ${apk_main}
# check whetehr the app is finished every 2 sec
for (( ; ; )); do
- $ADB -s $dev shell ps | grep ${apk_id}
- if [ $? -ne 0 ]; then
- sleep 2
- $ADB -s $dev shell ps | grep ${apk_id}
- [ $? -ne 0 ] && break
- fi
+ $ADB -s $dev shell ps | grep ${apk_id}
+ if [ $? -ne 0 ]; then
sleep 2
+ $ADB -s $dev shell ps | grep ${apk_idi}
+ [ $? -ne 0 ] && break
+ fi
+ sleep 2
done
# kill logcat
@@ -121,6 +161,8 @@
#delete the res
$ADB -s $dev shell rm -rf ${test_path}
+ fi
+
done
}
for apk in ${apk_name};do
--- a/autotest/performanceTest/ios/run_AutoTest_ios.sh
+++ b/autotest/performanceTest/ios/run_AutoTest_ios.sh
@@ -12,7 +12,7 @@
buildXcodeProject()
{
- xcodebuild ARCHS="${CODEC_TEST_IOS_ARCH}" VALID_ARCHS="${CODEC_TEST_IOS_ARCH}" ONLY_ACTIVE_ARCH=YES -project $1 -target $2 -configuration $3 -sdk ${CODEC_TEST_IOS_PLATFORM} clean build
+ xcodebuild ARCHS="${CODEC_TEST_IOS_ARCH}" VALID_ARCHS="${CODEC_TEST_IOS_ARCH}" ONLY_ACTIVE_ARCH=YES -project $1 -target $2 -configuration $3 -sdk ${CODEC_TEST_IOS_PLATFORM} clean build
if [ $? -eq 0 ]; then
echo "build $1 $3 successfully"
@@ -98,6 +98,21 @@
do
echo "Try to run on device:${DEVICE_ID}"
+#Encoder YUV file too large
+if [ ${ENCDEC} = "enc" ]
+then
+#For limited devices space
+BAKRES=${CODEC_TEST_RES}_bak
+mv ${CODEC_TEST_RES} ${BAKRES}
+mkdir -p ${CODEC_TEST_RES}
+CODEC_CASE=`ls ${BAKRES}`
+echo ${CODEC_CASE}
+for CASE in ${CODEC_CASE}
+do
+echo ${CASE}
+cp -r ${BAKRES}/${CASE} ${CODEC_TEST_RES}/.
+
+
#uninstall the application from device to remove the last result
./fruitstrap uninstall --bundle ${CODEC_TEST_IOS_APP_ID} --id ${DEVICE_ID}
if [ $? -ne 0 ]; then
@@ -110,16 +125,47 @@
exit 1
fi
-./iFileTransfer -o copy -id ${DEVICE_ID} -app ${CODEC_TEST_IOS_APP_ID} -from ${CODEC_TEST_RES}
+#./iFileTransfer -o copy -id ${DEVICE_ID} -app ${CODEC_TEST_IOS_APP_ID} -from ${CODEC_TEST_RES}
instruments -w ${DEVICE_ID} -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate ${CODEC_TEST_IOS_APP} -e UIASCRIPT ./uiascript.js -e UIARRESULTPATH /tmp/
#copy to report folder
-./iFileTransfer -o download -id ${DEVICE_ID} -app ${CODEC_TEST_IOS_APP_ID} -from /Documents/${CODEC_TEST_LOG}.log -to ${CODEC_TEST_IOS_REPORT_PATH}/${CODEC_TEST_LOG}_${DEVICE_ID}_${rand}.log
+./iFileTransfer -o download -id ${DEVICE_ID} -app ${CODEC_TEST_IOS_APP_ID} -from /Documents/${CODEC_TEST_LOG}.log -to ${CODEC_TEST_IOS_REPORT_PATH}/${CODEC_TEST_LOG}_${DEVICE_ID}_${rand}_${CASE}.log
if [ $? -ne 0 ]; then
echo "download file: ${CODEC_TEST_LOG}.log from ${CODEC_TEST_IOS_APP_ID} is failed!"
exit 1
fi
+cat ${CODEC_TEST_IOS_REPORT_PATH}/${CODEC_TEST_LOG}_${DEVICE_ID}_${rand}_${CASE}.log>>${CODEC_TEST_IOS_REPORT_PATH}/${CODEC_TEST_LOG}_${DEVICE_ID}_${rand}.log
+rm -f ${CODEC_TEST_IOS_REPORT_PATH}/${CODEC_TEST_LOG}_${DEVICE_ID}_${rand}_${CASE}.log
+rm -rf ${CODEC_TEST_RES}/${CASE}
+done
+rm -rf ${CODEC_TEST_RES}
+mv ${BAKRES} ${CODEC_TEST_RES}
+#Enough spaces
+else
+#uninstall the application from device to remove the last result
+./fruitstrap uninstall --bundle ${CODEC_TEST_IOS_APP_ID} --id ${DEVICE_ID}
+if [ $? -ne 0 ]; then
+echo uninstall application: ${CODEC_TEST_IOS_APP} from device: ${DEVICE_ID} is failed!
+fi
+#install the application
+./fruitstrap install --bundle ${CODEC_TEST_IOS_APP} --id ${DEVICE_ID}
+if [ $? -ne 0 ]; then
+echo install application: ${CODEC_TEST_IOS_APP} to device: ${DEVICE_ID} is failed!
+exit 1
+fi
+#./iFileTransfer -o copy -id ${DEVICE_ID} -app ${CODEC_TEST_IOS_APP_ID} -from ${CODEC_TEST_RES}
+instruments -w ${DEVICE_ID} -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate ${CODEC_TEST_IOS_APP} -e UIASCRIPT ./uiascript.js -e UIARRESULTPATH /tmp/
+#copy to report folder
+./iFileTransfer -o download -id ${DEVICE_ID} -app ${CODEC_TEST_IOS_APP_ID} -from /Documents/${CODEC_TEST_LOG}.log -to ${CODEC_TEST_IOS_REPORT_PATH}/${CODEC_TEST_LOG}_${DEVICE_ID}_${rand}_${CASE}.log
+if [ $? -ne 0 ]; then
+echo "download file: ${CODEC_TEST_LOG}.log from ${CODEC_TEST_IOS_APP_ID} is failed!"
+exit 1
+fi
+
+
+fi
done
+
fi
}
@@ -144,4 +190,4 @@
echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxIOS $ENCDEC Endxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
fi
#TODO:according to the trace of instruments to do some analysis
-find .\ -name *.trace -exec rm -rf {} \;
+#find ./ -name *.trace -exec rm -rf {} \;
--- a/autotest/performanceTest/run_perfTest.sh
+++ b/autotest/performanceTest/run_perfTest.sh
@@ -108,7 +108,7 @@
#TODO:NOW just generate csv file to display performance data
cd ${AUTO_TEST_PATH}
-if [[ "#`ls ./ios/report`" == "#" || "#`ls ./android/report`" == "#" ]]
+if [[ "#`ls ./ios/report`" == "#" && "#`ls ./android/report`" == "#" ]]
then
echo There is nothing result log generated at ios or android devices
else
--- a/codec/build/android/enc/jni/myjni.cpp
+++ b/codec/build/android/enc/jni/myjni.cpp
@@ -20,6 +20,8 @@
(char*) ((*env).GetStringUTFChars (jsOutbitName, NULL)),
(char*)("-numl"),
(char*)("1"),
+ (char*)("-lconfig"),
+ (char*)("0"),
(char*) ((*env).GetStringUTFChars (jsInlayerName, NULL))
};
LOGI ("Start to run JNI module!+++");
--- a/codec/build/iOS/dec/demo/demo.xcodeproj/project.pbxproj
+++ b/codec/build/iOS/dec/demo/demo.xcodeproj/project.pbxproj
@@ -42,6 +42,20 @@
remoteGlobalIDString = 4CE4427918B6FC360017DF25;
remoteInfo = welsdec;
};
+ 541044A6199888F800B44931 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 4CE444FA18B72AD70017DF25 /* welsdec.xcodeproj */;
+ proxyType = 1;
+ remoteGlobalIDString = 4CE4427818B6FC360017DF25;
+ remoteInfo = welsdec;
+ };
+ 541044A8199888F800B44931 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 4CE444F018B72A8F0017DF25 /* common.xcodeproj */;
+ proxyType = 1;
+ remoteGlobalIDString = 4CE443D418B722CD0017DF25;
+ remoteInfo = common;
+ };
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
@@ -206,6 +220,8 @@
buildRules = (
);
dependencies = (
+ 541044A7199888F800B44931 /* PBXTargetDependency */,
+ 541044A9199888F800B44931 /* PBXTargetDependency */,
);
name = demo;
productName = demo;
@@ -298,6 +314,19 @@
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXTargetDependency section */
+ 541044A7199888F800B44931 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ name = welsdec;
+ targetProxy = 541044A6199888F800B44931 /* PBXContainerItemProxy */;
+ };
+ 541044A9199888F800B44931 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ name = common;
+ targetProxy = 541044A8199888F800B44931 /* PBXContainerItemProxy */;
+ };
+/* End PBXTargetDependency section */
/* Begin PBXVariantGroup section */
F0E663521810EFA5000C888E /* InfoPlist.strings */ = {
--- a/codec/build/iOS/dec/demo/demo/main.m
+++ b/codec/build/iOS/dec/demo/demo/main.m
@@ -100,6 +100,7 @@
[yuvFileName UTF8String]
};
DecMain (sizeof (argvv) / sizeof (argvv[0]), (char**)&argvv[0]);
+ [manage removeItemAtPath:yuvFileName error:nil];//FOR limited devices spaces
fflush (stdout); // flush the content of stdout instantly
}
--- a/codec/build/iOS/enc/encDemo/encDemo/main.m
+++ b/codec/build/iOS/enc/encDemo/encDemo/main.m
@@ -140,6 +140,8 @@
[bitFileName UTF8String],
"-numl",
"1",
+ "-lconfig",
+ "0",
[layercfg UTF8String]
};