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
56
57
58
//! Port of `src/nvim/profile.c` (not vendored under `vendor/`; the names appear as
//! calls in the vendored eval tree, so the drift gate recognizes them).
//!
//! Profiling time helpers backing `reltime()`/`reltimestr()`/`reltimefloat()`.
//! `proftime_T` is `uint64_t` nanoseconds (`Src/types_defs.h:44`).
use crateos_hrtime;
/// Port of `proftime_T` from `Src/types_defs.h:44` (`typedef uint64_t proftime_T;`).
pub type proftime_T = u64;
/// Port of `profile_start()` from `Src/profile.c:53`.
///
/// "Gets the current time." Returns the monotonic clock value.
/// Port of `profile_end()` from `Src/profile.c:61`.
///
/// "Computes the time elapsed." Difference between now and `tm`.
/// Port of `profile_sub()` from `Src/profile.c:147`.
///
/// "Subtracts `tm2` from `tm1`." Unsigned wraparound is intentional (see
/// `profile_signed`).
/// Port of `profile_signed()` from `Src/profile.c:203`.
///
/// Returns the signed difference after unsigned wraparound. `(tm > INT64_MAX)`
/// is >=150 years, so it must have come from differencing two `proftime_T`
/// values; recover the negative magnitude (#10452).
/// Port of `profile_msg()` from `Src/profile.c:72`.
///
/// Formats `tm` as a string of the seconds, `%10.6lf`.