edith
Clone
https://git.tahinli.com/Tahinli/edith.git
0 watching0 forksRust18.3 MiBff99ad6Tahinli6 days ago1055 commits
| 1 | //! What one open of a video file costs -- wall time and bytes read through the |
| 2 | //! read syscalls (`/proc/self/io`'s `rchar`) -- and what it answers: the frame |
| 3 | //! count, and where a seek to a given second lands. |
| 4 | //! |
| 5 | //! `cargo run --release -p engine --example mkv_open_cost -- <file> [secs ...] [all]` |
| 6 | //! |
| 7 | //! The point of the byte count: a Matroska open that walks every cluster reads |
| 8 | //! the whole segment's element headers, which on a multi-gigabyte film is |
| 9 | //! hundreds of megabytes of `pread` and seconds of wall clock. One that reads |
| 10 | //! the header, the `SeekHead` and the `Cues` reads kilobytes. Same tool on both |
| 11 | //! builds, so the two are comparable line for line. |
| 12 | //! |
| 13 | //! `all` walks every access unit of the file and prints a rolling hash of their |
| 14 | //! bytes with the count: two builds that disagree by one block anywhere disagree |
| 15 | //! on that number, which is what makes "the lazy index is the same index" a |
| 16 | //! check rather than a claim. The per-second lines do the same for a seek -- |
| 17 | //! landing index and the hash of the access unit handed back there. |
| 18 | |
| 19 | use PathBuf; |
| 20 | use Instant; |
| 21 | |
| 22 | /// Bytes this process has read through `read`/`pread` so far, page cache or |
| 23 | /// disk -- what the walk really costs the kernel, independent of what was warm. |
| 24 | |
| 25 | |
| 26 | |
| 27 | |
| 28 | |
| 29 | |
| 30 | |
| 31 | |
| 32 | |
| 33 | |
| 34 | /// FNV-1a over the bytes, so a run of access units collapses to one number a |
| 35 | /// diff can compare. |
| 36 | |
| 37 | |
| 38 | |
| 39 | |
| 40 | |
| 41 | |
| 42 | |
| 43 | |
| 44 | |
| 45 | |
| 46 | |
| 47 | |
| 48 | |
| 49 | |
| 50 | |
| 51 | |
| 52 | |
| 53 | |
| 54 | |
| 55 | |
| 56 | |
| 57 | |
| 58 | |
| 59 | |
| 60 | |
| 61 | |
| 62 | |
| 63 | |
| 64 | |
| 65 | |
| 66 | |
| 67 | |
| 68 | |
| 69 | |
| 70 | |
| 71 | |
| 72 | |
| 73 | |
| 74 | |
| 75 | |
| 76 | |
| 77 | |
| 78 | |
| 79 | |
| 80 | |
| 81 | |
| 82 | |
| 83 | |
| 84 | |
| 85 | |
| 86 | |
| 87 | |
| 88 | |
| 89 | |
| 90 | |
| 91 | |
| 92 | |
| 93 | |
| 94 | |
| 95 | |
| 96 | |
| 97 | |
| 98 | |
| 99 | |
| 100 | |
| 101 |