代码拉取完成,页面将自动刷新
同步操作将从 xliu/Ark-workload 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#!/bin/bash
sdk_path=~/workspace/daily/dev/code
toolspath=./toolspath.txt
tools_type="dev"
# ts_path=ts-swift-workload
ts_path=ts-swift-workload
code_ts_lib="BenchmarkMeasure"
target_path=""
current_path=$(pwd)
echo $current_path
# if [ -s "$toolspath" ]; then
# while IFS= read -r line; do
# case $line in
# *--ts-tools-path\ *)
# sdk_path="${line#*--ts-tools-path\ }"
# ;;
# *--ark_js_vm\ *)
# ark_js_vm="${line#*--ark_js_vm\ }"
# ;;
# *--es2abc\ *)
# es2abc="${line#*--es2abc\ }"
# ;;
# *--ark_aot_compiler\ *)
# ark_aot_compiler="${line#*--ark_aot_compiler\ }"
# ;;
# *--tools-type\ *)
# tools_type="${line#*--tools-type\ }"
# ;;
# *--case-path\ *)
# ts_path="${line#*--case-path\ }"
# ;;
# esac
# done < "toolspath.txt"
# fi
# 将带“~”的路径转换成绝对路径,保证脚本获取路径的准确性,部分命令不能使用“~”
# evaluated_path=$("echo $sdk_path")
# sdk_path=$(realpath "$evaluated_path")
arg_name=""
true="true"
false="false"
run_count=1
aarch64=""
date=$(date +'%Y%m%d%H%M%S')
code_v=1
pgo2path="${current_path}/pgo_build/${date}"
function help_explain(){
echo "[--help,--h]"
echo "[--run-count <count>]"
echo "[--case <case-name>]"
echo "[--date <date>]"
echo "[--build]"
echo "[--excel]"
echo "[--aarch64]"
echo "[--code-v] <code_path>"
}
if [ -z "$1" ]; then
echo "No input provided."
else
for arg in "$@"; do
case $arg_name in
"--case")
arg_name=""
case_name=$arg
;;
"--date")
arg_name=""
date=$arg
;;
"--run-count")
arg_name=""
run_count=$arg
;;
"--code-v")
arg_name=""
echo $arg
ts_path=$arg
pgo2path="${current_path}/pgo_build-${ts_path}/${date}"
case $arg in
"0")
ts_path=daily
pgo2path="${current_path}/pgo_build-${ts_path}/${date}"
;;
"1")
ts_path=ts-swift-workload
pgo2path="${current_path}/pgo_build/${date}"
;;
"ts-swift-workload")
ts_path=ts-swift-workload
pgo2path="${current_path}/pgo_build/${date}"
;;
"2")
ts_path=mix-case
pgo2path="${current_path}/pgo_build-${ts_path}/${date}"
;;
"3")
ts_path=weekly_workload
pgo2path="${current_path}/pgo_build-${ts_path}/${date}"
;;
esac
;;
esac
case $arg in
"--h")
help_explain
exit
;;
"--help")
help_explain
exit
;;
"--build")
build="true"
;;
"--case")
arg_name=$arg
;;
"--date")
arg_name=$arg
;;
"--excel")
excel="true"
;;
"--run-count")
arg_name=$arg
;;
"--aarch64")
aarch64=--compiler-target-triple=aarch64-unknown-linux-gnu
;;
"--code-v")
arg_name=$arg
;;
esac
done
fi
if [ ! -d $pgo2path ];then
mkdir -p $pgo2path
fi
echo "" >> ${pgo2path}/log.log
case $tools_type in
"dev")
target_path=x64.release
;;
"rk3568")
target_path=rk3568/clang_x64
;;
"hispark_taurus")
target_path=hispark_taurus/clang_x64
;;
esac
# user_lib=${sdk_path}/out/${target_path}/lib.unstripped
user_lib=${sdk_path}/out/${target_path}
# user_exe=${sdk_path}/out/${target_path}/exe.unstripped
user_exe=${sdk_path}/out/${target_path}
export LD_LIBRARY_PATH=${user_lib}/arkcompiler/ets_runtime:${user_lib}/thirdparty/icu:${user_lib}/thirdparty/zlib:${user_lib}/thirdparty/cjson:${sdk_path}/prebuilts/clang/ohos/linux-x86_64/llvm/lib
echo " \
export LD_LIBRARY_PATH=${user_lib}/arkcompiler/ets_runtime:${user_lib}/thirdparty/icu:${user_lib}/thirdparty/zlib:${user_lib}/thirdparty/cjson:${sdk_path}/prebuilts/clang/ohos/linux-x86_64/llvm/lib \
" >> ${pgo2path}/log.log
es2abc=${user_exe}/arkcompiler/ets_frontend/es2abc
ark_aot_compiler=${user_exe}/arkcompiler/ets_runtime/ark_aot_compiler
ark_js_vm=${user_exe}/arkcompiler/ets_runtime/ark_js_vm
chmod a+x ${es2abc}
chmod a+x ${ark_aot_compiler}
chmod a+x ${ark_js_vm}
echo " \
chmod a+x ${es2abc} \
" >> ${pgo2path}/log.log
echo " \
chmod a+x ${ark_aot_compiler} \
" >> ${pgo2path}/log.log
echo " \
chmod a+x ${ark_js_vm} \
" >> ${pgo2path}/log.log
$es2abc $sdk_path/arkcompiler/ets_runtime/ecmascript/ts_types/lib_ark_builtins.d.ts --type-extractor --type-dts-builtin --module --merge-abc --extension=ts --output $sdk_path/arkcompiler/ets_runtime/ecmascript/ts_types/lib_ark_builtins.d.abc
case_id=0
code_ts_filesInfo_files=($(find $ts_path -type f -name "fileInfo.txt" -exec dirname {} \;))
for filesInfo_file in "${code_ts_filesInfo_files[@]}"; do
cd ${current_path}
is_ts=($(echo ${filesInfo_file} | grep "ts"))
if [[ $is_ts == $filesInfo_file ]];then
echo ${filesInfo_file}
directory_name=$(basename $is_ts)
echo ${directory_name}
cd ${filesInfo_file}/
echo "---------------------------- ${filesInfo_file} ---------------------------" >> ${pgo2path}/log.log
((case_id++))
echo case name: ${directory_name}, case_id: ${case_id} >> ${pgo2path}/log.log
echo "-----------------------------es2abc------------------------------" >> ${pgo2path}/log.log
mapfile -t childs_ts < <(find . -type f -name "*.ts")
for child_ts in "${childs_ts[@]}"; do
echo "----- ${child_ts_dir} --------"
child_ts_dir=$(dirname "${child_ts}")
child_ts_name=$(basename $child_ts | cut -f1 -d '.')
if [[ "${child_ts_name}" == "${directory_name}" ]];then
continue
fi
cd $child_ts_dir
if [ ! -d $pgo2path/$child_ts_dir ];then
mkdir -p $pgo2path/$child_ts_dir
fi
${es2abc} $child_ts_name.ts \
--target-api-version=10 \
--type-extractor \
--module \
--merge-abc \
--extension=ts \
--output $pgo2path/$child_ts_dir/$child_ts_name.abc 2>&1 | tee -a ${pgo2path}/log.log
echo "----- child_ts : ${child_ts} , child_ts_dir : ${child_ts_dir} , child_ts_name : ${child_ts_name} ---------"
cd -
done
${es2abc} $directory_name.ts \
--target-api-version=10 \
--type-extractor \
--module \
--merge-abc \
--extension=ts \
--output ${pgo2path}/${directory_name}.abc 2>&1 | tee -a ${pgo2path}/log.log
# continue
cd ${current_path}
cd ${pgo2path}
echo "------------- ark_js_vm ----------"
${ark_js_vm} \
--log-level=info \
--enable-pgo-profiler=true \
--compiler-opt-inlining=true \
--compiler-pgo-profiler-path=./${directory_name}.ap \
--asm-interpreter=true \
--entry-point=${directory_name} \
${directory_name}.abc 2>&1 | tee -a ${pgo2path}/log.log
echo "-----------------------------ark_js_vm------------------------------" 2>&1 | tee -a ${pgo2path}/log.log
echo " \
${ark_js_vm} \
--log-level=info \
--enable-pgo-profiler=true \
--compiler-opt-inlining=true \
--compiler-pgo-profiler-path=./${directory_name}.ap \
--asm-interpreter=true \
--entry-point=${directory_name} \
${directory_name}.abc \
" >> ${pgo2path}/log.log
echo "------------- ark_aot_compiler ----------"
${ark_aot_compiler} \
--log-level=info \
--compiler-opt-loop-peeling=true \
--compiler-fast-compile=false \
--compiler-opt-inlining=true \
--compiler-max-inline-bytecodes=45 \
--builtins-dts=${sdk_path}/arkcompiler/ets_runtime/ecmascript/ts_types/lib_ark_builtins.d.abc \
--compiler-pgo-profiler-path=./${directory_name}.ap \
--aot-file=./${directory_name} \
${directory_name}.abc 2>&1 | tee -a ${pgo2path}/log.log
echo "-----------------------------ark_aot_compiler------------------------------" 2>&1 | tee -a ${pgo2path}/log.log
echo " \
${ark_aot_compiler} \
--log-level=info \
--compiler-opt-loop-peeling=true \
--compiler-fast-compile=false \
--compiler-opt-inlining=true \
--compiler-max-inline-bytecodes=45 \
--builtins-dts=${sdk_path}/arkcompiler/ets_runtime/ecmascript/ts_types/lib_ark_builtins.d.abc \
--compiler-pgo-profiler-path=./${directory_name}.ap \
--aot-file=./${directory_name} \
${directory_name}.abc \
" >> ${pgo2path}/log.log
${ark_js_vm} \
--log-level=info \
--enable-pgo-profiler=true \
--compiler-opt-inlining=true \
--compiler-pgo-profiler-path=./${directory_name}.ap \
--asm-interpreter=true \
--aot-file=./${directory_name} \
--entry-point=${directory_name} \
${directory_name}.abc 2>&1 | tee -a ${pgo2path}/log.log
# --icu-data-path ${sdk_path}/third_party/icu/ohos_icu4j/data
# --asm-interpreter=true
echo "-----------------------------ark_js_vm------------------------------" >> ${pgo2path}/log.log
echo " \
${ark_js_vm} \
--log-level=info \
--enable-pgo-profiler=true \
--compiler-opt-inlining=true \
--compiler-pgo-profiler-path=./${directory_name}.ap \
--asm-interpreter=true \
--aot-file=./${directory_name} \
--entry-point=${directory_name} \
${directory_name}.abc \
" >> ${pgo2path}/log.log
${ark_aot_compiler} \
--log-level=info \
--compiler-opt-loop-peeling=true \
--compiler-fast-compile=false \
--compiler-opt-inlining=true \
--compiler-max-inline-bytecodes=45 \
--builtins-dts=${sdk_path}/arkcompiler/ets_runtime/ecmascript/ts_types/lib_ark_builtins.d.abc \
--compiler-pgo-profiler-path=./${directory_name}.ap \
${aarch64} \
--aot-file=./${directory_name} \
${directory_name}.abc 2>&1 | tee -a ${pgo2path}/log.log
echo "-----------------------------ark_aot_compiler------------------------------" >> ${pgo2path}/log.log
echo " \
${ark_aot_compiler} \
--log-level=info \
--compiler-opt-loop-peeling=true \
--compiler-fast-compile=false \
--compiler-opt-inlining=true \
--compiler-max-inline-bytecodes=45 \
--builtins-dts=${sdk_path}/arkcompiler/ets_runtime/ecmascript/ts_types/lib_ark_builtins.d.abc \
--compiler-pgo-profiler-path=./${directory_name}.ap \
${aarch64} \
--aot-file=./${directory_name} \
${directory_name}.abc \
" >> ${pgo2path}/log.log
echo " " >> ${pgo2path}/log.log
cd ${current_path}
fi
done
# exit
cd ${current_path}
function build_pgo(){
local ts_file=$1
local file_name=$2
local abc_file=${file_name}.abc
echo "${ts_file}"
is_ts=false
for filesInfo_file in "${code_ts_filesInfo_files[@]}"; do
file=($(echo ${filesInfo_file} | grep "ts"))
echo " ---------------- ${ts_file} ${file} -----------------------"
# if echo "$file" | grep -q "$ts_file" ;then
if [[ "$file" == *"$ts_file"* ]];then
echo " ---------------- if ${ts_file} ${file} break -----------------------"
is_ts=true
break
fi
done
if [[ ${is_ts} == true ]];then
echo "is true"
return
fi
echo " " >> log.log
echo "-----------------------------build------------------------------" >> ${pgo2path}/log.log
((case_id++))
echo case name: ${directory_name}, case_id: ${case_id} >> ${pgo2path}/log.log
echo "build : ${ts_file} to ${pgo2path}" >> ${pgo2path}/log.log
${es2abc} ${ts_file} \
--target-api-version=10 \
--type-extractor \
--module \
--merge-abc \
--extension=ts \
--output ${pgo2path}/${file_name}.abc 2>&1 | tee -a ${pgo2path}/log.log
echo "------------------------es2abc----------------------------" >> ${pgo2path}/log.log
echo " \
${es2abc} ${ts_file} \
--target-api-version=10 \
--type-extractor \
--module \
--merge-abc \
--extension=ts \
--output ${pgo2path}/${file_name}.abc \
" >> ${pgo2path}/log.log
if [ "${code_ts_lib}" == "${file_name}" ];then
echo "code_ts_lib: ${code_ts_lib} : file_name:${file_name}" >> ${pgo2path}/log.log
return 1
fi
cd ${pgo2path}
${ark_js_vm} \
--log-level=info \
--enable-pgo-profiler=true \
--compiler-opt-inlining=true \
--compiler-pgo-profiler-path=./${file_name}.ap \
--asm-interpreter=true \
--entry-point=${file_name} \
${abc_file} 2>&1 | tee -a ${pgo2path}/log.log
# --icu-data-path ${sdk_path}/third_party/icu/ohos_icu4j/data
# --asm-interpreter=true
echo "------------------------ark_js_vm----------------------------" >> ${pgo2path}/log.log
echo " \
${ark_js_vm} \
--log-level=info \
--enable-pgo-profiler=true \
--compiler-opt-inlining=true \
--compiler-pgo-profiler-path=./${file_name}.ap \
--asm-interpreter=true \
--entry-point=${file_name} \
${abc_file} \
" >> ${pgo2path}/log.log
${ark_aot_compiler} \
--log-level=info \
--compiler-opt-loop-peeling=true \
--compiler-fast-compile=false \
--compiler-opt-inlining=true \
--compiler-max-inline-bytecodes=45 \
--builtins-dts=${sdk_path}/arkcompiler/ets_runtime/ecmascript/ts_types/lib_ark_builtins.d.abc \
--compiler-pgo-profiler-path=./${file_name}.ap \
--aot-file=./${file_name} \
${abc_file} 2>&1 | tee -a ${pgo2path}/log.log
echo "------------------------ark_aot_compiler----------------------------" >> ${pgo2path}/log.log
echo " \
${ark_aot_compiler} \
--log-level=info \
--compiler-opt-loop-peeling=true \
--compiler-fast-compile=false \
--compiler-opt-inlining=true \
--compiler-max-inline-bytecodes=45 \
--builtins-dts=${sdk_path}/arkcompiler/ets_runtime/ecmascript/ts_types/lib_ark_builtins.d.abc \
--compiler-pgo-profiler-path=./${file_name}.ap \
--aot-file=./${file_name} \
${abc_file} \
" >> ${pgo2path}/log.log
${ark_js_vm} \
--log-level=info \
--enable-pgo-profiler=true \
--compiler-opt-inlining=true \
--compiler-pgo-profiler-path=./${file_name}.ap \
--asm-interpreter=true \
--aot-file=./${file_name} \
--entry-point=${file_name} \
${abc_file} 2>&1 | tee -a ${pgo2path}/log.log
echo "------------------------ark_js_vm----------------------------" >> ${pgo2path}/log.log
echo " \
${ark_js_vm} \
--log-level=info \
--enable-pgo-profiler=true \
--compiler-opt-inlining=true \
--compiler-pgo-profiler-path=./${file_name}.ap \
--asm-interpreter=true \
--aot-file=./${file_name} \
--entry-point=${file_name} \
${abc_file} \
" >> ${pgo2path}/log.log
${ark_aot_compiler} \
--log-level=info \
--compiler-opt-loop-peeling=true \
--compiler-fast-compile=false \
--compiler-opt-inlining=true \
--compiler-max-inline-bytecodes=45 \
--builtins-dts=${sdk_path}/arkcompiler/ets_runtime/ecmascript/ts_types/lib_ark_builtins.d.abc \
--compiler-pgo-profiler-path=./${file_name}.ap \
${aarch64} \
--aot-file=./${file_name} \
${abc_file} 2>&1 | tee -a ${pgo2path}/log.log
echo "------------------------ark_aot_compiler----------------------------" >> ${pgo2path}/log.log
echo " \
${ark_aot_compiler} \
--log-level=info \
--compiler-opt-loop-peeling=true \
--compiler-fast-compile=false \
--compiler-opt-inlining=true \
--compiler-max-inline-bytecodes=45 \
--builtins-dts=${sdk_path}/arkcompiler/ets_runtime/ecmascript/ts_types/lib_ark_builtins.d.abc \
--compiler-pgo-profiler-path=./${file_name}.ap \
${aarch64} \
--aot-file=./${file_name} \
${abc_file} \
" >> ${pgo2path}/log.log
echo " " >> ${pgo2path}/log.log
cd ${current_path}
}
cd ${current_path}
function run_pgo(){
if [ "${code_ts_lib}" == "${file_name}" ];then
echo "code_ts_lib: ${code_ts_lib} : file_name:${file_name}"
return 1
fi
cd ${pgo2path}
local file_name=$1
local abc_file=${pgo2path}/${file_name}.abc
echo run ${file_name}
${ark_js_vm} --entry-point=${file_name} --aot-file=./${pgo2path}/${file_name} ${abc_file}
cd -
}
function run(){
if [[ "$build" = "true" ]]; then
code_ts_lib_file=$(find $ts_path -type f -name ${code_ts_lib}.ts)
if [ "${code_ts_lib_file}" != "" ]; then
file_name=$(basename "${code_ts_lib_file}" | cut -f1 -d'.')
pgo_build_path=$(dirname "${pgo2path}")
${es2abc} ${code_ts_lib_file} --type-extractor --module --merge-abc --extension=ts --output ${pgo_build_path}/${file_name}.abc
fi
if [ -z "$case_name" ]; then
txt_files=($(find $ts_path -type f -name "*.ts"))
for file in "${txt_files[@]}"; do
echo " --------Content of $file:"
local ts_file_path=$file
local file_name=$(basename "${file}" | cut -f1 -d'.')
build_pgo ${ts_file_path} ${file_name}
if [[ "$excel" = "true" ]]; then
if [ "${code_ts_lib}" == "${file_name}" ];then
echo "code_ts_lib: ${code_ts_lib} : file_name:${file_name}"
continue
fi
python pgo2excel.py --case-dir $pgo2path --run-case $file_name --run-count $run_count --ark_js_vm $ark_js_vm
fi
done
else
local ts_file_path=$(find ${ts_path} -name "${case_name}.ts")
local file_name=$(basename "$ts_file_path" | cut -f1 -d'.')
if [ -f "${ts_file_path}" ]; then
build_pgo ${ts_file_path} ${file_name}
if [[ "$excel" = "true" ]]; then
if [ "${code_ts_lib}" == "${file_name}" ];then
echo "code_ts_lib: ${code_ts_lib} : file_name:${file_name}"
continue
fi
python pgo2excel.py --case-dir $pgo2path --run-case $file_name --run-count $run_count --ark_js_vm $ark_js_vm
fi
fi
fi
fi
if [ ! -d $pgo2path ];then
echo "${pgo2path} No such file or directory"
exit
fi
}
run
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。