mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-16 01:51:45 +00:00
add nanomsg implementations + use factory for nanomsg + lots of small stuff
This commit is contained in:
@@ -11,18 +11,24 @@
|
||||
#include "FairMQLogger.h"
|
||||
#include "FairMQBenchmarkSampler.h"
|
||||
#include "FairMQTransportFactoryZMQ.h"
|
||||
// #include "FairMQTransportFactoryNN.h"
|
||||
|
||||
using std::cout;
|
||||
using std::cin;
|
||||
using std::endl;
|
||||
using std::stringstream;
|
||||
|
||||
|
||||
FairMQBenchmarkSampler sampler;
|
||||
|
||||
static void s_signal_handler (int signal)
|
||||
{
|
||||
std::cout << std::endl << "Caught signal " << signal << std::endl;
|
||||
cout << endl << "Caught signal " << signal << endl;
|
||||
|
||||
sampler.ChangeState(FairMQBenchmarkSampler::STOP);
|
||||
sampler.ChangeState(FairMQBenchmarkSampler::END);
|
||||
|
||||
std::cout << "Shutdown complete. Bye!" << std::endl;
|
||||
cout << "Shutdown complete. Bye!" << endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -39,19 +45,20 @@ static void s_catch_signals (void)
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
if ( argc != 9 ) {
|
||||
std::cout << "Usage: bsampler ID eventSize eventRate numIoTreads\n"
|
||||
cout << "Usage: bsampler ID eventSize eventRate numIoTreads\n"
|
||||
<< "\t\toutputSocketType outputSndBufSize outputMethod outputAddress\n"
|
||||
<< std::endl;
|
||||
<< endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
s_catch_signals();
|
||||
|
||||
std::stringstream logmsg;
|
||||
stringstream logmsg;
|
||||
logmsg << "PID: " << getpid();
|
||||
FairMQLogger::GetInstance()->Log(FairMQLogger::INFO, logmsg.str());
|
||||
|
||||
FairMQTransportFactory* transportFactory = new FairMQTransportFactoryZMQ();
|
||||
// FairMQTransportFactory* transportFactory = new FairMQTransportFactoryNN();
|
||||
sampler.SetTransport(transportFactory);
|
||||
|
||||
int i = 1;
|
||||
@@ -60,17 +67,17 @@ int main(int argc, char** argv)
|
||||
++i;
|
||||
|
||||
int eventSize;
|
||||
std::stringstream(argv[i]) >> eventSize;
|
||||
stringstream(argv[i]) >> eventSize;
|
||||
sampler.SetProperty(FairMQBenchmarkSampler::EventSize, eventSize);
|
||||
++i;
|
||||
|
||||
int eventRate;
|
||||
std::stringstream(argv[i]) >> eventRate;
|
||||
stringstream(argv[i]) >> eventRate;
|
||||
sampler.SetProperty(FairMQBenchmarkSampler::EventRate, eventRate);
|
||||
++i;
|
||||
|
||||
int numIoThreads;
|
||||
std::stringstream(argv[i]) >> numIoThreads;
|
||||
stringstream(argv[i]) >> numIoThreads;
|
||||
sampler.SetProperty(FairMQBenchmarkSampler::NumIoThreads, numIoThreads);
|
||||
++i;
|
||||
|
||||
@@ -81,14 +88,10 @@ int main(int argc, char** argv)
|
||||
sampler.ChangeState(FairMQBenchmarkSampler::INIT);
|
||||
|
||||
|
||||
int outputSocketType = ZMQ_PUB;
|
||||
if (strcmp(argv[i], "push") == 0) {
|
||||
outputSocketType = ZMQ_PUSH;
|
||||
}
|
||||
sampler.SetProperty(FairMQBenchmarkSampler::OutputSocketType, outputSocketType, 0);
|
||||
sampler.SetProperty(FairMQBenchmarkSampler::OutputSocketType, argv[i], 0);
|
||||
++i;
|
||||
int outputSndBufSize;
|
||||
std::stringstream(argv[i]) >> outputSndBufSize;
|
||||
stringstream(argv[i]) >> outputSndBufSize;
|
||||
sampler.SetProperty(FairMQBenchmarkSampler::OutputSndBufSize, outputSndBufSize, 0);
|
||||
++i;
|
||||
sampler.SetProperty(FairMQBenchmarkSampler::OutputMethod, argv[i], 0);
|
||||
@@ -104,7 +107,7 @@ int main(int argc, char** argv)
|
||||
|
||||
|
||||
char ch;
|
||||
std::cin.get(ch);
|
||||
cin.get(ch);
|
||||
|
||||
sampler.ChangeState(FairMQBenchmarkSampler::STOP);
|
||||
sampler.ChangeState(FairMQBenchmarkSampler::END);
|
||||
|
Reference in New Issue
Block a user