Permalink
Browse files

Fix build and test.

Summary:
Fix bug in FBStringTest (don't reuse the same file name)

Don't use VLOG, as that requires that glog is compiled with gflags
support, which it isn't always.

Add other targets and tests, make all tests pass.

Test Plan: tests

Reviewed By: delong.j@fb.com

FB internal diff: D493018
  • Loading branch information...
tudor committed Jun 12, 2012
1 parent 987da6d commit 966000458dcdda8259e053d5be51e3051295ae3d
View
@@ -2,84 +2,118 @@ SUBDIRS = . test
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
@@ -18,9 +18,9 @@
#include <map>
#include <set>
+#include <thread>
#include <boost/shared_ptr.hpp>
-#include <boost/thread.hpp>
#include <gflags/gflags.h>
#include <glog/logging.h>
@@ -77,7 +77,7 @@ void BM_IterateOverSet(int iters, int size) {
if (iter == a_set.end()) iter = a_set.begin();
}
BENCHMARK_SUSPEND {
- VLOG(20) << "sum = " << sum;
+ // VLOG(20) << "sum = " << sum;
}
}
@@ -98,7 +98,7 @@ void BM_IterateSkipList(int iters, int size) {
}
BENCHMARK_SUSPEND {
- VLOG(20) << "sum = " << sum;
+ // VLOG(20) << "sum = " << sum;
}
}
@@ -119,7 +119,7 @@ void BM_SetMerge(int iters, int size) {
if (b_set.find(*it) != b_set.end()) mergedSum += *it;
}
BENCHMARK_SUSPEND {
- VLOG(20) << mergedSum;
+ // VLOG(20) << mergedSum;
}
}
@@ -143,7 +143,7 @@ void BM_CSLMergeLookup(int iters, int size) {
}
BENCHMARK_SUSPEND {
- VLOG(20) << mergedSum;
+ // VLOG(20) << mergedSum;
}
}
@@ -180,7 +180,7 @@ void BM_CSLMergeIntersection(int iters, int size) {
}
BENCHMARK_SUSPEND {
- VLOG(20) << mergedSum;
+ // VLOG(20) << mergedSum;
}
}
@@ -199,7 +199,7 @@ void BM_SetContainsNotFound(int iters, int size) {
}
BENCHMARK_SUSPEND {
- VLOG(20) << sum;
+ // VLOG(20) << sum;
}
}
@@ -224,7 +224,7 @@ void BM_SetContainsFound(int iters, int size) {
}
BENCHMARK_SUSPEND {
- VLOG(20) << sum;
+ // VLOG(20) << sum;
}
}
@@ -248,7 +248,7 @@ void BM_CSLContainsFound(int iters, int size) {
}
BENCHMARK_SUSPEND {
- VLOG(20) << sum;
+ // VLOG(20) << sum;
}
}
@@ -268,7 +268,7 @@ void BM_CSLContainsNotFound(int iters, int size) {
}
BENCHMARK_SUSPEND {
- VLOG(20) << sum;
+ // VLOG(20) << sum;
}
}
@@ -410,15 +410,15 @@ class ConcurrentAccessData {
for (int i = 0; i < iters; ++i) {
sum += accessSkipList(id, i);
}
- VLOG(20) << sum;
+ // VLOG(20) << sum;
}
void runSet(int id, int iters) {
int sum = 0;
for (int i = 0; i < iters; ++i) {
sum += accessSet(id, i);
}
- VLOG(20) << sum;
+ // VLOG(20) << sum;
}
bool accessSkipList(int64_t id, int t) {
@@ -484,11 +484,11 @@ static ConcurrentAccessData *mayInitTestData(int size) {
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) {
@@ -499,11 +499,11 @@ void BM_ContentionCSL(int iters, int size) {
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) {
@@ -18,7 +18,7 @@
#include <set>
#include <vector>
-#include <boost/thread.hpp>
+#include <thread>
#include <glog/logging.h>
#include <gflags/gflags.h>
@@ -208,10 +208,10 @@ TEST(ConcurrentSkipList, SequentialAccess) {
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) {
@@ -238,10 +238,10 @@ void testConcurrentRemoval(int numThreads, int maxValue) {
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) {
@@ -284,24 +284,24 @@ static void testConcurrentAccess(
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;
}
}
Oops, something went wrong.

0 comments on commit 9660004

Please sign in to comment.