/* * runSampler.cxx * * Created on: Oct 5, 2012 * Author: dklein */ #include "PndMQSampler.h" #include #include #include #include "FairMQLogger.h" #include #include #include int main(int argc, char** argv) { if( argc != 10 ) { std::cout << "Usage: sampler \tID inputFile parameterFile\n" << "\t\tbranch eventRate numIoTreads\n" << "\t\tbindSocketType bindSndBufferSize BindAddress\n" << std::endl; return 1; } pid_t pid = getpid(); std::stringstream logmsg; logmsg << "PID: " << pid; FairMQLogger::GetInstance()->Log(FairMQLogger::INFO, logmsg.str()); int i = 1; PndMQSampler* sampler = new PndMQSampler(); sampler->SetProperty(PndMQSampler::Id, argv[i]); ++i; sampler->SetProperty(PndMQSampler::InputFile, argv[i]); ++i; sampler->SetProperty(PndMQSampler::ParFile, argv[i]); ++i; sampler->SetProperty(PndMQSampler::Branch, argv[i]); ++i; int eventRate; std::stringstream(argv[i]) >> eventRate; sampler->SetProperty(PndMQSampler::EventRate, eventRate); ++i; int numIoThreads; std::stringstream(argv[i]) >> numIoThreads; sampler->SetProperty(PndMQSampler::NumIoThreads, numIoThreads); ++i; int numInputs = 0; sampler->SetProperty(PndMQSampler::NumInputs, numInputs); int numOutputs = 1; sampler->SetProperty(PndMQSampler::NumOutputs, numOutputs); sampler->Init(); int bindSocketType = ZMQ_PUB; if (strcmp(argv[i], "push") == 0) { bindSocketType = ZMQ_PUSH; } sampler->SetProperty(PndMQSampler::BindSocketType, bindSocketType, 0); ++i; int bindSndBufferSize; std::stringstream(argv[i]) >> bindSndBufferSize; sampler->SetProperty(PndMQSampler::BindSndBufferSize, bindSndBufferSize, 0); ++i; sampler->SetProperty(PndMQSampler::BindAddress, argv[i], 0); ++i; sampler->Bind(); sampler->Connect(); sampler->Run(); exit(0); }