diff --git a/dev/bench/bench.sh b/dev/bench/bench.sh index c9b898fb6476..06d0cc917b1b 100755 --- a/dev/bench/bench.sh +++ b/dev/bench/bench.sh @@ -479,6 +479,12 @@ format_vosize() { echo "$1 $old $new $diff $diffpercent%" } +prof_json_timings() { + find "$1" -name '*.vo.prof.json' | while read -r prof; do + jq -r --arg vo "${prof%.prof.json}" '[.traceEvents[] | select(.name == "process") | {(.ph): .ts}] | add | ((.E - .B) / 1e4 | round) as $cs | "\($vo) (real: \($cs / 100 | floor).\($cs % 100 | tostring | if length < 2 then "0" + . else . end))"' "$prof" || true + done +} + # -------------------------------------------------------------------------------- # Measure the compilation times of the specified OPAM packages in both switches @@ -601,6 +607,13 @@ $coq_opam_package (dependency install failed in $RUNNER)" echo $_RES > $log_dir/$coq_opam_package.$RUNNER.opam_install.$iteration.exit_status # "opam install" was successful. + prof_timings=$log_dir/$coq_opam_package.$RUNNER.opam_install.$iteration.prof_timings.log + if grep -q ' (real: ' $log_dir/$coq_opam_package.$RUNNER.opam_install.$iteration.stdout.log; then + : > "$prof_timings" + else + prof_json_timings "$(echo "$OPAMROOT/ocaml-$RUNNER/.opam-switch/build/${coq_opam_package%%.*}".*/)" > "$prof_timings" + fi + # Remove the benchmarked OPAM-package, unless this is the # very last iteration (we want to keep this OPAM-package # because other OPAM-packages we will benchmark later @@ -680,8 +693,8 @@ $skipped_packages" # opam logs prefix the printing with "- " so remove that # remove the base path for nicer printing and so the script can identify common files "$program_path"/../../tools/make-both-time-files.py --real \ - <(sed -e 's/^- //' -e "s:$new_base_path::" "$log_dir/$coq_opam_package.NEW.opam_install.$iteration.stdout.log") \ - <(sed -e 's/^- //' -e "s:$old_base_path::" "$log_dir/$coq_opam_package.OLD.opam_install.$iteration.stdout.log") \ + <(sed -e 's/^- //' -e "s:$new_base_path::" "$log_dir/$coq_opam_package.NEW.opam_install.$iteration.stdout.log" "$log_dir/$coq_opam_package.NEW.opam_install.$iteration.prof_timings.log") \ + <(sed -e 's/^- //' -e "s:$old_base_path::" "$log_dir/$coq_opam_package.OLD.opam_install.$iteration.stdout.log" "$log_dir/$coq_opam_package.OLD.opam_install.$iteration.prof_timings.log") \ > "$log_dir/$coq_opam_package.BOTH.perfile_timings.$iteration.log" done @@ -752,8 +765,8 @@ new_base_path=$new_opam_root/ocaml-NEW/.opam-switch/build/ old_base_path=$old_opam_root/ocaml-OLD/.opam-switch/build/ for iteration in $(seq $num_of_iterations); do "$program_path"/../../tools/make-both-time-files.py --real \ - <(sed -e 's/^- //' -e "s:$new_base_path::" "$log_dir/"*".NEW.opam_install.$iteration.stdout.log") \ - <(sed -e 's/^- //' -e "s:$old_base_path::" "$log_dir/"*".OLD.opam_install.$iteration.stdout.log") \ + <(sed -e 's/^- //' -e "s:$new_base_path::" "$log_dir/"*".NEW.opam_install.$iteration.stdout.log" "$log_dir/"*".NEW.opam_install.$iteration.prof_timings.log") \ + <(sed -e 's/^- //' -e "s:$old_base_path::" "$log_dir/"*".OLD.opam_install.$iteration.stdout.log" "$log_dir/"*".OLD.opam_install.$iteration.prof_timings.log") \ > "$log_dir/ALL.BOTH.perfile_timings.$iteration.log" done