Coverage / crates/oxy-core/src/timing.rs 68.0%
51 of 75 lines run, 21 of 30 functions · run #379 on main · run missed
| 1 | //! Opt-in phase timings (`OXY_TIMINGS=1`): each named phase prints its | |
| 2 | //! duration to stderr, for measuring where a command spends its time | |
| 3 | //! without a profiler. With the counting allocator installed (the `oxy` | |
| 4 | //! binary's `alloc-stats` feature), each also prints live and peak memory | |
| 5 | //! and what the phase allocated. | |
| 6 | | |
| 7 | use OnceLock; | |
| 8 | use Instant; | |
| 9 | ||
| 10 | 151741× | |
| 11 | | |
| 12 | 151741× | |
| 13 | 151741× | |
| 14 | ||
| 15 | /// Report a duration measured by hand (several intervals summed), if timings are on. | |
| 16 | 11676× | |
| 17 | 11676× | |
| 18 | 6× | |
| 19 | 11670× | |
| 20 | 11676× | |
| 21 | ||
| 22 | /// Prints `timing <name> <ms>` when dropped, if timings are on. | |
| 23 | | |
| 24 | | |
| 25 | | |
| 26 | | |
| 27 | | |
| 28 | | |
| 29 | ||
| 30 | /// Start timing a phase; the guard reports when it goes out of scope. | |
| 31 | 100644× | |
| 32 | 100644× | |
| 33 | | |
| 34 | 100644× | |
| 35 | 100644× | |
| 36 | 100644× | |
| 37 | 82× | |
| 38 | | |
| 39 | 100562× | |
| 40 | | |
| 41 | | |
| 42 | 100644× | |
| 43 | ||
| 44 | 0× | |
| 45 | 0× | |
| 46 | 0× | |
| 47 | ||
| 48 | /// The allocator's counters as one line, when counting: for the end of a | |
| 49 | /// command. | |
| 50 | 150× | |
| 51 | 150× | |
| 52 | 0× | |
| 53 | 0× | |
| 54 | 0× | |
| 55 | 0× | |
| 56 | 0× | |
| 57 | 0× | |
| 58 | 0× | |
| 59 | 150× | |
| 60 | 150× | |
| 61 | ||
| 62 | | |
| 63 | 100642× | |
| 64 | 100642× | |
| 65 | 82× | |
| 66 | 82× | |
| 67 | 0× | |
| 68 | | |
| 69 | | |
| 70 | | |
| 71 | 0× | |
| 72 | 0× | |
| 73 | 0× | |
| 74 | 0× | |
| 75 | | |
| 76 | 82× | |
| 77 | | |
| 78 | 100560× | |
| 79 | 100642× | |
| 80 | | |
| 81 | ||
| 82 | static TOTALS: Mutex = | |
| 83 | new; | |
| 84 | ||
| 85 | /// Add `d` to the running total for `name`, for a phase repeated many | |
| 86 | /// times (once per imported commit, say); `report_totals` prints them. | |
| 87 | 494× | |
| 88 | 494× | |
| 89 | 482× | |
| 90 | 12× | |
| 91 | 12× | |
| 92 | 30× | |
| 93 | 0× | |
| 94 | 12× | |
| 95 | | |
| 96 | 494× | |
| 97 | ||
| 98 | /// Print and clear the totals `add` gathered. | |
| 99 | 579× | |
| 100 | 579× | |
| 101 | 579× | |
| 102 | 0× | |
| 103 | 0× | |
| 104 | 0× | |
| 105 | 0× | |
| 106 | 0× | |
| 107 | 579× | |
| 108 | ||
| 109 | /// Times from one point to the next, adding each interval to a total. | |
| 110 | ; | |
| 111 | ||
| 112 | | |
| 113 | 3141× | |
| 114 | 3141× | |
| 115 | 3141× | |
| 116 | | |
| 117 | 14636× | |
| 118 | 14636× | |
| 119 | 12× | |
| 120 | 12× | |
| 121 | 12× | |
| 122 | 14624× | |
| 123 | 14636× | |
| 124 | |