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 <turf/extra/Options.h>
19 #include <junction/details/Grampa.h> // for GrampaStats
21 static const ureg IterationsPerLog = 100;
23 int main(int argc, const char** argv) {
26 TestInsertSameKeys testInsertSameKeys(env);
27 TestInsertDifferentKeys testInsertDifferentKeys(env);
28 TestChurn testChurn(env);
30 for (ureg c = 0; c < IterationsPerLog; c++) {
31 testInsertSameKeys.run();
32 testInsertDifferentKeys.run();
35 turf::Trace::Instance.dumpStats();
37 #if JUNCTION_TRACK_GRAMPA_STATS
38 junction::DefaultQSBR.flush();
39 junction::details::GrampaStats& stats = junction::details::GrampaStats::Instance;
40 printf("---------------------------\n");
41 printf("numTables: %d/%d\n", (int) stats.numTables.current.load(turf::Relaxed),
42 (int) stats.numTables.total.load(turf::Relaxed));
43 printf("numTableMigrations: %d/%d\n", (int) stats.numTableMigrations.current.load(turf::Relaxed),
44 (int) stats.numTableMigrations.total.load(turf::Relaxed));
45 printf("numFlatTrees: %d/%d\n", (int) stats.numFlatTrees.current.load(turf::Relaxed),
46 (int) stats.numFlatTrees.total.load(turf::Relaxed));
47 printf("numFlatTreeMigrations: %d/%d\n", (int) stats.numFlatTreeMigrations.current.load(turf::Relaxed),
48 (int) stats.numFlatTreeMigrations.total.load(turf::Relaxed));