edith_codecs
Clone
https://git.tahinli.com/Tahinli/edith_codecs.git
0 watching0 forksRust370.3 MiB9b67700Tahinli3 days ago4021 commits
| 1 | //! lane-timeline: `EC_AV1_TIMELINE=1` frame-granularity decode timeline. |
| 2 | //! |
| 3 | //! The threaded decoder (`stream.rs`) is bounded by *something* -- reference |
| 4 | //! latency, the dispatcher's in-flight cap, the filter tail or the output |
| 5 | //! path -- and no instrument could tell which: `EC_AV1_WAVE_STATS` counts |
| 6 | //! superblocks, `perf` counts instructions, neither sees the dependency |
| 7 | //! graph. This records ~10 timestamps per coded frame (submit, worker start, |
| 8 | //! reference waits, parse, recon, filters, slot publish, grain, output) on |
| 9 | //! one monotonic clock and dumps them as TSV at stream end; |
| 10 | //! `scripts/av1-timeline-report.py` reads that and walks the critical path. |
| 11 | //! |
| 12 | //! Cost when off: one relaxed atomic load ([`env_flag!`]'s `LazyLock<bool>`) |
| 13 | //! per event, at frame granularity -- ~10 loads per frame, nothing per block. |
| 14 | |
| 15 | use Mutex; |
| 16 | use Instant; |
| 17 | |
| 18 | /// Process start, the zero of every timestamp below. |
| 19 | static START: LazyLock = new; |
| 20 | |
| 21 | /// `EC_AV1_TIMELINE` -- one atomic load per call site after the first. |
| 22 | pub |
| 23 | |
| 24 | |
| 25 | |
| 26 | |
| 27 | |
| 28 | |
| 29 | |
| 30 | /// One coded frame's timestamps, in microseconds since [`START`]; 0 = never |
| 31 | /// reached (a key frame decodes inline, so it has no submit/start/publish). |
| 32 | |
| 33 | |
| 34 | |
| 35 | |
| 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 | static LOG: = new; |
| 65 | |
| 66 | |
| 67 | |
| 68 | |
| 69 | |
| 70 | |
| 71 | |
| 72 | |
| 73 | |
| 74 | |
| 75 | |
| 76 | |
| 77 | |
| 78 | |
| 79 | |
| 80 | |
| 81 | |
| 82 | // The frame this thread is decoding, so `decode.rs`'s phase marks need no |
| 83 | // new parameter threaded through the tile decoders. |
| 84 | thread_local! |
| 85 | |
| 86 | |
| 87 | |
| 88 | /// Dispatch (parsing thread), before the job is queued. |
| 89 | |
| 90 | pub |
| 91 | |
| 92 | |
| 93 | |
| 94 | |
| 95 | |
| 96 | |
| 97 | |
| 98 | |
| 99 | |
| 100 | |
| 101 | |
| 102 | /// A worker picked the job up. Also binds this thread to `idx`. |
| 103 | |
| 104 | pub |
| 105 | |
| 106 | |
| 107 | |
| 108 | |
| 109 | |
| 110 | |
| 111 | |
| 112 | |
| 113 | /// Binds a thread to `idx` without a start timestamp (the inline key-frame |
| 114 | /// path, which is dispatched by nobody). |
| 115 | |
| 116 | pub |
| 117 | |
| 118 | |
| 119 | |
| 120 | |
| 121 | |
| 122 | |
| 123 | |
| 124 | |
| 125 | |
| 126 | |
| 127 | /// One resolved `SlotPromise::wait`, with the slot and how long it blocked. |
| 128 | |
| 129 | pub |
| 130 | |
| 131 | |
| 132 | |
| 133 | |
| 134 | |
| 135 | |
| 136 | |
| 137 | |
| 138 | |
| 139 | |
| 140 | |
| 141 | |
| 142 | |
| 143 | |
| 144 | |
| 145 | |
| 146 | |
| 147 | |
| 148 | |
| 149 | |
| 150 | |
| 151 | |
| 152 | |
| 153 | |
| 154 | |
| 155 | |
| 156 | |
| 157 | |
| 158 | |
| 159 | |
| 160 | stamp!; |
| 161 | stamp!; |
| 162 | stamp!; |
| 163 | stamp!; |
| 164 | stamp!; |
| 165 | stamp!; |
| 166 | stamp!; |
| 167 | |
| 168 | /// The picture reached the sink. Only a frame that finished on a worker |
| 169 | /// (`grain_done`) and has not been emitted yet takes the stamp -- a |
| 170 | /// `show_existing_frame` re-output reports a decode index that is not its |
| 171 | /// own, and must not overwrite another frame's row. |
| 172 | |
| 173 | pub |
| 174 | |
| 175 | |
| 176 | |
| 177 | |
| 178 | |
| 179 | |
| 180 | |
| 181 | |
| 182 | |
| 183 | |
| 184 | |
| 185 | |
| 186 | |
| 187 | |
| 188 | |
| 189 | |
| 190 | /// The parsing thread blocked at the in-flight bound. |
| 191 | |
| 192 | pub |
| 193 | |
| 194 | |
| 195 | |
| 196 | |
| 197 | |
| 198 | |
| 199 | /// `now_us` for the two call sites that need a begin timestamp of their own. |
| 200 | pub |
| 201 | |
| 202 | |
| 203 | |
| 204 | |
| 205 | |
| 206 | |
| 207 | /// Writes every row to stderr as TSV and clears the log. |
| 208 | |
| 209 | pub |
| 210 | |
| 211 | |
| 212 | |
| 213 | |
| 214 | |
| 215 | |
| 216 | |
| 217 | |
| 218 | |
| 219 | |
| 220 | |
| 221 | |
| 222 | |
| 223 | |
| 224 | |
| 225 | |
| 226 | |
| 227 | |
| 228 | |
| 229 | |
| 230 | |
| 231 | |
| 232 | |
| 233 | |
| 234 | |
| 235 | |
| 236 | |
| 237 | |
| 238 | |
| 239 | |
| 240 | |
| 241 | |
| 242 | |
| 243 | |
| 244 | |
| 245 | |
| 246 | |
| 247 | |
| 248 | |
| 249 | |
| 250 |