Allow rate limiting in the Shared Memory example

This commit is contained in:
Alexey Rybalchenko
2016-05-18 16:00:26 +02:00
parent 1f09317cd0
commit af971c6ab1
4 changed files with 50 additions and 1 deletions

View File

@@ -29,11 +29,13 @@ int main(int argc, char** argv)
{
int msgSize;
int numMsgs;
int msgRate;
options_description samplerOptions("Sampler options");
samplerOptions.add_options()
("msg-size", value<int>(&msgSize)->default_value(1000), "Message size in bytes")
("num-msgs", value<int>(&numMsgs)->default_value(0), "Number of messages to send");
("num-msgs", value<int>(&numMsgs)->default_value(0), "Number of messages to send")
("msg-rate", value<int>(&msgRate)->default_value(0), "Msg rate limit in maximum number of messages per second");
FairMQProgOptions config;
config.AddToCmdLineOptions(samplerOptions);
@@ -42,6 +44,7 @@ int main(int argc, char** argv)
FairMQBenchmarkSampler sampler;
sampler.SetProperty(FairMQBenchmarkSampler::MsgSize, msgSize);
sampler.SetProperty(FairMQBenchmarkSampler::NumMsgs, numMsgs);
sampler.SetProperty(FairMQBenchmarkSampler::MsgRate, msgRate);
runStateMachine(sampler, config);
}