1 Star 0 Fork 51

刘家华/Ark-workload

forked from xliu/Ark-workload 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
run_pgo.sh 5.77 KB
一键复制 编辑 原始数据 按行查看 历史
lixingfu 提交于 2023-08-25 17:46 . update script
#!/bin/bash
sdk_path="../.."
ark_js_vm="ark_js_vm"
toolspath=./toolspath.txt
tools_type="dev"
ts_path=ts-swift-workload
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
arg_name=""
true="true"
false="false"
run_count=1
aarch64=""
date=$(date +'%Y%m%d%H%M%S')
function help_explain(){
echo "[--help,--h]"
echo "[--run-count <count>]"
echo "[--case <case-name>]"
echo "[--date <date>]"
echo "[--build]"
echo "[--excel]"
echo "[--aarch64]"
}
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
;;
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 "
;;
esac
done
fi
case $tools_type in
"dev")
export LD_LIBRARY_PATH=${sdk_path}/out/x64.release/arkcompiler/ets_runtime:${sdk_path}/out/x64.release/thirdparty/icu:${sdk_path}/prebuilts/clang/ohos/linux-x86_64/llvm/lib:${sdk_path}/out/x64.release/thirdparty/zlib
;;
"rk3568")
export LD_LIBRARY_PATH=${sdk_path}/out/rk3568/clang_x64/arkcompiler/ets_runtime:${sdk_path}/out/hispark_taurus/clang_x64/thirdparty/icu:${sdk_path}/out/hispark_taurus/clang_x64/thirdparty/zlib:${sdk_path}/prebuilts/clang/ohos/linux-x86_64/llvm/lib
;;
"hispark_taurus")
export LD_LIBRARY_PATH=${sdk_path}/out/hispark_taurus/clang_x64/arkcompiler/ets_runtime:${sdk_path}/out/rk3568/clang_x64/thirdparty/icu:${sdk_path}/out/rk3568/clang_x64/thirdparty/zlib:${sdk_path}/out/hispark_taurus/clang_x64/thirdparty/cjson:${sdk_path}/prebuilts/clang/ohos/linux-x86_64/llvm/lib
;;
esac
pgo2path="pgo_build/${date}"
$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
function build_pgo(){
local ts_file=$1
local file_name=$2
local abc_file=${pgo2path}/${file_name}.abc
echo "build : ${ts_file} to ${pgo2path}"
${es2abc} ${ts_file} --type-extractor --module --merge-abc --extension=ts --output ${pgo2path}/${file_name}.abc
${ark_js_vm} --log-level=info --enable-pgo-profiler=true --compiler-opt-inlining=true --compiler-pgo-profiler-path=./${pgo2path}/${file_name}.ap --log-level=info --asm-interpreter=true --entry-point=${file_name} ${abc_file}
timeout 300s ${ark_aot_compiler} --compiler-opt-loop-peeling=true --compiler-fast-compile=false --compiler-opt-track-field=true --compiler-opt-inlining=true --compiler-max-inline-bytecodes=45 --compiler-opt-level=2 --builtins-dts=${sdk_path}/arkcompiler/ets_runtime/ecmascript/ts_types/lib_ark_builtins.d.abc --compiler-pgo-profiler-path=./${pgo2path}/${file_name}.ap ${aarch64} --aot-file=./${pgo2path}/${file_name} ${abc_file}
}
function run_pgo(){
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}
}
function run(){
if [[ "$build" = "true" ]]; then
if [ ! -d $pgo2path ];then
mkdir -p $pgo2path
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
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
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
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
TypeScript
1
https://gitee.com/liujh1997/ark-workload.git
[email protected]:liujh1997/ark-workload.git
liujh1997
ark-workload
Ark-workload
master

搜索帮助