a simple first step towards using clocks properly in the stats code
authorAdam Simpkins <simpkins@fb.com>
Thu, 15 Sep 2016 18:02:47 +0000 (11:02 -0700)
committerFacebook Github Bot 9 <facebook-github-bot-9-bot@fb.com>
Thu, 15 Sep 2016 18:08:27 +0000 (11:08 -0700)
commit8b030a19052a279d33c162a59a205dd62a724c67
tree603d3a0c7b006b96658bb79607854452e20b6a9b
parent9637519ede462c78b28ca7d2866429bba57a2996
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
folly/stats/BucketedTimeSeries-defs.h
folly/stats/BucketedTimeSeries.h
folly/stats/MultiLevelTimeSeries-defs.h
folly/stats/MultiLevelTimeSeries.h
folly/stats/TimeseriesHistogram-defs.h
folly/stats/TimeseriesHistogram.h