add FOLLY_SANITIZE macro
[folly.git] / folly / stats / Histogram.cpp
1 /*
2  * Copyright 2017 Facebook, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *   http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 /*
18  * This file contains explicit instantiations of stats template types.
19  *
20  * This allows most users to avoid having to include the template definition
21  * header files.
22  */
23
24 #include <folly/stats/Histogram.h>
25 #include <folly/stats/Histogram-defs.h>
26
27 #if !FOLLY_MSVC_USE_WORKAROUND_FOR_C5037
28 namespace folly {
29
30 template class Histogram<int64_t>;
31 template class detail::HistogramBuckets<int64_t, Histogram<int64_t>::Bucket>;
32
33 // Histogram::getPercentileBucketIdx(), Histogram::getPercentileEstimate()
34 // and Histogram::computeTotalCount()
35 // are implemented using template methods.  Instantiate the default versions of
36 // these methods too, so anyone using them won't also need to explicitly
37 // include Histogram-defs.h
38 template size_t detail::HistogramBuckets<int64_t, Histogram<int64_t>::Bucket>::
39     getPercentileBucketIdx<Histogram<int64_t>::CountFromBucket>(
40         double pct,
41         Histogram<int64_t>::CountFromBucket countFromBucket,
42         double* lowPct,
43         double* highPct) const;
44 template int64_t detail::HistogramBuckets<int64_t, Histogram<int64_t>::Bucket>::
45     getPercentileEstimate<
46         Histogram<int64_t>::CountFromBucket,
47         Histogram<int64_t>::AvgFromBucket>(
48         double pct,
49         Histogram<int64_t>::CountFromBucket countFromBucket,
50         Histogram<int64_t>::AvgFromBucket avgFromBucket) const;
51 template uint64_t
52 detail::HistogramBuckets<int64_t, Histogram<int64_t>::Bucket>::
53     computeTotalCount<Histogram<int64_t>::CountFromBucket>(
54         Histogram<int64_t>::CountFromBucket countFromBucket) const;
55
56 } // namespace folly
57 #endif