1 /*------------------------------------------------------------------------
2 Junction: Concurrent data structures in C++
3 Copyright (c) 2016 Jeff Preshing
5 Distributed under the Simplified BSD License.
6 Original location: https://github.com/preshing/junction
8 This software is distributed WITHOUT ANY WARRANTY; without even the
9 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 See the LICENSE file for more information.
11 ------------------------------------------------------------------------*/
13 #include <junction/Core.h>
14 #include "TestEnvironment.h"
15 #include "TestInsertSameKeys.h"
16 #include "TestInsertDifferentKeys.h"
17 #include "TestChurn.h"
18 #include "TestDoubleAssign.h"
19 #include <turf/extra/Options.h>
20 #include <junction/details/Grampa.h> // for GrampaStats
22 static const ureg IterationsPerLog = 100;
24 int main(int argc, const char** argv) {
27 TestInsertSameKeys testInsertSameKeys(env);
28 TestInsertDifferentKeys testInsertDifferentKeys(env);
29 TestChurn testChurn(env);
30 TestDoubleAssign testDoubleAssign(env);
32 for (ureg c = 0; c < IterationsPerLog; c++) {
33 testInsertSameKeys.run();
34 testInsertDifferentKeys.run();
36 testDoubleAssign.run();
38 turf::Trace::Instance.dumpStats();
40 #if JUNCTION_TRACK_GRAMPA_STATS
41 junction::DefaultQSBR.flush();
42 junction::details::GrampaStats& stats = junction::details::GrampaStats::Instance;
43 printf("---------------------------\n");
44 printf("numTables: %d/%d\n", (int) stats.numTables.current.load(turf::Relaxed),
45 (int) stats.numTables.total.load(turf::Relaxed));
46 printf("numTableMigrations: %d/%d\n", (int) stats.numTableMigrations.current.load(turf::Relaxed),
47 (int) stats.numTableMigrations.total.load(turf::Relaxed));
48 printf("numFlatTrees: %d/%d\n", (int) stats.numFlatTrees.current.load(turf::Relaxed),
49 (int) stats.numFlatTrees.total.load(turf::Relaxed));
50 printf("numFlatTreeMigrations: %d/%d\n", (int) stats.numFlatTreeMigrations.current.load(turf::Relaxed),
51 (int) stats.numFlatTreeMigrations.total.load(turf::Relaxed));