Fix MultiLevelTimeseries::getRate()
authorDrew Hoskins <dhoskins@fb.com>
Thu, 11 Feb 2016 23:53:21 +0000 (15:53 -0800)
committerfacebook-github-bot-4 <folly-bot@fb.com>
Fri, 12 Feb 2016 00:20:29 +0000 (16:20 -0800)
commit1a7befdb10222e71db9da527ba13cbc8e236784b
treef4b35b44d9e5917271b42286a7d21105202345dc
parent116d93dbbcdc52b7d4d8bdc6b6652d23cb61b23b
Fix MultiLevelTimeseries::getRate()

Summary:I hit a landmine where rate() returned 0 for my tests where fewer than 60 items were added per minute.  This was because it was truncating it.  And yet, countRate() was working.
It doesn't make sense for a rate (value accumulated per time period) to be integral.
Folly: I changed rate() to return a double by default for folly, as was done by avg() and countRate().  Looked like a typo to me.
Common wrapper: I changed getRate() to allow you to override and make it double, as was done by getAvg().  Defaulting to int (which is usually the value type) is a bad call IMO but it's a riskier change to change it to double, and I want to be consistent with getAvg().

Reviewed By: tracelog

Differential Revision: D2921061

fb-gh-sync-id: 00875f2ab7963ef3ba2db475aedaf6ebd413b38f
shipit-source-id: 00875f2ab7963ef3ba2db475aedaf6ebd413b38f
folly/stats/MultiLevelTimeSeries.h
folly/test/TimeseriesTest.cpp