From d8ed7cbc7118c84655fb51da6d1c0f32701dc763 Mon Sep 17 00:00:00 2001 From: Christopher Dykes Date: Fri, 9 Jun 2017 19:48:51 -0700 Subject: [PATCH] Reorganize the stats directory Summary: The source and tests for the stats directory was spread across folly/detail and folly/test, move them into folly/stats directly instead. Reviewed By: yfeldblum Differential Revision: D5216810 fbshipit-source-id: 00a8bb95a4f7830d0bc46b3f914f256a37833b78 --- folly/Makefile.am | 9 +++++--- folly/stats/BucketedTimeSeries.cpp | 22 +++++++++++++++++++ folly/stats/BucketedTimeSeries.h | 2 +- .../{Instantiations.cpp => Histogram.cpp} | 12 ---------- folly/stats/Histogram.h | 2 +- folly/stats/MultiLevelTimeSeries.cpp | 22 +++++++++++++++++++ folly/stats/TimeseriesHistogram.cpp | 22 +++++++++++++++++++ .../{detail/Stats.h => stats/detail/Bucket.h} | 0 .../test/BucketedTimeSeriesBenchmark.cpp} | 0 folly/{ => stats}/test/HistogramBenchmark.cpp | 0 folly/{ => stats}/test/HistogramTest.cpp | 0 folly/stats/test/Makefile.am | 12 ++++++++++ .../test/TimeSeriesTest.cpp} | 2 +- .../test/TimeseriesHistogramTest.cpp | 0 folly/test/Makefile.am | 4 ---- 15 files changed, 87 insertions(+), 22 deletions(-) create mode 100644 folly/stats/BucketedTimeSeries.cpp rename folly/stats/{Instantiations.cpp => Histogram.cpp} (83%) create mode 100644 folly/stats/MultiLevelTimeSeries.cpp create mode 100644 folly/stats/TimeseriesHistogram.cpp rename folly/{detail/Stats.h => stats/detail/Bucket.h} (100%) rename folly/{test/TimeseriesBenchmark.cpp => stats/test/BucketedTimeSeriesBenchmark.cpp} (100%) rename folly/{ => stats}/test/HistogramBenchmark.cpp (100%) rename folly/{ => stats}/test/HistogramTest.cpp (100%) create mode 100755 folly/stats/test/Makefile.am rename folly/{test/TimeseriesTest.cpp => stats/test/TimeSeriesTest.cpp} (99%) rename folly/{ => stats}/test/TimeseriesHistogramTest.cpp (100%) diff --git a/folly/Makefile.am b/folly/Makefile.am index 0b1a10d7..435b93a9 100644 --- a/folly/Makefile.am +++ b/folly/Makefile.am @@ -7,7 +7,7 @@ MAYBE_EXCEPTION_TRACER = experimental/exception_tracer endif SUBDIRS = . experimental $(MAYBE_INIT) test io/test experimental/io/test \ - $(MAYBE_EXCEPTION_TRACER) + stats/test $(MAYBE_EXCEPTION_TRACER) ACLOCAL_AMFLAGS = -I m4 @@ -82,7 +82,6 @@ nobase_follyinclude_HEADERS = \ detail/SlowFingerprint.h \ detail/SocketFastOpen.h \ detail/StaticSingletonManager.h \ - detail/Stats.h \ detail/ThreadLocalDetail.h \ detail/TryDetail.h \ detail/TurnSequencer.h \ @@ -367,6 +366,7 @@ nobase_follyinclude_HEADERS = \ ssl/OpenSSLVersionFinder.h \ ssl/SSLSession.h \ ssl/detail/SSLSessionImpl.h \ + stats/detail/Bucket.h \ stats/BucketedTimeSeries-defs.h \ stats/BucketedTimeSeries.h \ stats/Histogram-defs.h \ @@ -534,7 +534,10 @@ libfolly_la_SOURCES = \ ssl/OpenSSLCertUtils.cpp \ ssl/OpenSSLHash.cpp \ ssl/detail/SSLSessionImpl.cpp \ - stats/Instantiations.cpp \ + stats/BucketedTimeSeries.cpp \ + stats/Histogram.cpp \ + stats/MultiLevelTimeSeries.cpp \ + stats/TimeseriesHistogram.cpp \ Subprocess.cpp \ ThreadCachedArena.cpp \ ThreadName.cpp \ diff --git a/folly/stats/BucketedTimeSeries.cpp b/folly/stats/BucketedTimeSeries.cpp new file mode 100644 index 00000000..7eaf46e8 --- /dev/null +++ b/folly/stats/BucketedTimeSeries.cpp @@ -0,0 +1,22 @@ +/* + * Copyright 2017 Facebook, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +namespace folly { +template class BucketedTimeSeries; +} diff --git a/folly/stats/BucketedTimeSeries.h b/folly/stats/BucketedTimeSeries.h index a31904da..73ec9e70 100644 --- a/folly/stats/BucketedTimeSeries.h +++ b/folly/stats/BucketedTimeSeries.h @@ -19,7 +19,7 @@ #include #include -#include +#include namespace folly { diff --git a/folly/stats/Instantiations.cpp b/folly/stats/Histogram.cpp similarity index 83% rename from folly/stats/Instantiations.cpp rename to folly/stats/Histogram.cpp index 20b4c2f1..5a24f1ea 100644 --- a/folly/stats/Instantiations.cpp +++ b/folly/stats/Histogram.cpp @@ -21,25 +21,13 @@ * header files. */ -#include -#include - #include #include -#include -#include - -#include -#include - namespace folly { -template class BucketedTimeSeries; template class Histogram; template class detail::HistogramBuckets::Bucket>; -template class MultiLevelTimeSeries; -template class TimeseriesHistogram; // Histogram::getPercentileBucketIdx(), Histogram::getPercentileEstimate() // and Histogram::computeTotalCount() diff --git a/folly/stats/Histogram.h b/folly/stats/Histogram.h index ca45ba3b..effeceaa 100644 --- a/folly/stats/Histogram.h +++ b/folly/stats/Histogram.h @@ -25,7 +25,7 @@ #include #include -#include +#include namespace folly { diff --git a/folly/stats/MultiLevelTimeSeries.cpp b/folly/stats/MultiLevelTimeSeries.cpp new file mode 100644 index 00000000..404a4d1e --- /dev/null +++ b/folly/stats/MultiLevelTimeSeries.cpp @@ -0,0 +1,22 @@ +/* + * Copyright 2017 Facebook, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +namespace folly { +template class MultiLevelTimeSeries; +} diff --git a/folly/stats/TimeseriesHistogram.cpp b/folly/stats/TimeseriesHistogram.cpp new file mode 100644 index 00000000..22c972fb --- /dev/null +++ b/folly/stats/TimeseriesHistogram.cpp @@ -0,0 +1,22 @@ +/* + * Copyright 2017 Facebook, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +namespace folly { +template class TimeseriesHistogram; +} diff --git a/folly/detail/Stats.h b/folly/stats/detail/Bucket.h similarity index 100% rename from folly/detail/Stats.h rename to folly/stats/detail/Bucket.h diff --git a/folly/test/TimeseriesBenchmark.cpp b/folly/stats/test/BucketedTimeSeriesBenchmark.cpp similarity index 100% rename from folly/test/TimeseriesBenchmark.cpp rename to folly/stats/test/BucketedTimeSeriesBenchmark.cpp diff --git a/folly/test/HistogramBenchmark.cpp b/folly/stats/test/HistogramBenchmark.cpp similarity index 100% rename from folly/test/HistogramBenchmark.cpp rename to folly/stats/test/HistogramBenchmark.cpp diff --git a/folly/test/HistogramTest.cpp b/folly/stats/test/HistogramTest.cpp similarity index 100% rename from folly/test/HistogramTest.cpp rename to folly/stats/test/HistogramTest.cpp diff --git a/folly/stats/test/Makefile.am b/folly/stats/test/Makefile.am new file mode 100755 index 00000000..f6f47150 --- /dev/null +++ b/folly/stats/test/Makefile.am @@ -0,0 +1,12 @@ +ACLOCAL_AMFLAGS = -I m4 + +CPPFLAGS = -I$(top_srcdir)/test/gtest/googletest/include +ldadd = $(top_builddir)/test/libfollytestmain.la + +check_PROGRAMS = \ + histogram_test + +TESTS = $(check_PROGRAMS) + +histogram_test_SOURCES = HistogramTest.cpp +histogram_test_LDADD = $(ldadd) diff --git a/folly/test/TimeseriesTest.cpp b/folly/stats/test/TimeSeriesTest.cpp similarity index 99% rename from folly/test/TimeseriesTest.cpp rename to folly/stats/test/TimeSeriesTest.cpp index 02e86594..64928fe3 100644 --- a/folly/test/TimeseriesTest.cpp +++ b/folly/stats/test/TimeSeriesTest.cpp @@ -14,11 +14,11 @@ * limitations under the License. */ -#include #include #include #include #include +#include #include diff --git a/folly/test/TimeseriesHistogramTest.cpp b/folly/stats/test/TimeseriesHistogramTest.cpp similarity index 100% rename from folly/test/TimeseriesHistogramTest.cpp rename to folly/stats/test/TimeseriesHistogramTest.cpp diff --git a/folly/test/Makefile.am b/folly/test/Makefile.am index 1399315f..7494920d 100644 --- a/folly/test/Makefile.am +++ b/folly/test/Makefile.am @@ -176,10 +176,6 @@ conv_benchmark_SOURCES = ConvBenchmark.cpp conv_benchmark_LDADD = libfollytestmain.la $(top_builddir)/libfollybenchmark.la check_PROGRAMS += conv_benchmark -histogram_test_SOURCES = HistogramTest.cpp -histogram_test_LDADD = libfollytestmain.la -TESTS += histogram_test - group_varint_test_SOURCES = GroupVarintTest.cpp group_varint_test_LDADD = libfollytestmain.la TESTS += group_varint_test -- 2.34.1