diff --git a/src/mldebug/scripts/vaiprofile-collect-data b/src/mldebug/scripts/vaiprofile-collect-data index 3d050c1..dcd5590 100755 --- a/src/mldebug/scripts/vaiprofile-collect-data +++ b/src/mldebug/scripts/vaiprofile-collect-data @@ -4,9 +4,10 @@ # Packages VAIProfile inputs from a hardware run directory into vai_profile.zip (top-level files only), # then moves collected files into vai_profile_data (or vai_profile_data_ if the name exists). # Collects: aie_event_runtime_config_ctx__run_.json, aie_trace_ctx_*_run_*_inf_*_strm_*.txt, -# dtrace_dump_ctx*.py, record_timer_*.json (incl. record_timer_inference_*, record_timer_ts*, etc.), +# dtrace_dump_ctx*.py, aie_dtrace_*.ct, dtrace_dump_*.json, +# record_timer_*.json (incl. record_timer_inference_*, record_timer_ts*, etc.), # onnxruntime_profile_*.json. -# vai_profile.zip remains at the run directory root. +# vai_profile.zip remains at the run directory root (or vai_profile_.zip if the name already exists). # Usage: vaiprofile-collect-data # Requires: zip (Info-ZIP) on PATH. @@ -52,6 +53,12 @@ done for f in dtrace_dump_ctx*.py; do files+=("$f") done +for f in aie_dtrace_*.ct; do + files+=("$f") +done +for f in dtrace_dump_*.json; do + files+=("$f") +done for f in record_timer_*.json; do files+=("$f") done @@ -68,17 +75,19 @@ if ((${#files[@]} == 0)); then exit 1 fi +# Pick a single index shared by vai_profile_.zip and vai_profile_data_, +# so the zip and its extracted data directory always use the same suffix. out="${root}/vai_profile.zip" -rm -f "$out" -zip -j -q "$out" -- "${files[@]}" - profile_dir="${root}/vai_profile_data" -if [[ -e "$profile_dir" ]]; then +if [[ -e "$out" || -e "$profile_dir" ]]; then n=1 - while [[ -e "${root}/vai_profile_data_${n}" ]]; do + while [[ -e "${root}/vai_profile_${n}.zip" || -e "${root}/vai_profile_data_${n}" ]]; do ((n++)) || true done + out="${root}/vai_profile_${n}.zip" profile_dir="${root}/vai_profile_data_${n}" fi +zip -j -q "$out" -- "${files[@]}" + mkdir -p "$profile_dir" mv -- "${files[@]}" "$profile_dir/"