代码拉取完成,页面将自动刷新
#!/bin/bash
#Init Variables
input_file=""
#Parse the arguments
while [[ "$#" -gt 0 ]]; do
case $1 in
--input) input_file="$2"; shift ;;
*) echo "Unknown parameter: $1"; exit 1;;
esac
shift
done
if [[ -z "$input_file" ]]; then
echo "Usage: $0 --input <input_file>"
exit 1
fi
echo "Input file is: $input_file"
#if [[ ! -f "$input_file" ]]; then
# echo "Error: $input_dir is not a valid file."
# exit 1
#fi
extension="${input_file##*.}"
#if [[ "$extension" == "trace" ]]; then
# echo "This is not a trace file"
#fi
base_name="${input_file%.*}"
tmp_file="${base_name}.tmp"
output_file="${base_name}.xml"
echo "Output file is: $output_file"
xctrace export --input $input_file --xpath '/trace-toc/run[@number="1"]/data/table[@schema="time-profile"]' > $output_file
schemas=(
"thread-state"
"device-thermal-state-intervals"
"syscall"
"virtual-memory"
"potential-hangs"
"cpu-profile"
"metal-gpu-intervals"
"display-vsyncs-interval"
)
# Loop through each schema and export data
for schema in "${schemas[@]}"; do
xctrace export --input "$input_file" --xpath "/trace-toc/run[@number='1']/data/table[@schema='$schema']" > "$tmp_file"
sed '1d' "$tmp_file" >> "$output_file"
done
# Optionally, clean up the temporary file
rm "$tmp_file"
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。