-
Notifications
You must be signed in to change notification settings - Fork 202
Open
Description
Is your feature request related to a problem? Please describe.
minstant is drop-in replacement for std::time::Instant that measures time with high performance and high accuracy powered by TSC.
Describe the solution you'd like
Add a cargo feature "minstant" to
Lines 17 to 22 in f49c724
| [features] | |
| default = ["protobuf"] | |
| gen = ["protobuf-codegen-pure"] | |
| nightly = ["libc"] | |
| process = ["libc", "procfs"] | |
| push = ["reqwest", "libc", "protobuf"] |
Describe alternatives you've considered
Additional context
In my project, I am using the Histogram module and noticed that it relies on std::time::Instant for time measurement:
rust-prometheus/src/histogram.rs
Lines 517 to 523 in f49c724
| pub fn elapsed(&self) -> Duration { | |
| match self { | |
| // We use `saturating_duration_since` to avoid panics caused by non-monotonic clocks. | |
| Instant::Monotonic(i) => StdInstant::now().saturating_duration_since(*i), | |
| // It is different from `Instant::Monotonic`, the resolution here is millisecond. |
Adding the optional minstant feature to rust-prometheus would be beneficial.
Metadata
Metadata
Assignees
Labels
No labels