edith
Clone
https://git.tahinli.com/Tahinli/edith.git
0 watching0 forksRust18.3 MiB290699eTahinli3 months ago396 commits
| 1 | #!/usr/bin/env bash |
| 2 | # The decode/encode baseline: runs `examples/bench` over a list of real files |
| 3 | # and writes one TSV of medians. Every later codec change is compared against |
| 4 | # the file this produces, so it is meant to be run twice -- before and after -- |
| 5 | # on an otherwise idle machine. |
| 6 | # |
| 7 | # scripts/bench.sh <out_dir> [file ...] |
| 8 | # |
| 9 | # With no files it reads them from $BENCH_LIST (one path per line, `#` comments |
| 10 | # allowed), and failing that from assets/test_av.mp4. The list lives *outside* |
| 11 | # this repo on purpose: what is measured here is a personal media library and |
| 12 | # its file names are not this project's to record. |
| 13 | # |
| 14 | # Output in <out_dir>: baseline.tsv (the data) and bench.log (every run's |
| 15 | # stderr, decoder panics included). |
| 16 | # |
| 17 | # Methodology, so a rerun means the same thing: |
| 18 | # * cold = the file's pages dropped with posix_fadvise(DONTNEED) immediately |
| 19 | # before the measurement -- no root, nothing else on the machine evicted, |
| 20 | # and advisory, so it is the optimistic end of cold. |
| 21 | # * warm = the same call repeated straight after, cache as the cold run left it. |
| 22 | # * medians of 5 for open and seek, 20 steps for a scrub, and for export as |
| 23 | # many reps as $BENCH_EXPORT_CAP seconds leave room for (at least one, |
| 24 | # which is then marked CAPPED if it did not finish). |
| 25 | # * every metric runs as its own process: a decoder that panics costs one |
| 26 | # row, not the run. |
| 27 | # * the media files are opened read only; only <out_dir> is written to. |
| 28 | |
| 29 | |
| 30 | |
| 31 | OUT_DIR= |
| 32 | if [; then |
| 33 | |
| 34 | |
| 35 | fi |
| 36 | |
| 37 | |
| 38 | TSV="/baseline.tsv" |
| 39 | LOG="/bench.log" |
| 40 | |
| 41 | # Absolute, because $CARGO_TARGET_DIR may already be one and the plugin path |
| 42 | # below must not become "$PWD/$HOME/...". |
| 43 | TARGET= |
| 44 | || |
| 45 | BENCH="/release/examples/bench" |
| 46 | # The plugin is looked for beside the running executable, and an example binary |
| 47 | # lives one directory below the plugin: without this, hardware decode and |
| 48 | # hardware encode silently fall back to software and the baseline is a lie. |
| 49 | # Measured on the control file: seek to 600 s is 23 ms on the plugin and |
| 50 | # 1359 ms without it, and every export seat reads "SW". |
| 51 | |
| 52 | |
| 53 | files=("") |
| 54 | if [ && [; then |
| 55 | while ; do |
| 56 | [ && continue |
| 57 | case "" in \#*) continue ;; esac |
| 58 | files+=("") |
| 59 | done |
| 60 | fi |
| 61 | [ && files=(assets/test_av.mp4) |
| 62 | |
| 63 | { |
| 64 | |
| 65 | |
| 66 | |
| 67 | |
| 68 | } | |
| 69 | |
| 70 | |
| 71 | # One metric, one process, one row -- even when the process dies. |
| 72 | |
| 73 | |
| 74 | |
| 75 | |
| 76 | |
| 77 | |
| 78 | |
| 79 | |
| 80 | |
| 81 | |
| 82 | |
| 83 | |
| 84 | |
| 85 | |
| 86 | |
| 87 | |
| 88 | export_cap= |
| 89 | export_limit= |
| 90 | |
| 91 | for; do |
| 92 | if [; then |
| 93 | |
| 94 | continue |
| 95 | fi |
| 96 | |
| 97 | for; do |
| 98 | |
| 99 | done |
| 100 | |
| 101 | for; do |
| 102 | |
| 103 | done |
| 104 | done |
| 105 | |
| 106 | | |
| 107 |