Commit 3daa8962 authored by Igor Sugak's avatar Igor Sugak Committed by Facebook Github Bot

fix -Wextra-semi exposed by the latest clang

Summary: `-Wextra-semi` became more strict. This fixes folly build with the latest clang.

Reviewed By: yfeldblum

Differential Revision: D7359992

fbshipit-source-id: ce7caf05aa536f35e9af4ed33a86072afd09f387
parent dc45f4c0
...@@ -1404,4 +1404,4 @@ constexpr Range<wchar_t const*> operator"" _sp( ...@@ -1404,4 +1404,4 @@ constexpr Range<wchar_t const*> operator"" _sp(
FOLLY_POP_WARNING FOLLY_POP_WARNING
FOLLY_ASSUME_FBVECTOR_COMPATIBLE_1(folly::Range); FOLLY_ASSUME_FBVECTOR_COMPATIBLE_1(folly::Range)
...@@ -263,7 +263,7 @@ void stringPrintf(std::string* output, const char* format, ...) { ...@@ -263,7 +263,7 @@ void stringPrintf(std::string* output, const char* format, ...) {
void stringVPrintf(std::string* output, const char* format, va_list ap) { void stringVPrintf(std::string* output, const char* format, va_list ap) {
output->clear(); output->clear();
stringAppendfImpl(*output, format, ap); stringAppendfImpl(*output, format, ap);
}; }
namespace { namespace {
......
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
classname##__folly_traits_impl__<TTheClass_>::template test<TTheClass_>( \ classname##__folly_traits_impl__<TTheClass_>::template test<TTheClass_>( \
nullptr), \ nullptr), \
std::true_type, \ std::true_type, \
std::false_type>::type; std::false_type>::type
#define FOLLY_CREATE_HAS_MEMBER_FN_TRAITS_IMPL(classname, func_name, cv_qual) \ #define FOLLY_CREATE_HAS_MEMBER_FN_TRAITS_IMPL(classname, func_name, cv_qual) \
template <typename TTheClass_, typename RTheReturn_, typename... TTheArgs_> \ template <typename TTheClass_, typename RTheReturn_, typename... TTheArgs_> \
...@@ -300,11 +300,11 @@ namespace traits_detail { ...@@ -300,11 +300,11 @@ namespace traits_detail {
struct has_true_##name : std::conditional< \ struct has_true_##name : std::conditional< \
has_##name<T>::value, \ has_##name<T>::value, \
name##_is_true<T>, \ name##_is_true<T>, \
std::false_type>::type {}; std::false_type>::type {}
FOLLY_HAS_TRUE_XXX(IsRelocatable) FOLLY_HAS_TRUE_XXX(IsRelocatable);
FOLLY_HAS_TRUE_XXX(IsZeroInitializable) FOLLY_HAS_TRUE_XXX(IsZeroInitializable);
FOLLY_HAS_TRUE_XXX(IsTriviallyCopyable) FOLLY_HAS_TRUE_XXX(IsTriviallyCopyable);
#undef FOLLY_HAS_TRUE_XXX #undef FOLLY_HAS_TRUE_XXX
...@@ -465,7 +465,7 @@ struct StrictDisjunction ...@@ -465,7 +465,7 @@ struct StrictDisjunction
* FOLLY_ASSUME_RELOCATABLE(MyType<T1, T2>) * FOLLY_ASSUME_RELOCATABLE(MyType<T1, T2>)
*/ */
#define FOLLY_ASSUME_RELOCATABLE(...) \ #define FOLLY_ASSUME_RELOCATABLE(...) \
struct IsRelocatable< __VA_ARGS__ > : std::true_type {}; struct IsRelocatable<__VA_ARGS__> : std::true_type {}
/** /**
* The FOLLY_ASSUME_FBVECTOR_COMPATIBLE* macros below encode the * The FOLLY_ASSUME_FBVECTOR_COMPATIBLE* macros below encode the
...@@ -495,31 +495,31 @@ struct StrictDisjunction ...@@ -495,31 +495,31 @@ struct StrictDisjunction
#define FOLLY_ASSUME_FBVECTOR_COMPATIBLE(...) \ #define FOLLY_ASSUME_FBVECTOR_COMPATIBLE(...) \
namespace folly { \ namespace folly { \
template <> \ template <> \
FOLLY_ASSUME_RELOCATABLE(__VA_ARGS__) \ FOLLY_ASSUME_RELOCATABLE(__VA_ARGS__); \
} }
// Use this macro ONLY at global level (no namespace) // Use this macro ONLY at global level (no namespace)
#define FOLLY_ASSUME_FBVECTOR_COMPATIBLE_1(...) \ #define FOLLY_ASSUME_FBVECTOR_COMPATIBLE_1(...) \
namespace folly { \ namespace folly { \
template <class T1> \ template <class T1> \
FOLLY_ASSUME_RELOCATABLE(__VA_ARGS__<T1>) \ FOLLY_ASSUME_RELOCATABLE(__VA_ARGS__<T1>); \
} }
// Use this macro ONLY at global level (no namespace) // Use this macro ONLY at global level (no namespace)
#define FOLLY_ASSUME_FBVECTOR_COMPATIBLE_2(...) \ #define FOLLY_ASSUME_FBVECTOR_COMPATIBLE_2(...) \
namespace folly { \ namespace folly { \
template <class T1, class T2> \ template <class T1, class T2> \
FOLLY_ASSUME_RELOCATABLE(__VA_ARGS__<T1, T2>) \ FOLLY_ASSUME_RELOCATABLE(__VA_ARGS__<T1, T2>); \
} }
// Use this macro ONLY at global level (no namespace) // Use this macro ONLY at global level (no namespace)
#define FOLLY_ASSUME_FBVECTOR_COMPATIBLE_3(...) \ #define FOLLY_ASSUME_FBVECTOR_COMPATIBLE_3(...) \
namespace folly { \ namespace folly { \
template <class T1, class T2, class T3> \ template <class T1, class T2, class T3> \
FOLLY_ASSUME_RELOCATABLE(__VA_ARGS__<T1, T2, T3>) \ FOLLY_ASSUME_RELOCATABLE(__VA_ARGS__<T1, T2, T3>); \
} }
// Use this macro ONLY at global level (no namespace) // Use this macro ONLY at global level (no namespace)
#define FOLLY_ASSUME_FBVECTOR_COMPATIBLE_4(...) \ #define FOLLY_ASSUME_FBVECTOR_COMPATIBLE_4(...) \
namespace folly { \ namespace folly { \
template <class T1, class T2, class T3, class T4> \ template <class T1, class T2, class T3, class T4> \
FOLLY_ASSUME_RELOCATABLE(__VA_ARGS__<T1, T2, T3, T4>) \ FOLLY_ASSUME_RELOCATABLE(__VA_ARGS__<T1, T2, T3, T4>); \
} }
/** /**
......
...@@ -74,6 +74,6 @@ FOLLY_ALWAYS_INLINE FOLLY_ATTR_VISIBILITY_HIDDEN constexpr auto make_array_with( ...@@ -74,6 +74,6 @@ FOLLY_ALWAYS_INLINE FOLLY_ATTR_VISIBILITY_HIDDEN constexpr auto make_array_with(
template <std::size_t Size, typename MakeItem> template <std::size_t Size, typename MakeItem>
constexpr auto make_array_with(MakeItem const& make) { constexpr auto make_array_with(MakeItem const& make) {
return array_detail::make_array_with(make, make_index_sequence<Size>{}); return array_detail::make_array_with(make, make_index_sequence<Size>{});
}; }
} // namespace folly } // namespace folly
...@@ -93,7 +93,7 @@ TEST(Enumerate, Temporary) { ...@@ -93,7 +93,7 @@ TEST(Enumerate, Temporary) {
} }
EXPECT_EQ(i, v.size()); EXPECT_EQ(i, v.size());
}; }
TEST(Enumerate, BasicConstArg) { TEST(Enumerate, BasicConstArg) {
const std::vector<std::string> v = {"abc", "a", "ab"}; const std::vector<std::string> v = {"abc", "a", "ab"};
......
...@@ -127,9 +127,9 @@ is relocatable and has nothrow constructor. ...@@ -127,9 +127,9 @@ is relocatable and has nothrow constructor.
```Cpp ```Cpp
// at global level, i.e no namespace // at global level, i.e no namespace
// macro for regular type // macro for regular type
FOLLY_ASSUME_FBVECTOR_COMPATIBLE(MySimpleType); FOLLY_ASSUME_FBVECTOR_COMPATIBLE(MySimpleType)
// macro for types having 2 template parameters (MyParameterizedType) // macro for types having 2 template parameters (MyParameterizedType)
FOLLY_ASSUME_FBVECTOR_COMPATIBLE_2(MyParameterizedType); FOLLY_ASSUME_FBVECTOR_COMPATIBLE_2(MyParameterizedType)
``` ```
Similarly, Similarly,
......
...@@ -77,11 +77,11 @@ namespace exception_tracer { ...@@ -77,11 +77,11 @@ namespace exception_tracer {
get##NAME##Callbacks().registerCallback(callback); \ get##NAME##Callbacks().registerCallback(callback); \
} }
DECLARE_CALLBACK(CxaThrow); DECLARE_CALLBACK(CxaThrow)
DECLARE_CALLBACK(CxaBeginCatch); DECLARE_CALLBACK(CxaBeginCatch)
DECLARE_CALLBACK(CxaRethrow); DECLARE_CALLBACK(CxaRethrow)
DECLARE_CALLBACK(CxaEndCatch); DECLARE_CALLBACK(CxaEndCatch)
DECLARE_CALLBACK(RethrowException); DECLARE_CALLBACK(RethrowException)
} // namespace exception_tracer } // namespace exception_tracer
} // namespace folly } // namespace folly
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
using namespace folly; using namespace folly;
using std::make_shared; using std::make_shared;
XLOG_SET_CATEGORY_NAME("xlog_test.main_file"); XLOG_SET_CATEGORY_NAME("xlog_test.main_file")
// Note that the XLOG* macros always use the main LoggerDB singleton. // Note that the XLOG* macros always use the main LoggerDB singleton.
// There is no way to get them to use a test LoggerDB during unit tests. // There is no way to get them to use a test LoggerDB during unit tests.
......
...@@ -62,12 +62,12 @@ void benchmarkSet(size_t n, T) { ...@@ -62,12 +62,12 @@ void benchmarkSet(size_t n, T) {
folly::Bits<T>::test(reinterpret_cast<T *>(buffer.data()), 512)); folly::Bits<T>::test(reinterpret_cast<T *>(buffer.data()), 512));
} }
BENCHMARK_NAMED_PARAM(benchmarkSet, u16, uint16_t()); BENCHMARK_NAMED_PARAM(benchmarkSet, u16, uint16_t())
BENCHMARK_RELATIVE_NAMED_PARAM(benchmarkSet, i16, int16_t()); BENCHMARK_RELATIVE_NAMED_PARAM(benchmarkSet, i16, int16_t())
BENCHMARK_NAMED_PARAM(benchmarkSet, u32, uint32_t()); BENCHMARK_NAMED_PARAM(benchmarkSet, u32, uint32_t())
BENCHMARK_RELATIVE_NAMED_PARAM(benchmarkSet, i32, int32_t()); BENCHMARK_RELATIVE_NAMED_PARAM(benchmarkSet, i32, int32_t())
BENCHMARK_NAMED_PARAM(benchmarkSet, u64, uint64_t()); BENCHMARK_NAMED_PARAM(benchmarkSet, u64, uint64_t())
BENCHMARK_RELATIVE_NAMED_PARAM(benchmarkSet, i64, int64_t()); BENCHMARK_RELATIVE_NAMED_PARAM(benchmarkSet, i64, int64_t())
BENCHMARK_DRAW_LINE(); BENCHMARK_DRAW_LINE();
...@@ -85,12 +85,12 @@ void benchmarkGet(size_t n, T x) { ...@@ -85,12 +85,12 @@ void benchmarkGet(size_t n, T x) {
folly::doNotOptimizeAway(x); folly::doNotOptimizeAway(x);
} }
BENCHMARK_NAMED_PARAM(benchmarkGet, u16, uint16_t(0)); BENCHMARK_NAMED_PARAM(benchmarkGet, u16, uint16_t(0))
BENCHMARK_RELATIVE_NAMED_PARAM(benchmarkGet, i16, int16_t(0)); BENCHMARK_RELATIVE_NAMED_PARAM(benchmarkGet, i16, int16_t(0))
BENCHMARK_NAMED_PARAM(benchmarkGet, u32, uint32_t(0)); BENCHMARK_NAMED_PARAM(benchmarkGet, u32, uint32_t(0))
BENCHMARK_RELATIVE_NAMED_PARAM(benchmarkGet, i32, int32_t(0)); BENCHMARK_RELATIVE_NAMED_PARAM(benchmarkGet, i32, int32_t(0))
BENCHMARK_NAMED_PARAM(benchmarkGet, u64, uint64_t(0)); BENCHMARK_NAMED_PARAM(benchmarkGet, u64, uint64_t(0))
BENCHMARK_RELATIVE_NAMED_PARAM(benchmarkGet, i64, int64_t(0)); BENCHMARK_RELATIVE_NAMED_PARAM(benchmarkGet, i64, int64_t(0))
#if 0 #if 0
============================================================================ ============================================================================
......
...@@ -350,7 +350,7 @@ inline uint32_t hsieh_hash32_buf(const void* buf, size_t len) { ...@@ -350,7 +350,7 @@ inline uint32_t hsieh_hash32_buf(const void* buf, size_t len) {
hash += hash >> 6; hash += hash >> 6;
return hash; return hash;
}; }
#undef get16bits #undef get16bits
......
...@@ -75,12 +75,12 @@ void runTest(int iters, int numThreads) { ...@@ -75,12 +75,12 @@ void runTest(int iters, int numThreads) {
} }
} }
BENCHMARK_PARAM(runTest, 1); BENCHMARK_PARAM(runTest, 1)
BENCHMARK_PARAM(runTest, 2); BENCHMARK_PARAM(runTest, 2)
BENCHMARK_PARAM(runTest, 4); BENCHMARK_PARAM(runTest, 4)
BENCHMARK_PARAM(runTest, 8); BENCHMARK_PARAM(runTest, 8)
BENCHMARK_PARAM(runTest, 16); BENCHMARK_PARAM(runTest, 16)
BENCHMARK_PARAM(runTest, 32); BENCHMARK_PARAM(runTest, 32)
int main(int argc, char* argv[]) { int main(int argc, char* argv[]) {
gflags::ParseCommandLineFlags(&argc, &argv, true); gflags::ParseCommandLineFlags(&argc, &argv, true);
......
...@@ -73,32 +73,32 @@ void zeroCopyOff(unsigned /* unused */, size_t bufferSize) { ...@@ -73,32 +73,32 @@ void zeroCopyOff(unsigned /* unused */, size_t bufferSize) {
test.run(); test.run();
} }
BENCHMARK_PARAM(zeroCopyOn, 4096); BENCHMARK_PARAM(zeroCopyOn, 4096)
BENCHMARK_PARAM(zeroCopyOff, 4096); BENCHMARK_PARAM(zeroCopyOff, 4096)
BENCHMARK_DRAW_LINE(); BENCHMARK_DRAW_LINE();
BENCHMARK_PARAM(zeroCopyOn, 8192); BENCHMARK_PARAM(zeroCopyOn, 8192)
BENCHMARK_PARAM(zeroCopyOff, 8192); BENCHMARK_PARAM(zeroCopyOff, 8192)
BENCHMARK_DRAW_LINE(); BENCHMARK_DRAW_LINE();
BENCHMARK_PARAM(zeroCopyOn, 16384); BENCHMARK_PARAM(zeroCopyOn, 16384)
BENCHMARK_PARAM(zeroCopyOff, 16384); BENCHMARK_PARAM(zeroCopyOff, 16384)
BENCHMARK_DRAW_LINE(); BENCHMARK_DRAW_LINE();
BENCHMARK_PARAM(zeroCopyOn, 32768); BENCHMARK_PARAM(zeroCopyOn, 32768)
BENCHMARK_PARAM(zeroCopyOff, 32768); BENCHMARK_PARAM(zeroCopyOff, 32768)
BENCHMARK_DRAW_LINE(); BENCHMARK_DRAW_LINE();
BENCHMARK_PARAM(zeroCopyOn, 65536); BENCHMARK_PARAM(zeroCopyOn, 65536)
BENCHMARK_PARAM(zeroCopyOff, 65536); BENCHMARK_PARAM(zeroCopyOff, 65536)
BENCHMARK_DRAW_LINE(); BENCHMARK_DRAW_LINE();
BENCHMARK_PARAM(zeroCopyOn, 131072); BENCHMARK_PARAM(zeroCopyOn, 131072)
BENCHMARK_PARAM(zeroCopyOff, 131072); BENCHMARK_PARAM(zeroCopyOff, 131072)
BENCHMARK_DRAW_LINE(); BENCHMARK_DRAW_LINE();
BENCHMARK_PARAM(zeroCopyOn, 262144); BENCHMARK_PARAM(zeroCopyOn, 262144)
BENCHMARK_PARAM(zeroCopyOff, 262144); BENCHMARK_PARAM(zeroCopyOff, 262144)
BENCHMARK_DRAW_LINE(); BENCHMARK_DRAW_LINE();
BENCHMARK_PARAM(zeroCopyOn, 524288); BENCHMARK_PARAM(zeroCopyOn, 524288)
BENCHMARK_PARAM(zeroCopyOff, 524288); BENCHMARK_PARAM(zeroCopyOff, 524288)
BENCHMARK_DRAW_LINE(); BENCHMARK_DRAW_LINE();
BENCHMARK_PARAM(zeroCopyOn, 1048576); BENCHMARK_PARAM(zeroCopyOn, 1048576)
BENCHMARK_PARAM(zeroCopyOff, 1048576); BENCHMARK_PARAM(zeroCopyOff, 1048576)
BENCHMARK_DRAW_LINE(); BENCHMARK_DRAW_LINE();
DEFINE_bool(client, false, "client mode"); DEFINE_bool(client, false, "client mode");
......
...@@ -598,7 +598,7 @@ void testFreeFn(void* buffer, void* ptr) { ...@@ -598,7 +598,7 @@ void testFreeFn(void* buffer, void* ptr) {
if (freeCount) { if (freeCount) {
++(*freeCount); ++(*freeCount);
} }
}; }
TEST(IOBuf, Reserve) { TEST(IOBuf, Reserve) {
uint32_t fillSeed = 0x23456789; uint32_t fillSeed = 0x23456789;
......
...@@ -45,33 +45,33 @@ void addValue( ...@@ -45,33 +45,33 @@ void addValue(
} }
} }
BENCHMARK_NAMED_PARAM(addValue, AllTime_1perSec, seconds(0), 60, 1); BENCHMARK_NAMED_PARAM(addValue, AllTime_1perSec, seconds(0), 60, 1)
BENCHMARK_NAMED_PARAM(addValue, 3600x60_1perSec, seconds(3600), 60, 1); BENCHMARK_NAMED_PARAM(addValue, 3600x60_1perSec, seconds(3600), 60, 1)
BENCHMARK_NAMED_PARAM(addValue, 600x60_1perSec, seconds(600), 60, 1); BENCHMARK_NAMED_PARAM(addValue, 600x60_1perSec, seconds(600), 60, 1)
BENCHMARK_NAMED_PARAM(addValue, 60x60_1perSec, seconds(60), 60, 1); BENCHMARK_NAMED_PARAM(addValue, 60x60_1perSec, seconds(60), 60, 1)
BENCHMARK_NAMED_PARAM(addValue, 100x10_1perSec, seconds(100), 10, 1); BENCHMARK_NAMED_PARAM(addValue, 100x10_1perSec, seconds(100), 10, 1)
BENCHMARK_NAMED_PARAM(addValue, 71x5_1perSec, seconds(71), 5, 1); BENCHMARK_NAMED_PARAM(addValue, 71x5_1perSec, seconds(71), 5, 1)
BENCHMARK_NAMED_PARAM(addValue, 1x1_1perSec, seconds(1), 1, 1); BENCHMARK_NAMED_PARAM(addValue, 1x1_1perSec, seconds(1), 1, 1)
BENCHMARK_DRAW_LINE(); BENCHMARK_DRAW_LINE();
BENCHMARK_NAMED_PARAM(addValue, AllTime_10perSec, seconds(0), 60, 10); BENCHMARK_NAMED_PARAM(addValue, AllTime_10perSec, seconds(0), 60, 10)
BENCHMARK_NAMED_PARAM(addValue, 3600x60_10perSec, seconds(3600), 60, 10); BENCHMARK_NAMED_PARAM(addValue, 3600x60_10perSec, seconds(3600), 60, 10)
BENCHMARK_NAMED_PARAM(addValue, 600x60_10perSec, seconds(600), 60, 10); BENCHMARK_NAMED_PARAM(addValue, 600x60_10perSec, seconds(600), 60, 10)
BENCHMARK_NAMED_PARAM(addValue, 60x60_10perSec, seconds(60), 60, 10); BENCHMARK_NAMED_PARAM(addValue, 60x60_10perSec, seconds(60), 60, 10)
BENCHMARK_NAMED_PARAM(addValue, 100x10_10perSec, seconds(100), 10, 10); BENCHMARK_NAMED_PARAM(addValue, 100x10_10perSec, seconds(100), 10, 10)
BENCHMARK_NAMED_PARAM(addValue, 71x5_10perSec, seconds(71), 5, 10); BENCHMARK_NAMED_PARAM(addValue, 71x5_10perSec, seconds(71), 5, 10)
BENCHMARK_NAMED_PARAM(addValue, 1x1_10perSec, seconds(1), 1, 10); BENCHMARK_NAMED_PARAM(addValue, 1x1_10perSec, seconds(1), 1, 10)
BENCHMARK_DRAW_LINE(); BENCHMARK_DRAW_LINE();
BENCHMARK_NAMED_PARAM(addValue, AllTime_100perSec, seconds(0), 60, 100); BENCHMARK_NAMED_PARAM(addValue, AllTime_100perSec, seconds(0), 60, 100)
BENCHMARK_NAMED_PARAM(addValue, 3600x60_100perSec, seconds(3600), 60, 100); BENCHMARK_NAMED_PARAM(addValue, 3600x60_100perSec, seconds(3600), 60, 100)
BENCHMARK_NAMED_PARAM(addValue, 600x60_100perSec, seconds(600), 60, 100); BENCHMARK_NAMED_PARAM(addValue, 600x60_100perSec, seconds(600), 60, 100)
BENCHMARK_NAMED_PARAM(addValue, 60x60_100perSec, seconds(60), 60, 100); BENCHMARK_NAMED_PARAM(addValue, 60x60_100perSec, seconds(60), 60, 100)
BENCHMARK_NAMED_PARAM(addValue, 100x10_100perSec, seconds(100), 10, 100); BENCHMARK_NAMED_PARAM(addValue, 100x10_100perSec, seconds(100), 10, 100)
BENCHMARK_NAMED_PARAM(addValue, 71x5_100perSec, seconds(71), 5, 100); BENCHMARK_NAMED_PARAM(addValue, 71x5_100perSec, seconds(71), 5, 100)
BENCHMARK_NAMED_PARAM(addValue, 1x1_100perSec, seconds(1), 1, 100); BENCHMARK_NAMED_PARAM(addValue, 1x1_100perSec, seconds(1), 1, 100)
int main(int argc, char* argv[]) { int main(int argc, char* argv[]) {
gflags::ParseCommandLineFlags(&argc, &argv, true); gflags::ParseCommandLineFlags(&argc, &argv, true);
......
...@@ -33,9 +33,9 @@ void addValue(unsigned int n, int64_t bucketSize, int64_t min, int64_t max) { ...@@ -33,9 +33,9 @@ void addValue(unsigned int n, int64_t bucketSize, int64_t min, int64_t max) {
} }
} }
BENCHMARK_NAMED_PARAM(addValue, 0_to_100, 1, 0, 100); BENCHMARK_NAMED_PARAM(addValue, 0_to_100, 1, 0, 100)
BENCHMARK_NAMED_PARAM(addValue, 0_to_1000, 10, 0, 1000); BENCHMARK_NAMED_PARAM(addValue, 0_to_1000, 10, 0, 1000)
BENCHMARK_NAMED_PARAM(addValue, 5k_to_20k, 250, 5000, 20000); BENCHMARK_NAMED_PARAM(addValue, 5k_to_20k, 250, 5000, 20000)
int main(int argc, char* argv[]) { int main(int argc, char* argv[]) {
gflags::ParseCommandLineFlags(&argc, &argv, true); gflags::ParseCommandLineFlags(&argc, &argv, true);
......
...@@ -322,11 +322,11 @@ unsigned paramMultiRel(unsigned iter, unsigned num) { ...@@ -322,11 +322,11 @@ unsigned paramMultiRel(unsigned iter, unsigned num) {
return num * iter; return num * iter;
} }
BENCHMARK_PARAM_MULTI(paramMulti, 1); BENCHMARK_PARAM_MULTI(paramMulti, 1)
BENCHMARK_RELATIVE_PARAM_MULTI(paramMultiRel, 1); BENCHMARK_RELATIVE_PARAM_MULTI(paramMultiRel, 1)
BENCHMARK_PARAM_MULTI(paramMulti, 5); BENCHMARK_PARAM_MULTI(paramMulti, 5)
BENCHMARK_RELATIVE_PARAM_MULTI(paramMultiRel, 5); BENCHMARK_RELATIVE_PARAM_MULTI(paramMultiRel, 5)
BENCHMARK_DRAW_LINE(); BENCHMARK_DRAW_LINE();
......
...@@ -528,80 +528,79 @@ void BM_ContentionStdSet(int iters, int size) { ...@@ -528,80 +528,79 @@ void BM_ContentionStdSet(int iters, int size) {
BENCHMARK_DRAW_LINE(); BENCHMARK_DRAW_LINE();
BENCHMARK_PARAM(BM_IterateOverSet, 1000); BENCHMARK_PARAM(BM_IterateOverSet, 1000)
BENCHMARK_PARAM(BM_IterateSkipList, 1000); BENCHMARK_PARAM(BM_IterateSkipList, 1000)
BENCHMARK_DRAW_LINE(); BENCHMARK_DRAW_LINE();
BENCHMARK_PARAM(BM_IterateOverSet, 1000000); BENCHMARK_PARAM(BM_IterateOverSet, 1000000)
BENCHMARK_PARAM(BM_IterateSkipList, 1000000); BENCHMARK_PARAM(BM_IterateSkipList, 1000000)
BENCHMARK_DRAW_LINE(); BENCHMARK_DRAW_LINE();
// find with keys in the set // find with keys in the set
BENCHMARK_PARAM(BM_SetContainsFound, 1000); BENCHMARK_PARAM(BM_SetContainsFound, 1000)
BENCHMARK_PARAM(BM_CSLContainsFound, 1000); BENCHMARK_PARAM(BM_CSLContainsFound, 1000)
BENCHMARK_DRAW_LINE(); BENCHMARK_DRAW_LINE();
BENCHMARK_PARAM(BM_SetContainsFound, 100000); BENCHMARK_PARAM(BM_SetContainsFound, 100000)
BENCHMARK_PARAM(BM_CSLContainsFound, 100000); BENCHMARK_PARAM(BM_CSLContainsFound, 100000)
BENCHMARK_DRAW_LINE(); BENCHMARK_DRAW_LINE();
BENCHMARK_PARAM(BM_SetContainsFound, 1000000); BENCHMARK_PARAM(BM_SetContainsFound, 1000000)
BENCHMARK_PARAM(BM_CSLContainsFound, 1000000); BENCHMARK_PARAM(BM_CSLContainsFound, 1000000)
BENCHMARK_DRAW_LINE(); BENCHMARK_DRAW_LINE();
BENCHMARK_PARAM(BM_SetContainsFound, 10000000); BENCHMARK_PARAM(BM_SetContainsFound, 10000000)
BENCHMARK_PARAM(BM_CSLContainsFound, 10000000); BENCHMARK_PARAM(BM_CSLContainsFound, 10000000)
BENCHMARK_DRAW_LINE(); BENCHMARK_DRAW_LINE();
// find with keys not in the set // find with keys not in the set
BENCHMARK_PARAM(BM_SetContainsNotFound, 1000); BENCHMARK_PARAM(BM_SetContainsNotFound, 1000)
BENCHMARK_PARAM(BM_CSLContainsNotFound, 1000); BENCHMARK_PARAM(BM_CSLContainsNotFound, 1000)
BENCHMARK_DRAW_LINE(); BENCHMARK_DRAW_LINE();
BENCHMARK_PARAM(BM_SetContainsNotFound, 100000); BENCHMARK_PARAM(BM_SetContainsNotFound, 100000)
BENCHMARK_PARAM(BM_CSLContainsNotFound, 100000); BENCHMARK_PARAM(BM_CSLContainsNotFound, 100000)
BENCHMARK_DRAW_LINE(); BENCHMARK_DRAW_LINE();
BENCHMARK_PARAM(BM_SetContainsNotFound, 1000000); BENCHMARK_PARAM(BM_SetContainsNotFound, 1000000)
BENCHMARK_PARAM(BM_CSLContainsNotFound, 1000000); BENCHMARK_PARAM(BM_CSLContainsNotFound, 1000000)
BENCHMARK_DRAW_LINE(); BENCHMARK_DRAW_LINE();
BENCHMARK_PARAM(BM_AddSet, 1000)
BENCHMARK_PARAM(BM_AddSet, 1000); BENCHMARK_PARAM(BM_AddSkipList, 1000)
BENCHMARK_PARAM(BM_AddSkipList, 1000);
BENCHMARK_DRAW_LINE(); BENCHMARK_DRAW_LINE();
BENCHMARK_PARAM(BM_AddSet, 65536); BENCHMARK_PARAM(BM_AddSet, 65536)
BENCHMARK_PARAM(BM_AddSkipList, 65536); BENCHMARK_PARAM(BM_AddSkipList, 65536)
BENCHMARK_DRAW_LINE(); BENCHMARK_DRAW_LINE();
BENCHMARK_PARAM(BM_AddSet, 1000000); BENCHMARK_PARAM(BM_AddSet, 1000000)
BENCHMARK_PARAM(BM_AddSkipList, 1000000); BENCHMARK_PARAM(BM_AddSkipList, 1000000)
BENCHMARK_DRAW_LINE(); BENCHMARK_DRAW_LINE();
BENCHMARK_PARAM(BM_SetMerge, 1000); BENCHMARK_PARAM(BM_SetMerge, 1000)
BENCHMARK_PARAM(BM_CSLMergeIntersection, 1000); BENCHMARK_PARAM(BM_CSLMergeIntersection, 1000)
BENCHMARK_PARAM(BM_CSLMergeLookup, 1000); BENCHMARK_PARAM(BM_CSLMergeLookup, 1000)
BENCHMARK_DRAW_LINE(); BENCHMARK_DRAW_LINE();
BENCHMARK_PARAM(BM_SetMerge, 65536); BENCHMARK_PARAM(BM_SetMerge, 65536)
BENCHMARK_PARAM(BM_CSLMergeIntersection, 65536); BENCHMARK_PARAM(BM_CSLMergeIntersection, 65536)
BENCHMARK_PARAM(BM_CSLMergeLookup, 65536); BENCHMARK_PARAM(BM_CSLMergeLookup, 65536)
BENCHMARK_DRAW_LINE(); BENCHMARK_DRAW_LINE();
BENCHMARK_PARAM(BM_SetMerge, 1000000); BENCHMARK_PARAM(BM_SetMerge, 1000000)
BENCHMARK_PARAM(BM_CSLMergeIntersection, 1000000); BENCHMARK_PARAM(BM_CSLMergeIntersection, 1000000)
BENCHMARK_PARAM(BM_CSLMergeLookup, 1000000); BENCHMARK_PARAM(BM_CSLMergeLookup, 1000000)
BENCHMARK_DRAW_LINE(); BENCHMARK_DRAW_LINE();
// multithreaded benchmarking // multithreaded benchmarking
BENCHMARK_PARAM(BM_ContentionStdSet, 1024); BENCHMARK_PARAM(BM_ContentionStdSet, 1024)
BENCHMARK_PARAM(BM_ContentionCSL, 1024); BENCHMARK_PARAM(BM_ContentionCSL, 1024)
BENCHMARK_DRAW_LINE(); BENCHMARK_DRAW_LINE();
BENCHMARK_PARAM(BM_ContentionStdSet, 65536); BENCHMARK_PARAM(BM_ContentionStdSet, 65536)
BENCHMARK_PARAM(BM_ContentionCSL, 65536); BENCHMARK_PARAM(BM_ContentionCSL, 65536)
BENCHMARK_DRAW_LINE(); BENCHMARK_DRAW_LINE();
BENCHMARK_PARAM(BM_ContentionStdSet, 1048576); BENCHMARK_PARAM(BM_ContentionStdSet, 1048576)
BENCHMARK_PARAM(BM_ContentionCSL, 1048576); BENCHMARK_PARAM(BM_ContentionCSL, 1048576)
BENCHMARK_DRAW_LINE(); BENCHMARK_DRAW_LINE();
} // namespace } // namespace
......
...@@ -156,38 +156,38 @@ void NoOverflowSub(size_t iterations, ValueT kMin, ValueT kMax) { ...@@ -156,38 +156,38 @@ void NoOverflowSub(size_t iterations, ValueT kMin, ValueT kMax) {
Add, \ Add, \
ValueT, \ ValueT, \
std::numeric_limits<ValueT>::min(), \ std::numeric_limits<ValueT>::min(), \
std::numeric_limits<ValueT>::max()); \ std::numeric_limits<ValueT>::max()) \
BENCHMARK_RELATIVE_NAMED_PARAM( \ BENCHMARK_RELATIVE_NAMED_PARAM( \
NoOverflowAdd, \ NoOverflowAdd, \
ValueT, \ ValueT, \
std::numeric_limits<ValueT>::min(), \ std::numeric_limits<ValueT>::min(), \
std::numeric_limits<ValueT>::max()); \ std::numeric_limits<ValueT>::max()) \
BENCHMARK_NAMED_PARAM( \ BENCHMARK_NAMED_PARAM( \
Sub, \ Sub, \
ValueT, \ ValueT, \
std::numeric_limits<ValueT>::min(), \ std::numeric_limits<ValueT>::min(), \
std::numeric_limits<ValueT>::max()); \ std::numeric_limits<ValueT>::max()) \
BENCHMARK_RELATIVE_NAMED_PARAM( \ BENCHMARK_RELATIVE_NAMED_PARAM( \
NoOverflowSub, \ NoOverflowSub, \
ValueT, \ ValueT, \
std::numeric_limits<ValueT>::min(), \ std::numeric_limits<ValueT>::min(), \
std::numeric_limits<ValueT>::max()) std::numeric_limits<ValueT>::max())
GENERATE_BENCHMARKS_FOR_TYPE(int8_t); GENERATE_BENCHMARKS_FOR_TYPE(int8_t)
BENCHMARK_DRAW_LINE(); BENCHMARK_DRAW_LINE();
GENERATE_BENCHMARKS_FOR_TYPE(uint8_t); GENERATE_BENCHMARKS_FOR_TYPE(uint8_t)
BENCHMARK_DRAW_LINE(); BENCHMARK_DRAW_LINE();
GENERATE_BENCHMARKS_FOR_TYPE(int16_t); GENERATE_BENCHMARKS_FOR_TYPE(int16_t)
BENCHMARK_DRAW_LINE(); BENCHMARK_DRAW_LINE();
GENERATE_BENCHMARKS_FOR_TYPE(uint16_t); GENERATE_BENCHMARKS_FOR_TYPE(uint16_t)
BENCHMARK_DRAW_LINE(); BENCHMARK_DRAW_LINE();
GENERATE_BENCHMARKS_FOR_TYPE(int32_t); GENERATE_BENCHMARKS_FOR_TYPE(int32_t)
BENCHMARK_DRAW_LINE(); BENCHMARK_DRAW_LINE();
GENERATE_BENCHMARKS_FOR_TYPE(uint32_t); GENERATE_BENCHMARKS_FOR_TYPE(uint32_t)
BENCHMARK_DRAW_LINE(); BENCHMARK_DRAW_LINE();
GENERATE_BENCHMARKS_FOR_TYPE(int64_t); GENERATE_BENCHMARKS_FOR_TYPE(int64_t)
BENCHMARK_DRAW_LINE(); BENCHMARK_DRAW_LINE();
GENERATE_BENCHMARKS_FOR_TYPE(uint64_t); GENERATE_BENCHMARKS_FOR_TYPE(uint64_t)
int main(int argc, char** argv) { int main(int argc, char** argv) {
gflags::ParseCommandLineFlags(&argc, &argv, true); gflags::ParseCommandLineFlags(&argc, &argv, true);
......
...@@ -718,11 +718,11 @@ static const StringVariadicToBM<std::string> stringVariadicToBM; ...@@ -718,11 +718,11 @@ static const StringVariadicToBM<std::string> stringVariadicToBM;
static const StringIdenticalToBM<fbstring> fbstringIdenticalToBM; static const StringIdenticalToBM<fbstring> fbstringIdenticalToBM;
static const StringVariadicToBM<fbstring> fbstringVariadicToBM; static const StringVariadicToBM<fbstring> fbstringVariadicToBM;
#define DEFINE_BENCHMARK_GROUP(n) \ #define DEFINE_BENCHMARK_GROUP(n) \
BENCHMARK_PARAM(u64ToAsciiClassicBM, n); \ BENCHMARK_PARAM(u64ToAsciiClassicBM, n) \
BENCHMARK_RELATIVE_PARAM(u64ToAsciiTableBM, n); \ BENCHMARK_RELATIVE_PARAM(u64ToAsciiTableBM, n) \
BENCHMARK_RELATIVE_PARAM(u64ToAsciiFollyBM, n); \ BENCHMARK_RELATIVE_PARAM(u64ToAsciiFollyBM, n) \
BENCHMARK_DRAW_LINE(); BENCHMARK_DRAW_LINE()
DEFINE_BENCHMARK_GROUP(1); DEFINE_BENCHMARK_GROUP(1);
DEFINE_BENCHMARK_GROUP(2); DEFINE_BENCHMARK_GROUP(2);
...@@ -747,12 +747,12 @@ DEFINE_BENCHMARK_GROUP(20); ...@@ -747,12 +747,12 @@ DEFINE_BENCHMARK_GROUP(20);
#undef DEFINE_BENCHMARK_GROUP #undef DEFINE_BENCHMARK_GROUP
#define DEFINE_BENCHMARK_GROUP(n) \ #define DEFINE_BENCHMARK_GROUP(n) \
BENCHMARK_PARAM(u64ToStringClibMeasure, n); \ BENCHMARK_PARAM(u64ToStringClibMeasure, n) \
BENCHMARK_RELATIVE_PARAM(u64ToStringFollyMeasure, n); \ BENCHMARK_RELATIVE_PARAM(u64ToStringFollyMeasure, n) \
BENCHMARK_RELATIVE_PARAM(i64ToStringFollyMeasurePos, n); \ BENCHMARK_RELATIVE_PARAM(i64ToStringFollyMeasurePos, n) \
BENCHMARK_RELATIVE_PARAM(i64ToStringFollyMeasureNeg, n); \ BENCHMARK_RELATIVE_PARAM(i64ToStringFollyMeasureNeg, n) \
BENCHMARK_DRAW_LINE(); BENCHMARK_DRAW_LINE()
DEFINE_BENCHMARK_GROUP(1); DEFINE_BENCHMARK_GROUP(1);
DEFINE_BENCHMARK_GROUP(2); DEFINE_BENCHMARK_GROUP(2);
...@@ -775,8 +775,8 @@ DEFINE_BENCHMARK_GROUP(18); ...@@ -775,8 +775,8 @@ DEFINE_BENCHMARK_GROUP(18);
DEFINE_BENCHMARK_GROUP(19); DEFINE_BENCHMARK_GROUP(19);
// Only for u64 // Only for u64
BENCHMARK_PARAM(u64ToStringClibMeasure, 20); BENCHMARK_PARAM(u64ToStringClibMeasure, 20)
BENCHMARK_RELATIVE_PARAM(u64ToStringFollyMeasure, 20); BENCHMARK_RELATIVE_PARAM(u64ToStringFollyMeasure, 20)
BENCHMARK_DRAW_LINE(); BENCHMARK_DRAW_LINE();
#undef DEFINE_BENCHMARK_GROUP #undef DEFINE_BENCHMARK_GROUP
...@@ -804,11 +804,11 @@ void i128ToStringFollyMeasureNeg(unsigned int n, size_t index) { ...@@ -804,11 +804,11 @@ void i128ToStringFollyMeasureNeg(unsigned int n, size_t index) {
} }
} }
#define DEFINE_BENCHMARK_GROUP(n) \ #define DEFINE_BENCHMARK_GROUP(n) \
BENCHMARK_PARAM(u128ToStringFollyMeasure, n); \ BENCHMARK_PARAM(u128ToStringFollyMeasure, n) \
BENCHMARK_RELATIVE_PARAM(i128ToStringFollyMeasurePos, n); \ BENCHMARK_RELATIVE_PARAM(i128ToStringFollyMeasurePos, n) \
BENCHMARK_RELATIVE_PARAM(i128ToStringFollyMeasureNeg, n); \ BENCHMARK_RELATIVE_PARAM(i128ToStringFollyMeasureNeg, n) \
BENCHMARK_DRAW_LINE(); BENCHMARK_DRAW_LINE()
DEFINE_BENCHMARK_GROUP(1); DEFINE_BENCHMARK_GROUP(1);
DEFINE_BENCHMARK_GROUP(2); DEFINE_BENCHMARK_GROUP(2);
...@@ -856,12 +856,12 @@ BENCHMARK_DRAW_LINE(); ...@@ -856,12 +856,12 @@ BENCHMARK_DRAW_LINE();
#endif #endif
#define DEFINE_BENCHMARK_GROUP(n) \ #define DEFINE_BENCHMARK_GROUP(n) \
BENCHMARK_PARAM(clibAtoiMeasure, n); \ BENCHMARK_PARAM(clibAtoiMeasure, n) \
BENCHMARK_RELATIVE_PARAM(lexicalCastMeasure, n); \ BENCHMARK_RELATIVE_PARAM(lexicalCastMeasure, n) \
BENCHMARK_RELATIVE_PARAM(handwrittenAtoiMeasure, n); \ BENCHMARK_RELATIVE_PARAM(handwrittenAtoiMeasure, n) \
BENCHMARK_RELATIVE_PARAM(follyAtoiMeasure, n); \ BENCHMARK_RELATIVE_PARAM(follyAtoiMeasure, n) \
BENCHMARK_DRAW_LINE(); BENCHMARK_DRAW_LINE()
DEFINE_BENCHMARK_GROUP(1); DEFINE_BENCHMARK_GROUP(1);
DEFINE_BENCHMARK_GROUP(2); DEFINE_BENCHMARK_GROUP(2);
...@@ -885,10 +885,10 @@ DEFINE_BENCHMARK_GROUP(19); ...@@ -885,10 +885,10 @@ DEFINE_BENCHMARK_GROUP(19);
#undef DEFINE_BENCHMARK_GROUP #undef DEFINE_BENCHMARK_GROUP
#define DEFINE_BENCHMARK_GROUP(T, n) \ #define DEFINE_BENCHMARK_GROUP(T, n) \
BENCHMARK_PARAM(T##VariadicToBM, n); \ BENCHMARK_PARAM(T##VariadicToBM, n) \
BENCHMARK_RELATIVE_PARAM(T##IdenticalToBM, n); \ BENCHMARK_RELATIVE_PARAM(T##IdenticalToBM, n) \
BENCHMARK_DRAW_LINE(); BENCHMARK_DRAW_LINE()
DEFINE_BENCHMARK_GROUP(string, 32); DEFINE_BENCHMARK_GROUP(string, 32);
DEFINE_BENCHMARK_GROUP(string, 1024); DEFINE_BENCHMARK_GROUP(string, 1024);
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
*/ */
void BENCHFUN(initRNG)(size_t /* iters */, size_t) { srand(seed); } void BENCHFUN(initRNG)(size_t /* iters */, size_t) { srand(seed); }
BENCHMARK_PARAM(BENCHFUN(initRNG), 0); BENCHMARK_PARAM(BENCHFUN(initRNG), 0)
void BENCHFUN(defaultCtor)(size_t iters, size_t) { void BENCHFUN(defaultCtor)(size_t iters, size_t) {
FOR_EACH_RANGE (i, 0, iters) { FOR_EACH_RANGE (i, 0, iters) {
...@@ -30,7 +30,7 @@ void BENCHFUN(defaultCtor)(size_t iters, size_t) { ...@@ -30,7 +30,7 @@ void BENCHFUN(defaultCtor)(size_t iters, size_t) {
doNotOptimizeAway(&s); doNotOptimizeAway(&s);
} }
} }
BENCHMARK_PARAM(BENCHFUN(defaultCtor), 0); BENCHMARK_PARAM(BENCHFUN(defaultCtor), 0)
void BENCHFUN(copyCtor)(size_t iters, size_t arg) { void BENCHFUN(copyCtor)(size_t iters, size_t arg) {
STRING s; STRING s;
...@@ -42,7 +42,7 @@ void BENCHFUN(copyCtor)(size_t iters, size_t arg) { ...@@ -42,7 +42,7 @@ void BENCHFUN(copyCtor)(size_t iters, size_t arg) {
doNotOptimizeAway(&s1); doNotOptimizeAway(&s1);
} }
} }
BENCHMARK_PARAM(BENCHFUN(copyCtor), 32768); BENCHMARK_PARAM(BENCHFUN(copyCtor), 32768)
void BENCHFUN(ctorFromArray)(size_t iters, size_t arg) { void BENCHFUN(ctorFromArray)(size_t iters, size_t arg) {
STRING s; STRING s;
...@@ -57,7 +57,7 @@ void BENCHFUN(ctorFromArray)(size_t iters, size_t arg) { ...@@ -57,7 +57,7 @@ void BENCHFUN(ctorFromArray)(size_t iters, size_t arg) {
doNotOptimizeAway(&s1); doNotOptimizeAway(&s1);
} }
} }
BENCHMARK_PARAM(BENCHFUN(ctorFromArray), 32768); BENCHMARK_PARAM(BENCHFUN(ctorFromArray), 32768)
void BENCHFUN(ctorFromTwoPointers)(size_t iters, size_t arg) { void BENCHFUN(ctorFromTwoPointers)(size_t iters, size_t arg) {
/* library-local */ static STRING s; /* library-local */ static STRING s;
...@@ -71,11 +71,11 @@ void BENCHFUN(ctorFromTwoPointers)(size_t iters, size_t arg) { ...@@ -71,11 +71,11 @@ void BENCHFUN(ctorFromTwoPointers)(size_t iters, size_t arg) {
doNotOptimizeAway(&s1); doNotOptimizeAway(&s1);
} }
} }
BENCHMARK_PARAM(BENCHFUN(ctorFromTwoPointers), 0); BENCHMARK_PARAM(BENCHFUN(ctorFromTwoPointers), 0)
BENCHMARK_PARAM(BENCHFUN(ctorFromTwoPointers), 7); BENCHMARK_PARAM(BENCHFUN(ctorFromTwoPointers), 7)
BENCHMARK_PARAM(BENCHFUN(ctorFromTwoPointers), 15); BENCHMARK_PARAM(BENCHFUN(ctorFromTwoPointers), 15)
BENCHMARK_PARAM(BENCHFUN(ctorFromTwoPointers), 23); BENCHMARK_PARAM(BENCHFUN(ctorFromTwoPointers), 23)
BENCHMARK_PARAM(BENCHFUN(ctorFromTwoPointers), 24); BENCHMARK_PARAM(BENCHFUN(ctorFromTwoPointers), 24)
void BENCHFUN(ctorFromChar)(size_t iters, size_t arg) { void BENCHFUN(ctorFromChar)(size_t iters, size_t arg) {
FOR_EACH_RANGE (i, 0, iters) { FOR_EACH_RANGE (i, 0, iters) {
...@@ -83,7 +83,7 @@ void BENCHFUN(ctorFromChar)(size_t iters, size_t arg) { ...@@ -83,7 +83,7 @@ void BENCHFUN(ctorFromChar)(size_t iters, size_t arg) {
doNotOptimizeAway(&s1); doNotOptimizeAway(&s1);
} }
} }
BENCHMARK_PARAM(BENCHFUN(ctorFromChar), 1048576); BENCHMARK_PARAM(BENCHFUN(ctorFromChar), 1048576)
void BENCHFUN(assignmentOp)(size_t iters, size_t arg) { void BENCHFUN(assignmentOp)(size_t iters, size_t arg) {
STRING s; STRING s;
...@@ -99,7 +99,7 @@ void BENCHFUN(assignmentOp)(size_t iters, size_t arg) { ...@@ -99,7 +99,7 @@ void BENCHFUN(assignmentOp)(size_t iters, size_t arg) {
s1 = s; s1 = s;
} }
} }
BENCHMARK_PARAM(BENCHFUN(assignmentOp), 256); BENCHMARK_PARAM(BENCHFUN(assignmentOp), 256)
void BENCHFUN(assignmentFill)(size_t iters, size_t) { void BENCHFUN(assignmentFill)(size_t iters, size_t) {
STRING s; STRING s;
...@@ -108,7 +108,7 @@ void BENCHFUN(assignmentFill)(size_t iters, size_t) { ...@@ -108,7 +108,7 @@ void BENCHFUN(assignmentFill)(size_t iters, size_t) {
doNotOptimizeAway(&s); doNotOptimizeAway(&s);
} }
} }
BENCHMARK_PARAM(BENCHFUN(assignmentFill), 0); BENCHMARK_PARAM(BENCHFUN(assignmentFill), 0)
void BENCHFUN(resize)(size_t iters, size_t arg) { void BENCHFUN(resize)(size_t iters, size_t arg) {
STRING s; STRING s;
...@@ -117,7 +117,7 @@ void BENCHFUN(resize)(size_t iters, size_t arg) { ...@@ -117,7 +117,7 @@ void BENCHFUN(resize)(size_t iters, size_t arg) {
doNotOptimizeAway(&s); doNotOptimizeAway(&s);
} }
} }
BENCHMARK_PARAM(BENCHFUN(resize), 524288); BENCHMARK_PARAM(BENCHFUN(resize), 524288)
void BENCHFUN(findSuccessful)(size_t iters, size_t /* arg */) { void BENCHFUN(findSuccessful)(size_t iters, size_t /* arg */) {
size_t pos, len; size_t pos, len;
...@@ -156,7 +156,7 @@ expect to get a call for an interview."; ...@@ -156,7 +156,7 @@ expect to get a call for an interview.";
doNotOptimizeAway(s.find(s.data(), pos, len)); doNotOptimizeAway(s.find(s.data(), pos, len));
} }
} }
BENCHMARK_PARAM(BENCHFUN(findSuccessful), 524288); BENCHMARK_PARAM(BENCHFUN(findSuccessful), 524288)
void BENCHFUN(findUnsuccessful)(size_t iters, size_t /* arg */) { void BENCHFUN(findUnsuccessful)(size_t iters, size_t /* arg */) {
STRING s, s1; STRING s, s1;
...@@ -190,7 +190,7 @@ expect to get a call for an interview."; ...@@ -190,7 +190,7 @@ expect to get a call for an interview.";
doNotOptimizeAway(s.find(s1)); doNotOptimizeAway(s.find(s1));
} }
} }
BENCHMARK_PARAM(BENCHFUN(findUnsuccessful), 524288); BENCHMARK_PARAM(BENCHFUN(findUnsuccessful), 524288)
void BENCHFUN(equality)(size_t iters, size_t arg) { void BENCHFUN(equality)(size_t iters, size_t arg) {
std::vector<STRING> haystack(arg); std::vector<STRING> haystack(arg);
...@@ -207,7 +207,7 @@ void BENCHFUN(equality)(size_t iters, size_t arg) { ...@@ -207,7 +207,7 @@ void BENCHFUN(equality)(size_t iters, size_t arg) {
doNotOptimizeAway(std::find(haystack.begin(), haystack.end(), needle)); doNotOptimizeAway(std::find(haystack.begin(), haystack.end(), needle));
} }
} }
BENCHMARK_PARAM(BENCHFUN(equality), 65536); BENCHMARK_PARAM(BENCHFUN(equality), 65536)
void BENCHFUN(replace)(size_t iters, size_t arg) { void BENCHFUN(replace)(size_t iters, size_t arg) {
STRING s; STRING s;
...@@ -227,7 +227,7 @@ void BENCHFUN(replace)(size_t iters, size_t arg) { ...@@ -227,7 +227,7 @@ void BENCHFUN(replace)(size_t iters, size_t arg) {
s.replace(pos, toRemove, s1); s.replace(pos, toRemove, s1);
} }
} }
BENCHMARK_PARAM(BENCHFUN(replace), 256); BENCHMARK_PARAM(BENCHFUN(replace), 256)
void BENCHFUN(push_back)(size_t iters, size_t arg) { void BENCHFUN(push_back)(size_t iters, size_t arg) {
FOR_EACH_RANGE (i, 0, iters) { FOR_EACH_RANGE (i, 0, iters) {
...@@ -237,10 +237,10 @@ void BENCHFUN(push_back)(size_t iters, size_t arg) { ...@@ -237,10 +237,10 @@ void BENCHFUN(push_back)(size_t iters, size_t arg) {
} }
} }
} }
BENCHMARK_PARAM(BENCHFUN(push_back), 1); BENCHMARK_PARAM(BENCHFUN(push_back), 1)
BENCHMARK_PARAM(BENCHFUN(push_back), 23); BENCHMARK_PARAM(BENCHFUN(push_back), 23)
BENCHMARK_PARAM(BENCHFUN(push_back), 127); BENCHMARK_PARAM(BENCHFUN(push_back), 127)
BENCHMARK_PARAM(BENCHFUN(push_back), 1024); BENCHMARK_PARAM(BENCHFUN(push_back), 1024)
void BENCHFUN(short_append)(size_t iters, size_t arg) { void BENCHFUN(short_append)(size_t iters, size_t arg) {
FOR_EACH_RANGE (i, 0, iters) { FOR_EACH_RANGE (i, 0, iters) {
...@@ -250,8 +250,8 @@ void BENCHFUN(short_append)(size_t iters, size_t arg) { ...@@ -250,8 +250,8 @@ void BENCHFUN(short_append)(size_t iters, size_t arg) {
} }
} }
} }
BENCHMARK_PARAM(BENCHFUN(short_append), 23); BENCHMARK_PARAM(BENCHFUN(short_append), 23)
BENCHMARK_PARAM(BENCHFUN(short_append), 1024); BENCHMARK_PARAM(BENCHFUN(short_append), 1024)
void BENCHFUN(getline)(size_t iters, size_t arg) { void BENCHFUN(getline)(size_t iters, size_t arg) {
string lines; string lines;
...@@ -274,5 +274,5 @@ void BENCHFUN(getline)(size_t iters, size_t arg) { ...@@ -274,5 +274,5 @@ void BENCHFUN(getline)(size_t iters, size_t arg) {
} }
} }
} }
BENCHMARK_PARAM(BENCHFUN(getline), 23); BENCHMARK_PARAM(BENCHFUN(getline), 23)
BENCHMARK_PARAM(BENCHFUN(getline), 1000); BENCHMARK_PARAM(BENCHFUN(getline), 1000)
...@@ -36,9 +36,9 @@ void BENCHFUN(sizeCtor)(int iters, int size) { ...@@ -36,9 +36,9 @@ void BENCHFUN(sizeCtor)(int iters, int size) {
doNotOptimizeAway(&v); doNotOptimizeAway(&v);
} }
} }
BENCHMARK_PARAM(BENCHFUN(sizeCtor), 16); BENCHMARK_PARAM(BENCHFUN(sizeCtor), 16)
BENCHMARK_PARAM(BENCHFUN(sizeCtor), 128); BENCHMARK_PARAM(BENCHFUN(sizeCtor), 128)
BENCHMARK_PARAM(BENCHFUN(sizeCtor), 1024); BENCHMARK_PARAM(BENCHFUN(sizeCtor), 1024)
void BENCHFUN(fillCtor)(int iters, int size) { void BENCHFUN(fillCtor)(int iters, int size) {
FOR_EACH_RANGE (i, 0, iters) { FOR_EACH_RANGE (i, 0, iters) {
...@@ -46,9 +46,9 @@ void BENCHFUN(fillCtor)(int iters, int size) { ...@@ -46,9 +46,9 @@ void BENCHFUN(fillCtor)(int iters, int size) {
doNotOptimizeAway(&v); doNotOptimizeAway(&v);
} }
} }
BENCHMARK_PARAM(BENCHFUN(fillCtor), 16); BENCHMARK_PARAM(BENCHFUN(fillCtor), 16)
BENCHMARK_PARAM(BENCHFUN(fillCtor), 128); BENCHMARK_PARAM(BENCHFUN(fillCtor), 128)
BENCHMARK_PARAM(BENCHFUN(fillCtor), 1024); BENCHMARK_PARAM(BENCHFUN(fillCtor), 1024)
#ifndef SKIP_RESERVE #ifndef SKIP_RESERVE
void BENCHFUN(reserve)(int iters, int size) { void BENCHFUN(reserve)(int iters, int size) {
...@@ -58,9 +58,9 @@ void BENCHFUN(reserve)(int iters, int size) { ...@@ -58,9 +58,9 @@ void BENCHFUN(reserve)(int iters, int size) {
v.reserve(size); v.reserve(size);
} }
} }
BENCHMARK_PARAM(BENCHFUN(reserve), 16); BENCHMARK_PARAM(BENCHFUN(reserve), 16)
BENCHMARK_PARAM(BENCHFUN(reserve), 128); BENCHMARK_PARAM(BENCHFUN(reserve), 128)
BENCHMARK_PARAM(BENCHFUN(reserve), 1024); BENCHMARK_PARAM(BENCHFUN(reserve), 1024)
#endif #endif
void BENCHFUN(insertFront)(int iters, int initialSize) { void BENCHFUN(insertFront)(int iters, int initialSize) {
...@@ -72,12 +72,12 @@ void BENCHFUN(insertFront)(int iters, int initialSize) { ...@@ -72,12 +72,12 @@ void BENCHFUN(insertFront)(int iters, int initialSize) {
}); });
} }
BENCHMARK_PARAM(BENCHFUN(insertFront), 16); BENCHMARK_PARAM(BENCHFUN(insertFront), 16)
BENCHMARK_PARAM(BENCHFUN(insertFront), 128); BENCHMARK_PARAM(BENCHFUN(insertFront), 128)
BENCHMARK_PARAM(BENCHFUN(insertFront), 1024); BENCHMARK_PARAM(BENCHFUN(insertFront), 1024)
BENCHMARK_PARAM(BENCHFUN(insertFront), 10240); BENCHMARK_PARAM(BENCHFUN(insertFront), 10240)
BENCHMARK_PARAM(BENCHFUN(insertFront), 102400); BENCHMARK_PARAM(BENCHFUN(insertFront), 102400)
BENCHMARK_PARAM(BENCHFUN(insertFront), 1024000); BENCHMARK_PARAM(BENCHFUN(insertFront), 1024000)
void BENCHFUN(pushBack)(int iters, int initialSize) { void BENCHFUN(pushBack)(int iters, int initialSize) {
BenchmarkSuspender braces; BenchmarkSuspender braces;
...@@ -88,9 +88,9 @@ void BENCHFUN(pushBack)(int iters, int initialSize) { ...@@ -88,9 +88,9 @@ void BENCHFUN(pushBack)(int iters, int initialSize) {
}); });
} }
BENCHMARK_PARAM(BENCHFUN(pushBack), 16); BENCHMARK_PARAM(BENCHFUN(pushBack), 16)
BENCHMARK_PARAM(BENCHFUN(pushBack), 128); BENCHMARK_PARAM(BENCHFUN(pushBack), 128)
BENCHMARK_PARAM(BENCHFUN(pushBack), 1024); BENCHMARK_PARAM(BENCHFUN(pushBack), 1024)
BENCHMARK_PARAM(BENCHFUN(pushBack), 10240); BENCHMARK_PARAM(BENCHFUN(pushBack), 10240)
BENCHMARK_PARAM(BENCHFUN(pushBack), 102400); BENCHMARK_PARAM(BENCHFUN(pushBack), 102400)
BENCHMARK_PARAM(BENCHFUN(pushBack), 1024000); BENCHMARK_PARAM(BENCHFUN(pushBack), 1024000)
...@@ -98,7 +98,7 @@ namespace { ...@@ -98,7 +98,7 @@ namespace {
class UserDefinedType { int whatevs_; }; class UserDefinedType { int whatevs_; };
} // namespace } // namespace
FOLLY_ASSUME_FBVECTOR_COMPATIBLE(UserDefinedType); FOLLY_ASSUME_FBVECTOR_COMPATIBLE(UserDefinedType)
TEST(fbvector, works_with_user_defined_type) { TEST(fbvector, works_with_user_defined_type) {
fbvector<UserDefinedType> v(10); fbvector<UserDefinedType> v(10);
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
#include <thread> #include <thread>
#include <utility> #include <utility>
FOLLY_ASSUME_FBVECTOR_COMPATIBLE_1(boost::intrusive_ptr); FOLLY_ASSUME_FBVECTOR_COMPATIBLE_1(boost::intrusive_ptr)
using namespace folly; using namespace folly;
using namespace detail; using namespace detail;
......
...@@ -236,9 +236,9 @@ void BM_ProducerConsumerLatency(int /* iters */, int size) { ...@@ -236,9 +236,9 @@ void BM_ProducerConsumerLatency(int /* iters */, int size) {
BENCHMARK_DRAW_LINE(); BENCHMARK_DRAW_LINE();
BENCHMARK_PARAM(BM_ProducerConsumer, 1048574); BENCHMARK_PARAM(BM_ProducerConsumer, 1048574)
BENCHMARK_PARAM(BM_ProducerConsumerAffinity, 1048574); BENCHMARK_PARAM(BM_ProducerConsumerAffinity, 1048574)
BENCHMARK_PARAM(BM_ProducerConsumerLatency, 1048574); BENCHMARK_PARAM(BM_ProducerConsumerLatency, 1048574)
} // namespace } // namespace
......
...@@ -208,8 +208,8 @@ DEFINE_int32(numThreads, 8, "Number simultaneous threads for benchmarks."); ...@@ -208,8 +208,8 @@ DEFINE_int32(numThreads, 8, "Number simultaneous threads for benchmarks.");
++globalInt ## size ; \ ++globalInt ## size ; \
} \ } \
} }
CREATE_INC_FUNC(64); CREATE_INC_FUNC(64)
CREATE_INC_FUNC(32); CREATE_INC_FUNC(32)
// Confirms counts are accurate with competing threads // Confirms counts are accurate with competing threads
TEST(ThreadCachedInt, MultiThreadedCached) { TEST(ThreadCachedInt, MultiThreadedCached) {
...@@ -269,8 +269,8 @@ TEST(ThreadCachedInt, MultiThreadedCached) { ...@@ -269,8 +269,8 @@ TEST(ThreadCachedInt, MultiThreadedCached) {
t.join(); \ t.join(); \
} \ } \
} }
MAKE_MT_CACHE_SIZE_BM(64); MAKE_MT_CACHE_SIZE_BM(64)
MAKE_MT_CACHE_SIZE_BM(32); MAKE_MT_CACHE_SIZE_BM(32)
#define REG_BASELINE(name, inc_stmt) \ #define REG_BASELINE(name, inc_stmt) \
BENCHMARK(FB_CONCATENATE(BM_mt_baseline_, name), iters) { \ BENCHMARK(FB_CONCATENATE(BM_mt_baseline_, name), iters) { \
...@@ -329,24 +329,26 @@ struct ShardedAtomicInt { ...@@ -329,24 +329,26 @@ struct ShardedAtomicInt {
}; };
ShardedAtomicInt shd_int64; ShardedAtomicInt shd_int64;
REG_BASELINE(_thread64, global__thread64 += 1); REG_BASELINE(_thread64, global__thread64 += 1)
REG_BASELINE(_thread32, global__thread32 += 1); REG_BASELINE(_thread32, global__thread32 += 1)
REG_BASELINE(ThreadLocal64, *globalTL64Baseline += 1); REG_BASELINE(ThreadLocal64, *globalTL64Baseline += 1)
REG_BASELINE(ThreadLocal32, *globalTL32Baseline += 1); REG_BASELINE(ThreadLocal32, *globalTL32Baseline += 1)
REG_BASELINE(atomic_inc64, REG_BASELINE(
std::atomic_fetch_add(&globalInt64Baseline, int64_t(1))); atomic_inc64,
REG_BASELINE(atomic_inc32, std::atomic_fetch_add(&globalInt64Baseline, int64_t(1)))
std::atomic_fetch_add(&globalInt32Baseline, int32_t(1))); REG_BASELINE(
REG_BASELINE(ShardedAtm64, shd_int64.inc()); atomic_inc32,
std::atomic_fetch_add(&globalInt32Baseline, int32_t(1)))
BENCHMARK_PARAM(BM_mt_cache_size64, 0); REG_BASELINE(ShardedAtm64, shd_int64.inc())
BENCHMARK_PARAM(BM_mt_cache_size64, 10);
BENCHMARK_PARAM(BM_mt_cache_size64, 100); BENCHMARK_PARAM(BM_mt_cache_size64, 0)
BENCHMARK_PARAM(BM_mt_cache_size64, 1000); BENCHMARK_PARAM(BM_mt_cache_size64, 10)
BENCHMARK_PARAM(BM_mt_cache_size32, 0); BENCHMARK_PARAM(BM_mt_cache_size64, 100)
BENCHMARK_PARAM(BM_mt_cache_size32, 10); BENCHMARK_PARAM(BM_mt_cache_size64, 1000)
BENCHMARK_PARAM(BM_mt_cache_size32, 100); BENCHMARK_PARAM(BM_mt_cache_size32, 0)
BENCHMARK_PARAM(BM_mt_cache_size32, 1000); BENCHMARK_PARAM(BM_mt_cache_size32, 10)
BENCHMARK_PARAM(BM_mt_cache_size32, 100)
BENCHMARK_PARAM(BM_mt_cache_size32, 1000)
BENCHMARK_DRAW_LINE(); BENCHMARK_DRAW_LINE();
// single threaded // single threaded
...@@ -368,12 +370,13 @@ BENCHMARK(Sharded_readFast) { ...@@ -368,12 +370,13 @@ BENCHMARK(Sharded_readFast) {
BENCHMARK_DRAW_LINE(); BENCHMARK_DRAW_LINE();
// multi threaded // multi threaded
REG_BASELINE(Atomic_readFull, REG_BASELINE(
doNotOptimizeAway(globalInt64Baseline.load(std::memory_order_relaxed))); Atomic_readFull,
REG_BASELINE(ThrCache_readFull, doNotOptimizeAway(globalInt64.readFull())); doNotOptimizeAway(globalInt64Baseline.load(std::memory_order_relaxed)))
REG_BASELINE(Sharded_readFull, doNotOptimizeAway(shd_int64.readFull())); REG_BASELINE(ThrCache_readFull, doNotOptimizeAway(globalInt64.readFull()))
REG_BASELINE(ThrCache_readFast, doNotOptimizeAway(globalInt64.readFast())); REG_BASELINE(Sharded_readFull, doNotOptimizeAway(shd_int64.readFull()))
REG_BASELINE(Sharded_readFast, doNotOptimizeAway(shd_int64.readFast())); REG_BASELINE(ThrCache_readFast, doNotOptimizeAway(globalInt64.readFast()))
REG_BASELINE(Sharded_readFast, doNotOptimizeAway(shd_int64.readFast()))
BENCHMARK_DRAW_LINE(); BENCHMARK_DRAW_LINE();
int main(int argc, char** argv) { int main(int argc, char** argv) {
......
...@@ -73,11 +73,11 @@ DEFINE_int32(numThreads, 8, "Number simultaneous threads for benchmarks."); ...@@ -73,11 +73,11 @@ DEFINE_int32(numThreads, 8, "Number simultaneous threads for benchmarks.");
} }
ThreadLocalPtr<int> tlp; ThreadLocalPtr<int> tlp;
REG(tlp); REG(tlp)
PThreadGetSpecific<int> pthread_get_specific; PThreadGetSpecific<int> pthread_get_specific;
REG(pthread_get_specific); REG(pthread_get_specific)
boost::thread_specific_ptr<int> boost_tsp; boost::thread_specific_ptr<int> boost_tsp;
REG(boost_tsp); REG(boost_tsp)
BENCHMARK_DRAW_LINE(); BENCHMARK_DRAW_LINE();
struct foo { struct foo {
......
...@@ -77,8 +77,7 @@ void TestClass::doNothing() { ...@@ -77,8 +77,7 @@ void TestClass::doNothing() {
VirtualClass::~VirtualClass() { VirtualClass::~VirtualClass() {
} }
void VirtualClass::doNothing() { void VirtualClass::doNothing() {}
};
LargeClass::LargeClass() { LargeClass::LargeClass() {
// Suppress unused field warning // Suppress unused field warning
......
...@@ -287,7 +287,7 @@ TEST(StaticTracepoint, TestEmpty) { ...@@ -287,7 +287,7 @@ TEST(StaticTracepoint, TestEmpty) {
EXPECT_TRUE(arguments.empty()); EXPECT_TRUE(arguments.empty());
} }
FOLLY_SDT_DEFINE_SEMAPHORE(folly, test_semaphore_local); FOLLY_SDT_DEFINE_SEMAPHORE(folly, test_semaphore_local)
static uint32_t manyArgTypesTestFunc() { static uint32_t manyArgTypesTestFunc() {
uint32_t a = folly::Random::rand32(); uint32_t a = folly::Random::rand32();
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
namespace folly { namespace folly {
namespace test { namespace test {
FOLLY_SDT_DEFINE_SEMAPHORE(folly, test_semaphore_extern); FOLLY_SDT_DEFINE_SEMAPHORE(folly, test_semaphore_extern)
unsigned staticTracepointTestFunc(unsigned v) { unsigned staticTracepointTestFunc(unsigned v) {
unsigned res = v * v; unsigned res = v * v;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment