ACLOCAL_AMFLAGS = -I m4
+noinst_PROGRAMS = generate_fingerprint_tables
+generate_fingerprint_tables_SOURCES = build/GenerateFingerprintTables.cpp
+generate_fingerprint_tables_LDADD = libfolly.la
+
lib_LTLIBRARIES = \
libfolly.la \
libfollybenchmark.la \
- libfollytimeout_queue.la
+ libfollytimeout_queue.la \
+ libfollyfingerprint.la
follyincludedir = $(includedir)/folly
nobase_follyinclude_HEADERS = \
- FBVector.h \
- detail/ThreadLocalDetail.h \
- detail/DiscriminatedPtrDetail.h \
+ Arena.h \
+ Arena-inl.h \
+ AtomicHashArray.h \
+ AtomicHashArray-inl.h \
+ AtomicHashMap.h \
+ AtomicHashMap-inl.h \
+ Benchmark.h \
+ Bits.h \
+ ConcurrentSkipList.h \
+ ConcurrentSkipList-inl.h \
+ Conv.h \
detail/AtomicHashUtils.h \
detail/BitIteratorDetail.h \
+ detail/DiscriminatedPtrDetail.h \
+ detail/FingerprintPolynomial.h \
detail/GroupVarintDetail.h \
- IntrusiveList.h \
- TimeoutQueue.h \
- String.h \
- PackedSyncPtr.h \
- Conv.h \
- ThreadLocal.h \
- ProducerConsumerQueue.h \
- Histogram-inl.h \
- ThreadCachedInt.h \
- ConcurrentSkipList.h \
- json.h \
- folly-config.h \
- FBString.h \
- Unicode.h \
- test/function_benchmark/test_functions.h \
- test/function_benchmark/benchmark_impl.h \
- test/FBStringTestBenchmarks.cpp.h \
- test/SynchronizedTestLib.h \
- test/FBVectorTestBenchmarks.cpp.h \
- test/SynchronizedTestLib-inl.h \
- Synchronized.h \
- Malloc.h \
+ detail/SlowFingerprint.h \
+ detail/ThreadLocalDetail.h \
+ DiscriminatedPtr.h \
dynamic.h \
- AtomicHashArray.h \
dynamic-inl.h \
- Bits.h \
- sorted_vector_types.h \
- Hash.h \
- DiscriminatedPtr.h \
- ConcurrentSkipList-inl.h \
- Random.h \
+ eventfd.h \
+ FBString.h \
+ FBVector.h \
+ Fingerprint.h \
+ folly-config.h \
+ Foreach.h \
+ FormatArg.h \
+ Format.h \
+ Format-inl.h \
GroupVarint.h \
- Range.h \
- Benchmark.h \
- Likely.h \
+ Hash.h \
Histogram.h \
- AtomicHashMap.h \
+ Histogram-inl.h \
+ IntrusiveList.h \
+ json.h \
+ Likely.h \
+ Malloc.h \
+ MapUtil.h \
+ PackedSyncPtr.h \
Portability.h \
- AtomicHashArray-inl.h \
- eventfd.h \
- SmallLocks.h \
- ScopeGuard.h \
- Traits.h \
+ Preprocessor.h \
+ ProducerConsumerQueue.h \
+ Random.h \
+ Range.h \
RWSpinLock.h \
+ ScopeGuard.h \
+ SmallLocks.h \
small_vector.h \
- Foreach.h \
- AtomicHashMap-inl.h \
- MapUtil.h
+ sorted_vector_types.h \
+ StlAllocator.h \
+ String.h \
+ String-inl.h \
+ Synchronized.h \
+ test/FBStringTestBenchmarks.cpp.h \
+ test/FBVectorTestBenchmarks.cpp.h \
+ test/function_benchmark/benchmark_impl.h \
+ test/function_benchmark/test_functions.h \
+ test/SynchronizedTestLib.h \
+ test/SynchronizedTestLib-inl.h \
+ ThreadCachedArena.h \
+ ThreadCachedInt.h \
+ ThreadLocal.h \
+ TimeoutQueue.h \
+ Traits.h \
+ Unicode.h
FormatTables.cpp: build/generate_format_tables.py
build/generate_format_tables.py
+EscapeTables.cpp: build/generate_escape_tables.py
+ build/generate_escape_tables.py
+
+GroupVarintTables.cpp: build/generate_varint_tables.py
+ build/generate_varint_tables.py
+
libfolly_la_SOURCES = \
Random.cpp \
Range.cpp \
Unicode.cpp \
Conv.cpp \
- Format.cpp \
- FormatTables.cpp \
- String.cpp \
json.cpp \
dynamic.cpp \
+ GroupVarint.cpp \
+ GroupVarintTables.cpp \
+ EscapeTables.cpp \
+ ThreadCachedArena.cpp \
+ Format.cpp \
+ FormatTables.cpp \
+ String.cpp
+
libfolly_la_LIBADD = $(BOOST_THREAD_LIBS) -lpthread
+FingerprintTables.cpp: generate_fingerprint_tables
+ ./generate_fingerprint_tables
+
+libfollyfingerprint_la_SOURCES = \
+ FingerprintTables.cpp
+
libfollybenchmark_la_SOURCES = Benchmark.cpp
libfollybenchmark_la_LIBADD = -lboost_regex -lpthread -lrt
#include <map>
#include <set>
+#include <thread>
#include <boost/shared_ptr.hpp>
-#include <boost/thread.hpp>
#include <gflags/gflags.h>
#include <glog/logging.h>
if (iter == a_set.end()) iter = a_set.begin();
}
BENCHMARK_SUSPEND {
- VLOG(20) << "sum = " << sum;
+ // VLOG(20) << "sum = " << sum;
}
}
}
BENCHMARK_SUSPEND {
- VLOG(20) << "sum = " << sum;
+ // VLOG(20) << "sum = " << sum;
}
}
if (b_set.find(*it) != b_set.end()) mergedSum += *it;
}
BENCHMARK_SUSPEND {
- VLOG(20) << mergedSum;
+ // VLOG(20) << mergedSum;
}
}
}
BENCHMARK_SUSPEND {
- VLOG(20) << mergedSum;
+ // VLOG(20) << mergedSum;
}
}
}
BENCHMARK_SUSPEND {
- VLOG(20) << mergedSum;
+ // VLOG(20) << mergedSum;
}
}
}
BENCHMARK_SUSPEND {
- VLOG(20) << sum;
+ // VLOG(20) << sum;
}
}
}
BENCHMARK_SUSPEND {
- VLOG(20) << sum;
+ // VLOG(20) << sum;
}
}
}
BENCHMARK_SUSPEND {
- VLOG(20) << sum;
+ // VLOG(20) << sum;
}
}
}
BENCHMARK_SUSPEND {
- VLOG(20) << sum;
+ // VLOG(20) << sum;
}
}
for (int i = 0; i < iters; ++i) {
sum += accessSkipList(id, i);
}
- VLOG(20) << sum;
+ // VLOG(20) << sum;
}
void runSet(int id, int iters) {
for (int i = 0; i < iters; ++i) {
sum += accessSet(id, i);
}
- VLOG(20) << sum;
+ // VLOG(20) << sum;
}
bool accessSkipList(int64_t id, int t) {
void BM_ContentionCSL(int iters, int size) {
BenchmarkSuspender susp;
auto data = mayInitTestData(size);
- std::vector<boost::thread> threads;
+ std::vector<std::thread> threads;
susp.dismiss();
for (int i = 0; i < FLAGS_num_threads; ++i) {
- threads.push_back(boost::thread(
+ threads.push_back(std::thread(
&ConcurrentAccessData::runSkipList, data, i, iters));
}
FOR_EACH(t, threads) {
void BM_ContentionStdSet(int iters, int size) {
BenchmarkSuspender susp;
auto data = mayInitTestData(size);
- std::vector<boost::thread> threads;
+ std::vector<std::thread> threads;
susp.dismiss();
for (int i = 0; i < FLAGS_num_threads; ++i) {
- threads.push_back(boost::thread(
+ threads.push_back(std::thread(
&ConcurrentAccessData::runSet, data, i, iters));
}
FOR_EACH(t, threads) {
#include <set>
#include <vector>
-#include <boost/thread.hpp>
+#include <thread>
#include <glog/logging.h>
#include <gflags/gflags.h>
void testConcurrentAdd(int numThreads) {
auto skipList(SkipListType::create(kHeadHeight));
- vector<boost::thread> threads;
+ vector<std::thread> threads;
vector<SetType> verifiers(numThreads);
for (int i = 0; i < numThreads; ++i) {
- threads.push_back(boost::thread(
+ threads.push_back(std::thread(
&randomAdding, 100, skipList, &verifiers[i], kMaxValue));
}
for (int i = 0; i < threads.size(); ++i) {
skipList.add(i);
}
- vector<boost::thread> threads;
+ vector<std::thread> threads;
vector<SetType > verifiers(numThreads);
for (int i = 0; i < numThreads; ++i) {
- threads.push_back(boost::thread(
+ threads.push_back(std::thread(
&randomRemoval, 100, skipList, &verifiers[i], maxValue));
}
FOR_EACH(t, threads) {
std::sort(skipValues[i].begin(), skipValues[i].end());
}
- vector<boost::thread> threads;
+ vector<std::thread> threads;
for (int i = 0; i < FLAGS_num_threads; ++i) {
switch (i % 8) {
case 0:
case 1:
- threads.push_back(boost::thread(
+ threads.push_back(std::thread(
randomAdding, numInsertions, skipList, &verifiers[i], maxValue));
break;
case 2:
- threads.push_back(boost::thread(
+ threads.push_back(std::thread(
randomRemoval, numDeletions, skipList, &verifiers[i], maxValue));
break;
case 3:
- threads.push_back(boost::thread(
+ threads.push_back(std::thread(
concurrentSkip, &skipValues[i], skipList));
break;
default:
- threads.push_back(boost::thread(sumAllValues, skipList, &sums[i]));
+ threads.push_back(std::thread(sumAllValues, skipList, &sums[i]));
break;
}
}
#include "folly/FBString.h"
+#include <cstdlib>
+
#include <list>
#include <fstream>
#include <boost/algorithm/string.hpp>
laoreet. Phasellus lectus quam, ultricies ut tincidunt in, dignissim \n\
id eros. Mauris vulputate tortor nec neque pellentesque sagittis quis \n\
sed nisl. In diam lacus, lobortis ut posuere nec, ornare id quam.";
- const char* f = "/tmp/fbstring_testing";
- {
+ char f[] = "/tmp/fbstring_testing.XXXXXX";
+ int fd = mkstemp(f);
+ EXPECT_TRUE(fd > 0);
+ if (fd > 0) {
+ close(fd); // Yeah
std::ofstream out(f);
if (!(out << s1)) {
EXPECT_TRUE(0) << "Couldn't write to temp file.";
}
vector<fbstring> v;
boost::split(v, s1, boost::is_any_of("\n"));
- ifstream input(f);
- fbstring line;
- FOR_EACH (i, v) {
- EXPECT_TRUE(getline(input, line));
- EXPECT_EQ(line, *i);
+ {
+ ifstream input(f);
+ fbstring line;
+ FOR_EACH (i, v) {
+ EXPECT_TRUE(getline(input, line));
+ EXPECT_EQ(line, *i);
+ }
}
+ unlink(f);
}
TEST(FBString, testMoveCtor) {
bits_test \
bit_iterator_test
-lib_LTLIBRARIES = libgtestmain.la
+lib_LTLIBRARIES = libgtestmain.la libgtest.la
+
libgtestmain_la_CPPFLAGS = -Igtest-1.6.0 -Igtest-1.6.0/src
libgtestmain_la_SOURCES = gtest-1.6.0/src/gtest-all.cc gtest-1.6.0/src/gtest_main.cc
+libgtest_la_CPPFLAGS = -Igtest-1.6.0 -Igtest-1.6.0/src
+libgtest_la_SOURCES = gtest-1.6.0/src/gtest-all.cc
+
noinst_HEADERS = FBStringTestBenchmarks.cpp.h \
FBVectorTestBenchmarks.cpp.h
endian_test_LDADD = libgtestmain.la $(top_builddir)/libfolly.la
TESTS += endian_test
-# needs externals/glog to use third-party glog
-# rw_spinlock_test_SOURCES = RWSpinLockTest.cpp
-# rw_spinlock_test_LDADD = libgtestmain.la $(top_builddir)/libfollybenchmark.la $(top_builddir)/libfolly.la $(BOOST_THREAD_LIBS)
-# TESTS += rw_spinlock_test
+rw_spinlock_test_SOURCES = RWSpinLockTest.cpp
+rw_spinlock_test_LDADD = libgtestmain.la $(top_builddir)/libfollybenchmark.la $(top_builddir)/libfolly.la $(BOOST_THREAD_LIBS)
+TESTS += rw_spinlock_test
synchronized_test_SOURCES = SynchronizedTest.cpp
synchronized_test_LDADD = libgtestmain.la $(top_builddir)/libfolly.la
TESTS += synchronized_test
-# needs externals/glog to use third-party glog
-# concurrent_skiplist_test_SOURCES = ConcurrentSkipListTest.cpp
-# concurrent_skiplist_test_LDADD = libgtestmain.la $(top_builddir)/libfolly.la
-# TESTS += concurrent_skiplist_test
+concurrent_skiplist_test_SOURCES = ConcurrentSkipListTest.cpp
+concurrent_skiplist_test_LDADD = libgtest.la $(top_builddir)/libfolly.la
+TESTS += concurrent_skiplist_test
+
+concurrent_skiplist_benchmark_SOURCES = ConcurrentSkipListBenchmark.cpp
+concurrent_skiplist_benchmark_LDADD = $(top_builddir)/libfollybenchmark.la $(top_builddir)/libfolly.la $(BOOST_THREAD_LIBS)
+noinst_PROGRAMS += concurrent_skiplist_benchmark
+
+histogram_test_SOURCES = HistogramTest.cpp
+histogram_test_LDADD = libgtestmain.la $(top_builddir)/libfolly.la
+TESTS += histogram_test
+
+group_varint_test_SOURCES = GroupVarintTest.cpp
+group_varint_test_LDADD = libgtestmain.la $(top_builddir)/libfolly.la
+TESTS += group_varint_test
+
+map_util_test_SOURCES = MapUtilTest.cpp
+map_util_test_LDADD = libgtestmain.la $(top_builddir)/libfolly.la
+TESTS += map_util_test
+
+string_test_SOURCES = StringTest.cpp
+string_test_LDADD = libgtest.la $(top_builddir)/libfolly.la $(top_builddir)/libfollybenchmark.la
+TESTS += string_test
+
+producer_consumer_queue_test_SOURCES = ProducerConsumerQueueTest.cpp
+producer_consumer_queue_test_LDADD = libgtestmain.la $(top_builddir)/libfolly.la
+TESTS += producer_consumer_queue_test
+
+atomic_hash_array_test_SOURCES = AtomicHashArrayTest.cpp
+atomic_hash_array_test_LDADD = libgtestmain.la $(top_builddir)/libfolly.la
+TESTS += atomic_hash_array_test
+
+atomic_hash_map_test_SOURCES = AtomicHashMapTest.cpp
+atomic_hash_map_test_LDADD = libgtest.la $(top_builddir)/libfolly.la $(top_builddir)/libfollybenchmark.la
+TESTS += atomic_hash_map_test
+
+format_test_SOURCES = FormatTest.cpp
+format_test_LDADD = libgtest.la $(top_builddir)/libfolly.la $(top_builddir)/libfollybenchmark.la
+TESTS += format_test
-# needs externals/glog to use third-party glog
-# concurrent_skiplist_benchmark_SOURCES = ConcurrentSkipListBenchmark.cpp
-# concurrent_skiplist_benchmark_LDADD = libgtestmain.la $(top_builddir)/libfollybenchmark.la $(top_builddir)/libfolly.la $(BOOST_THREAD_LIBS)
-# noinst_PROGRAMS += concurrent_skiplist_benchmark
+fingerprint_test_SOURCES = FingerprintTest.cpp
+fingerprint_test_LDADD = libgtest.la $(top_builddir)/libfolly.la $(top_builddir)/libfollyfingerprint.la $(top_builddir)/libfollybenchmark.la
+TESTS += fingerprint_test
check_PROGRAMS= $(TESTS)
#include <stdlib.h>
#include <unistd.h>
#include <vector>
-
-#include <boost/thread.hpp>
+#include <thread>
#include "gtest/gtest.h"
#include <gflags/gflags.h>
++reads;
}
}
- VLOG(0) << "total reads: " << reads << "; total writes: " << writes;
+ // VLOG(0) << "total reads: " << reads << "; total writes: " << writes;
}
RWSpinLockType l;
srand(time(NULL));
- std::vector<boost::thread> threads;
+ std::vector<std::thread> threads;
for (int i = 0; i < FLAGS_num_threads; ++i) {
- threads.push_back(boost::thread(&run<RWSpinLockType>, &l));
+ threads.push_back(std::thread(&run<RWSpinLockType>, &l));
}
sleep(1);
}
};
- std::vector<boost::thread> threads;
+ std::vector<std::thread> threads;
for (int i = 0; i < FLAGS_num_threads; ++i) {
- threads.push_back(boost::thread(go));
+ threads.push_back(std::thread(go));
}
sleep(5);