Revision 864b608c
Added by David Sorber about 4 years ago
| software/read_test/src/main.cc | ||
|---|---|---|
|
|
||
|
#include "AIO_ExecDriver.h"
|
||
|
#include "ExecDriver.h"
|
||
|
#include "URingExecDriver.h"
|
||
|
#include "Utilities/BufferAllocator.h"
|
||
|
#include "Utilities/FileUtils.h"
|
||
|
#include "Utilities/SearchLynxConfiguration.h"
|
||
| ... | ... | |
|
DEFAULT_INVALID,
|
||
|
AUTO,
|
||
|
NORMAL,
|
||
|
AIO
|
||
|
AIO,
|
||
|
URING
|
||
|
};
|
||
|
|
||
|
struct ReadTypeValue
|
||
| ... | ... | |
|
{
|
||
|
return ReadType::AIO;
|
||
|
}
|
||
|
else if (value == "uring")
|
||
|
{
|
||
|
return ReadType::URING;
|
||
|
}
|
||
|
return ReadType::DEFAULT_INVALID;
|
||
|
}
|
||
|
|
||
| ... | ... | |
|
// BlackLynx::SearchLynx::CharacterUtilities::lowercaseInPlace(val);
|
||
|
lowercase(val);
|
||
|
// Check for valid values
|
||
|
if (val == "auto" || val == "normal" || val == "aio")
|
||
|
if (val == "auto" || val == "normal" || val == "aio" || val == "uring")
|
||
|
{
|
||
|
v = boost::any(ReadTypeValue(val));
|
||
|
}
|
||
| ... | ... | |
|
bpo::variables_map optionsMap;
|
||
|
ReadTypeValue readType("default");
|
||
|
std::string filename;
|
||
|
uint32_t numThreads = 0;
|
||
|
|
||
|
try
|
||
|
{
|
||
| ... | ... | |
|
("read-type", bpo::value<ReadTypeValue>(&readType),
|
||
|
"read type")
|
||
|
|
||
|
("num-threads", bpo::value<uint32_t>(&numThreads),
|
||
|
"number reader threads")
|
||
|
|
||
|
("input-file", bpo::value<std::string>(&filename)->required(),
|
||
|
"input file")
|
||
|
;
|
||
| ... | ... | |
|
case ReadType::DEFAULT_INVALID:
|
||
|
case ReadType::AUTO:
|
||
|
case ReadType::AIO:
|
||
|
driver = new bsl::AIO_ExecDriver(filename, 2);
|
||
|
// Set default number of threads
|
||
|
if (numThreads == 0)
|
||
|
{
|
||
|
numThreads = 3;
|
||
|
}
|
||
|
driver = new bsl::AIO_ExecDriver(filename, numThreads);
|
||
|
break;
|
||
|
|
||
|
case ReadType::NORMAL:
|
||
|
driver = new bsl::ExecDriver(filename, 22);
|
||
|
// Set default number of threads
|
||
|
if (numThreads == 0)
|
||
|
{
|
||
|
numThreads = 22;
|
||
|
}
|
||
|
driver = new bsl::ExecDriver(filename, numThreads);
|
||
|
break;
|
||
|
|
||
|
case ReadType::URING:
|
||
|
numThreads = 1;
|
||
|
driver = new bsl::URingExecDriver(filename, 1);
|
||
|
break;
|
||
|
}
|
||
|
std::cout << "Num threads: " << numThreads << "\n";
|
||
|
|
||
|
driver->start();
|
||
|
driver->waitUntilComplete();
|
||
read_test: add new uring read method to read_test. It uses (requires)
liburing and a kernel >= 5.6.