Repository navigation
Expand file tree
/
Copy pathmain.cpp
More file actions
70 lines (56 loc) · 1.64 KB
/
Copy pathmain.cpp
File metadata and controls
70 lines (56 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#include "stdafx.h"
#include <boost/algorithm/string.hpp>
#include "LatencyTestSession.h"
#include "TestRepository.h"
#include "ThroughputTestSession.h"
using namespace Disruptor::PerfTests;
void runAllTests(const TestRepository& testRepository);
void runOneTest(const TestRepository& testRepository, const std::string& testName);
int main(int, char**)
{
auto& testRepository = TestRepository::instance();
std::string testName;
std::cout << "Test name (ALL by default): " << testName << " ?" << std::endl;
std::getline(std::cin, testName);
boost::algorithm::trim(testName);
if (boost::algorithm::iequals(testName, "ALL") || testName.empty())
{
runAllTests(testRepository);
}
else
{
runOneTest(testRepository, testName);
}
return 0;
}
void runAllTests(const TestRepository& testRepository)
{
for (auto&& info : testRepository.allLatencyTests())
{
LatencyTestSession session(info);
session.run();
}
for (auto&& info : testRepository.allThrougputTests())
{
ThroughputTestSession session(info);
session.run();
}
}
void runOneTest(const TestRepository& testRepository, const std::string& testName)
{
LatencyTestInfo latencyTestInfo;
if (testRepository.tryGetLatencyTest(testName, latencyTestInfo))
{
LatencyTestSession session(latencyTestInfo);
session.run();
}
else
{
ThroughputTestInfo throughputTestInfo;
if (testRepository.tryGetThroughputTest(testName, throughputTestInfo))
{
ThroughputTestSession session(throughputTestInfo);
session.run();
}
}
}