1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
//! `Instant` on native, a zero clock on wasm.
//!
//! `std::time::Instant::now()` **panics** on `wasm32-unknown-unknown`: the
//! target has no clock behind it. Argus calls it 51 times across `decode`,
//! `engine`, `siglip` and `text`, and they sit inside the forward pass rather
//! than behind a profiling flag — so in a browser they are a crash on the
//! first tile, not a slow path.
//!
//! This is a drop-in for `std::time::Instant`: same `now()` / `elapsed()`
//! surface, so a call site changes its IMPORT and nothing else. On native it
//! is a newtype that inlines away and behaviour is byte-identical; on wasm
//! `elapsed()` is always `Duration::ZERO`.
//!
//! A `cfg` rather than a feature: this is a property of the target, not a
//! choice a consumer should be able to get wrong.
//!
//! **Zero is a safe reading for every consumer here, and that was checked
//! rather than assumed.** Every Argus site feeds a REPORT — per-stage and
//! per-token millisecond tables printed behind `FFAI_ARGUS_PROFILE` — so on
//! wasm the tables read all-zero rather than lying about a number the target
//! cannot take. No control flow branches on these durations.
use Duration;
/// A monotonic instant, or nothing at all on a target without a clock.