a simple first step towards using clocks properly in the stats code
Summary:
Update the timeseries and histogram classes to accept a clock parameter as a
template parameter, instead of a time duration type.
This is a first step towards transitioning the code to correctly distinguishing
between time_point and duration types. This defines TimePoint and Duration
type aliases, but does not start using them yet.
In upcoming diffs I will start converting more APIs to correctly use TimePoint
instead of just Duration.
For now the default clock type is folly::LegacyStatsClock, which still uses
std::chrono::seconds as the default duration. At the moment the stats code is
optimized for second granularity--the addValue() code has a fast path when
called in the same second as the last update. When using finer granularity
durations this fast path can't be used as often. I will also send out
subsequent diffs to make the code optimized for updates within the same bucket,
rather than just updates with the exact same time value.
Reviewed By: yfeldblum
Differential Revision:
D3807715
fbshipit-source-id:
77696c4f44a8d85e4d6ff84d7656fe7a9709797c