- typedef junction::ConcurrentMap_Grampa<size_t, size_t> GrampaMap;
- typedef junction::ConcurrentMap_Linear<size_t, size_t> LinearMap;
- typedef junction::ConcurrentMap_Leapfrog<size_t, size_t> LeapfrogMap;
- typedef junction::ConcurrentMap_Crude<size_t, size_t> CrudeMap;
-
- static const unsigned s_nInsertPercentage = 10;
- // Run GC after "kGCFrequency" operations.
- static const size_t kGCFrequency = 3000;
- static const size_t kLeapfrogGCFrequency = 1500;
-
- static const size_t kCrudeMapSize = 10000;
- static const size_t kCrudePassCount = 400000;
-
- static const size_t kGrampaMapSize = 20000;
- static const size_t kGrampaPassCount = 60000;
-
- static const size_t kLinearMapSize = 20000;
- static const size_t kLinearPassCount = 70000;
-
- static const size_t kLeapfrogMapSize = 20000;
- static const size_t kLeapfrogPassCount = 75000;
-
- static void SetUpTestCase() {}
-
- template <typename Map>
- static void run_test(size_t map_size, size_t pass_count,
- size_t gc_frequency) {
- size_t nInsertedNum = 0;
- size_t nFindSuccess = 0;
- size_t nOperations = 0;
- std::unique_ptr<Map> map(new Map());
- auto qsbrContext = junction::DefaultQSBR.createContext();
- for (size_t count = 0; count < pass_count; count++) {
- for (size_t i = 0; i < map_size; ++i) {
- // The number to operate on the map.
- size_t n = map_size + i;
- // Insert
- if (i % s_nInsertPercentage == 1) {
- auto iter = map->insertOrFind(i);
- if (!iter.getValue()) {
- iter.assignValue(n);
- nInsertedNum++;
- // std::cout << "Inserted" << i << "\n";
- }
- }
- // Find
- {
- auto iter = map->find(i);
- if (iter.getValue()) {
- ++nFindSuccess;
- // std::cout << "Found" << i << "\n";
- }
- }
- // Delete
- if (i % s_nInsertPercentage == 1) {
- auto iter = map->find(i);
- if (iter.getValue()) {
- iter.eraseValue();
- // std::cout << "Erased" << i << "\n";
- }
- }
- if (++nOperations > gc_frequency) {
- junction::DefaultQSBR.update(qsbrContext);
- nOperations = 0;
- }
- }
- }
- junction::DefaultQSBR.update(qsbrContext);
- junction::DefaultQSBR.destroyContext(qsbrContext);
- EXPECT_EQ(nFindSuccess, nInsertedNum);
+ static unsigned s_nInsertDeletePercentage;
+ static size_t s_nGCFrequency; // Run GC after "s_nGCFrequency" operations.
+ static size_t s_nMapKeyRange;
+ static size_t s_nCrudeMapCapacity;
+
+ enum actions { do_find, do_insert, do_delete };
+ static const unsigned int kShuffleSize = 100;
+ static actions s_arrShuffle[kShuffleSize];
+
+ static size_t s_nCrudePassCount;
+ static size_t s_nGrampaPassCount;
+ static size_t s_nLinearPassCount;
+ static size_t s_nLeapfrogPassCount;
+
+ static void SetUpTestCase() {
+ const cds_test::config& cfg = get_config("SequentialJunction");
+ GetConfigNonZeroExpected(InsertDeletePercentage, 5);
+ GetConfigNonZeroExpected(MapKeyRange, 20000);
+ GetConfigNonZeroExpected(CrudeMapCapacity, s_nMapKeyRange * 64);
+ GetConfigNonZeroExpected(GCFrequency, 1500);
+ GetConfigNonZeroExpected(CrudePassCount, 1500000000);
+ GetConfigNonZeroExpected(GrampaPassCount, 650000000);
+ GetConfigNonZeroExpected(LinearPassCount, 900000000);
+ GetConfigNonZeroExpected(LeapfrogPassCount, 850000000);