-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add TCP latency application for the ENA device (#93)
* Add ENA version of the latency tool * Fix documentation URLs * Reduce log level * Parse log level from command line * Fix build with latency monitor * Add synchronous mode
- Loading branch information
Showing
14 changed files
with
217 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
#include <tulips/apps/Options.h> | ||
#include <tulips/apps/TCPLatency.h> | ||
#include <tulips/transport/ena/AbstractionLayer.h> | ||
#include <tulips/transport/ena/Device.h> | ||
#include <tulips/transport/ena/Port.h> | ||
#include <chrono> | ||
#include <thread> | ||
#include <tclap/CmdLine.h> | ||
|
||
using namespace tulips; | ||
using namespace apps::tcplatency; | ||
using namespace transport; | ||
|
||
void | ||
runPort(transport::ena::Port& port, std::atomic<bool>& keep_running) | ||
{ | ||
while (keep_running) { | ||
port.run(); | ||
std::this_thread::sleep_for(std::chrono::milliseconds(10)); | ||
} | ||
} | ||
|
||
int | ||
main(int argc, char** argv) | ||
try { | ||
TCLAP::CmdLine cmd("TULIPS ENA Test", ' ', "1.0"); | ||
apps::Options opts(cmd); | ||
cmd.parse(argc, argv); | ||
/* | ||
* Make sure the options are sane. | ||
*/ | ||
if (!opts.isSane()) { | ||
return __LINE__; | ||
} | ||
/* | ||
* Create the console logger. | ||
*/ | ||
auto logger = system::ConsoleLogger(opts.verbosity()); | ||
/* | ||
* Make sure the interface is set. | ||
*/ | ||
if (!opts.hasInterface()) { | ||
std::cerr << "--interface must be set" << std::endl; | ||
return -1; | ||
} | ||
/* | ||
* Allocate the EAL and the port. | ||
*/ | ||
auto eal = transport::ena::AbstractionLayer::allocate(logger); | ||
auto port = transport::ena::Port(logger, opts.interface(), 2, 1024, 2048); | ||
/* | ||
* Get an ENA device. | ||
*/ | ||
auto device = port.next(logger, false); | ||
/* | ||
* Start the port thread. | ||
*/ | ||
std::atomic<bool> keep_running = true; | ||
auto pthr = std::thread(runPort, std::ref(port), std::ref(keep_running)); | ||
/* | ||
* Call the main function. | ||
*/ | ||
int res = opts.isSender() ? Client::run(opts, std::move(device)) | ||
: Server::run(opts, std::move(device)); | ||
/* | ||
* Terminate the port thread. | ||
*/ | ||
keep_running = false; | ||
pthr.join(); | ||
/* | ||
* Clean-up. | ||
*/ | ||
return res; | ||
} catch (std::exception const& e) { | ||
std::cerr << e.what() << std::endl; | ||
return -1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.