Skip to content

Commit f98b54c

Browse files
authored
Benchmark_update (#480)
* Added complexity to benchmark * Added function for get NodeVector and EdgeVector
1 parent 498a46f commit f98b54c

24 files changed

+155
-78
lines changed

benchmark/BFS_BM.cpp

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@ static void BFS_X(benchmark::State &state) {
1717
g.breadth_first_search(*(range_start->second->getNodePair().first));
1818
}
1919
}
20-
BENCHMARK(BFS_X)->RangeMultiplier(18)->Range((unsigned long)1,
21-
(unsigned long)1 << 18);
20+
BENCHMARK(BFS_X)
21+
->RangeMultiplier(18)
22+
->Range((unsigned long)1, (unsigned long)1 << 18)
23+
->Complexity();
2224

2325
static void BFS_FromReadedCitHep(benchmark::State &state) {
2426
auto edgeSet = cit_graph_ptr->getEdgeSet();
@@ -28,7 +30,7 @@ static void BFS_FromReadedCitHep(benchmark::State &state) {
2830
}
2931
}
3032

31-
BENCHMARK(BFS_FromReadedCitHep);
33+
BENCHMARK(BFS_FromReadedCitHep)->Complexity();
3234

3335
static void PSEUDO_CONCURRENCY_BFS_X(benchmark::State &state) {
3436
CXXGraph::Graph<int> g;
@@ -46,7 +48,8 @@ static void PSEUDO_CONCURRENCY_BFS_X(benchmark::State &state) {
4648
}
4749
BENCHMARK(PSEUDO_CONCURRENCY_BFS_X)
4850
->RangeMultiplier(18)
49-
->Range((unsigned long)1, (unsigned long)1 << 18);
51+
->Range((unsigned long)1, (unsigned long)1 << 18)
52+
->Complexity();
5053

5154
static void PSEUDO_CONCURRENCY_BFS_FromReadedCitHep(benchmark::State &state) {
5255
auto edgeSet = cit_graph_ptr->getEdgeSet();
@@ -56,7 +59,7 @@ static void PSEUDO_CONCURRENCY_BFS_FromReadedCitHep(benchmark::State &state) {
5659
}
5760
}
5861

59-
BENCHMARK(PSEUDO_CONCURRENCY_BFS_FromReadedCitHep);
62+
BENCHMARK(PSEUDO_CONCURRENCY_BFS_FromReadedCitHep)->Complexity();
6063

6164
static void CONCURRENCY_BFS_X(benchmark::State &state) {
6265
CXXGraph::Graph<int> g;
@@ -72,9 +75,9 @@ static void CONCURRENCY_BFS_X(benchmark::State &state) {
7275
*(range_start->second->getNodePair().first), 8);
7376
}
7477
}
75-
BENCHMARK(CONCURRENCY_BFS_X)
76-
->RangeMultiplier(18)
77-
->Range((unsigned long)1, (unsigned long)1 << 18);
78+
// BENCHMARK(CONCURRENCY_BFS_X)
79+
// ->RangeMultiplier(18)
80+
// ->Range((unsigned long)1, (unsigned long)1 << 18);
7881

7982
static void CONCURRENCY_BFS_FromReadedCitHep(benchmark::State &state) {
8083
auto edgeSet = cit_graph_ptr->getEdgeSet();
@@ -84,4 +87,4 @@ static void CONCURRENCY_BFS_FromReadedCitHep(benchmark::State &state) {
8487
}
8588
}
8689

87-
BENCHMARK(CONCURRENCY_BFS_FromReadedCitHep);
90+
// BENCHMARK(CONCURRENCY_BFS_FromReadedCitHep);

benchmark/BellmanFord_BM.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ static void BellmanFord_X(benchmark::State &state) {
1919
}
2020
BENCHMARK(BellmanFord_X)
2121
->RangeMultiplier(16)
22-
->Range((unsigned long)1, (unsigned long)1 << 16);
22+
->Range((unsigned long)1, (unsigned long)1 << 16)
23+
->Complexity();
2324

2425
static void BellmanFord_FromReadedCitHep(benchmark::State &state) {
2526
auto edgeSet = cit_graph_ptr->getEdgeSet();
@@ -30,4 +31,4 @@ static void BellmanFord_FromReadedCitHep(benchmark::State &state) {
3031
}
3132
}
3233

33-
BENCHMARK(BellmanFord_FromReadedCitHep);
34+
BENCHMARK(BellmanFord_FromReadedCitHep)->Complexity();

benchmark/Boruvka_BM.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ static void Boruvka_X(benchmark::State &state) {
1616
auto &result = g.boruvka();
1717
}
1818
}
19-
BENCHMARK(Boruvka_X)->RangeMultiplier(16)->Range((unsigned long)1,
20-
(unsigned long)1 << 16);
19+
BENCHMARK(Boruvka_X)
20+
->RangeMultiplier(16)
21+
->Range((unsigned long)1, (unsigned long)1 << 16)
22+
->Complexity();
2123

2224
static void Boruvka_FromReadedCitHep(benchmark::State &state) {
2325
auto edgeSet = cit_graph_ptr->getEdgeSet();
@@ -26,4 +28,4 @@ static void Boruvka_FromReadedCitHep(benchmark::State &state) {
2628
}
2729
}
2830

29-
BENCHMARK(Boruvka_FromReadedCitHep);
31+
BENCHMARK(Boruvka_FromReadedCitHep)->Complexity();

benchmark/Connectivity_BM.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ static void Connectivity_X(benchmark::State &state) {
1818
}
1919
BENCHMARK(Connectivity_X)
2020
->RangeMultiplier(16)
21-
->Range((unsigned long)1, (unsigned long)1 << 16);
21+
->Range((unsigned long)1, (unsigned long)1 << 16)
22+
->Complexity();
2223

2324
static void Connectivity_FromReadedCitHep(benchmark::State &state) {
2425
auto edgeSet = cit_graph_ptr->getEdgeSet();
@@ -27,7 +28,7 @@ static void Connectivity_FromReadedCitHep(benchmark::State &state) {
2728
}
2829
}
2930

30-
BENCHMARK(Connectivity_FromReadedCitHep);
31+
BENCHMARK(Connectivity_FromReadedCitHep)->Complexity();
3132

3233
static void StrongConnectivity_X(benchmark::State &state) {
3334
CXXGraph::Graph<int> g;
@@ -44,7 +45,8 @@ static void StrongConnectivity_X(benchmark::State &state) {
4445
}
4546
BENCHMARK(StrongConnectivity_X)
4647
->RangeMultiplier(16)
47-
->Range((unsigned long)1, (unsigned long)1 << 16);
48+
->Range((unsigned long)1, (unsigned long)1 << 16)
49+
->Complexity();
4850

4951
static void StrongConnectivity_FromReadedCitHep(benchmark::State &state) {
5052
auto edgeSet = cit_graph_ptr->getEdgeSet();
@@ -53,4 +55,4 @@ static void StrongConnectivity_FromReadedCitHep(benchmark::State &state) {
5355
}
5456
}
5557

56-
BENCHMARK(StrongConnectivity_FromReadedCitHep);
58+
BENCHMARK(StrongConnectivity_FromReadedCitHep)->Complexity();

benchmark/CycleCheck_BM.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ static void CycleCheckBFS_X(benchmark::State &state) {
1818
}
1919
BENCHMARK(CycleCheckBFS_X)
2020
->RangeMultiplier(16)
21-
->Range((unsigned long)1, (unsigned long)1 << 16);
21+
->Range((unsigned long)1, (unsigned long)1 << 16)
22+
->Complexity();
2223

2324
static void CycleCheckBFS_FromReadedCitHep(benchmark::State &state) {
2425
auto edgeSet = cit_graph_ptr->getEdgeSet();
@@ -27,7 +28,7 @@ static void CycleCheckBFS_FromReadedCitHep(benchmark::State &state) {
2728
}
2829
}
2930

30-
BENCHMARK(CycleCheckBFS_FromReadedCitHep);
31+
BENCHMARK(CycleCheckBFS_FromReadedCitHep)->Complexity();
3132

3233
static void CycleCheckDFS_X(benchmark::State &state) {
3334
CXXGraph::Graph<int> g;
@@ -44,7 +45,8 @@ static void CycleCheckDFS_X(benchmark::State &state) {
4445
}
4546
BENCHMARK(CycleCheckDFS_X)
4647
->RangeMultiplier(16)
47-
->Range((unsigned long)1, (unsigned long)1 << 16);
48+
->Range((unsigned long)1, (unsigned long)1 << 16)
49+
->Complexity();
4850

4951
static void CycleCheckDFS_FromReadedCitHep(benchmark::State &state) {
5052
auto edgeSet = cit_graph_ptr->getEdgeSet();
@@ -53,4 +55,4 @@ static void CycleCheckDFS_FromReadedCitHep(benchmark::State &state) {
5355
}
5456
}
5557

56-
BENCHMARK(CycleCheckDFS_FromReadedCitHep);
58+
BENCHMARK(CycleCheckDFS_FromReadedCitHep)->Complexity();

benchmark/DFS_BM.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@ static void DFS_X(benchmark::State &state) {
1818
}
1919
}
2020

21-
BENCHMARK(DFS_X)->RangeMultiplier(16)->Range((unsigned long)1,
22-
(unsigned long)1 << 16);
21+
BENCHMARK(DFS_X)
22+
->RangeMultiplier(16)
23+
->Range((unsigned long)1, (unsigned long)1 << 16)
24+
->Complexity();
2325

2426
static void DFS_FromReadedCitHep(benchmark::State &state) {
2527
auto edgeSet = cit_graph_ptr->getEdgeSet();
@@ -29,4 +31,4 @@ static void DFS_FromReadedCitHep(benchmark::State &state) {
2931
}
3032
}
3133

32-
BENCHMARK(DFS_FromReadedCitHep);
34+
BENCHMARK(DFS_FromReadedCitHep)->Complexity();

benchmark/Dial_BM.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ static void Dial_X(benchmark::State &state) {
1616
auto &result = g.dial(*(range_start->second->getNodePair().first), 1);
1717
}
1818
}
19-
BENCHMARK(Dial_X)->RangeMultiplier(16)->Range((unsigned long)1,
20-
(unsigned long)1 << 16);
19+
BENCHMARK(Dial_X)
20+
->RangeMultiplier(16)
21+
->Range((unsigned long)1, (unsigned long)1 << 16)
22+
->Complexity();
2123

2224
static void Dial_FromReadedCitHep(benchmark::State &state) {
2325
auto edgeSet = cit_graph_ptr->getEdgeSet();
@@ -27,4 +29,4 @@ static void Dial_FromReadedCitHep(benchmark::State &state) {
2729
}
2830
}
2931

30-
BENCHMARK(Dial_FromReadedCitHep);
32+
BENCHMARK(Dial_FromReadedCitHep)->Complexity();

benchmark/Dijkstra_BM.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ static void Dijkstra_X(benchmark::State &state) {
1919
}
2020
BENCHMARK(Dijkstra_X)
2121
->RangeMultiplier(16)
22-
->Range((unsigned long)1, (unsigned long)1 << 16);
22+
->Range((unsigned long)1, (unsigned long)1 << 16)
23+
->Complexity();
2324

2425
static void Dijkstra_FromReadedCitHep(benchmark::State &state) {
2526
auto edgeSet = cit_graph_ptr->getEdgeSet();
@@ -30,4 +31,4 @@ static void Dijkstra_FromReadedCitHep(benchmark::State &state) {
3031
}
3132
}
3233

33-
BENCHMARK(Dijkstra_FromReadedCitHep);
34+
BENCHMARK(Dijkstra_FromReadedCitHep)->Complexity();

benchmark/Edge_BM.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ static void BM_EdgeCreation(benchmark::State &state) {
1212
}
1313
}
1414

15-
BENCHMARK(BM_EdgeCreation);
15+
BENCHMARK(BM_EdgeCreation)->Complexity();
1616

1717
static void EdgeCreationDestruction_new_delete(benchmark::State &state) {
1818
auto nodes = generateRandomNodes(2, 2);
@@ -25,7 +25,7 @@ static void EdgeCreationDestruction_new_delete(benchmark::State &state) {
2525
}
2626
}
2727

28-
BENCHMARK(EdgeCreationDestruction_new_delete);
28+
BENCHMARK(EdgeCreationDestruction_new_delete)->Complexity();
2929

3030
static void EdgeGetId(benchmark::State &state) {
3131
auto nodes = generateRandomNodes(2, 2);
@@ -36,7 +36,7 @@ static void EdgeGetId(benchmark::State &state) {
3636
e.getId();
3737
}
3838
}
39-
BENCHMARK(EdgeGetId);
39+
BENCHMARK(EdgeGetId)->Complexity();
4040

4141
static void NodeGetNodePair(benchmark::State &state) {
4242
auto nodes = generateRandomNodes(2, 2);
@@ -47,4 +47,4 @@ static void NodeGetNodePair(benchmark::State &state) {
4747
e.getNodePair();
4848
}
4949
}
50-
BENCHMARK(NodeGetNodePair);
50+
BENCHMARK(NodeGetNodePair)->Complexity();

benchmark/EulerPath_BM.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,5 @@ static void EulerPath_X(benchmark::State &state) {
1818
}
1919
BENCHMARK(EulerPath_X)
2020
->RangeMultiplier(16)
21-
->Range((unsigned long)1, (unsigned long)1 << 16);
21+
->Range((unsigned long)1, (unsigned long)1 << 16)
22+
->Complexity();

benchmark/FloydWarshall_BM.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ static void BM_FWDirected(benchmark::State &state) {
3232
CXXGraph::FWResult res = graph.floydWarshall();
3333
}
3434
}
35-
BENCHMARK(BM_FWDirected);
35+
BENCHMARK(BM_FWDirected)->Complexity();
3636

3737
// a graph with negative cycle
3838
static void BM_FWNegCycle(benchmark::State &state) {
@@ -51,7 +51,7 @@ static void BM_FWNegCycle(benchmark::State &state) {
5151
CXXGraph::FWResult res = graph.floydWarshall();
5252
}
5353
}
54-
BENCHMARK(BM_FWNegCycle);
54+
BENCHMARK(BM_FWNegCycle)->Complexity();
5555

5656
static void BM_FWUndirectedWeighted(benchmark::State &state) {
5757
CXXGraph::Node<int> node1("1", 1);
@@ -71,7 +71,7 @@ static void BM_FWUndirectedWeighted(benchmark::State &state) {
7171
CXXGraph::FWResult res = graph.floydWarshall();
7272
}
7373
}
74-
BENCHMARK(BM_FWUndirectedWeighted);
74+
BENCHMARK(BM_FWUndirectedWeighted)->Complexity();
7575

7676
static void BM_FWNoWeighted(benchmark::State &state) {
7777
CXXGraph::Node<int> node1("1", 1);
@@ -92,4 +92,4 @@ static void BM_FWNoWeighted(benchmark::State &state) {
9292
}
9393
}
9494

95-
BENCHMARK(BM_FWNoWeighted);
95+
BENCHMARK(BM_FWNoWeighted)->Complexity();

benchmark/FordFulkerson_BM.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ static void FordFulkerson_X(benchmark::State &state) {
2020
}
2121
BENCHMARK(FordFulkerson_X)
2222
->RangeMultiplier(16)
23-
->Range((unsigned long)1, (unsigned long)1 << 16);
23+
->Range((unsigned long)1, (unsigned long)1 << 16)
24+
->Complexity();
2425

2526
static void FordFulkerson_FromReadedCitHep(benchmark::State &state) {
2627
auto edgeSet = cit_graph_ptr->getEdgeSet();
@@ -31,4 +32,4 @@ static void FordFulkerson_FromReadedCitHep(benchmark::State &state) {
3132
}
3233
}
3334

34-
BENCHMARK(FordFulkerson_FromReadedCitHep);
35+
BENCHMARK(FordFulkerson_FromReadedCitHep)->Complexity();

benchmark/GraphSlicing_BM.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,5 @@ static void GraphSlicing_X(benchmark::State &state) {
1818
}
1919
BENCHMARK(GraphSlicing_X)
2020
->RangeMultiplier(16)
21-
->Range((unsigned long)1, (unsigned long)1 << 8);
21+
->Range((unsigned long)1, (unsigned long)1 << 8)
22+
->Complexity();

0 commit comments

Comments
 (0)