-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
seer:dist_timing/2 and seer:histo_timing/2 both use os:timestamp/0 to get the current time. The result of os:timestamp/0 is not monotonic, and should not be used for measuring latencies.
A better solution would be to use erlang:monotonic_time/0, but this is not backwards-compatible. If we want to preserve backward compatibility, then the value returned by erlang:monotonic_time/0 or erlang:monotonic_time/1 should be converted to a {MegaSecs, Secs, MicroSecs} value like os:timestamp/0 or erlang:timestamp/0. This can be done with:
Now = erlang:monotonic_time(microsecond) + erlang:time_offset(microsecond),
Micros = Now,
Secs = Now div 1_000_000,
Megas = Secs div 1_000_000,
{Megas, Secs rem 1_000_000, Micros rem 1_000_000}.If we're comfortable breaking backwards compatibility, then we ought to switch to erlang:monotonic_time/0 and erlang:convert_time_unit/3.
Metadata
Metadata
Assignees
Labels
No labels