32 defineOptionalProperty<std::string>(
"TimingTestTopicName",
"TimingTestTopic",
"-");
33 defineOptionalProperty<int>(
34 "SimulateWorkForMS", 20,
"Sleeps until it returns from the topic call");
36 defineOptionalProperty<std::string>(
37 "DebugObserverName",
"DebugObserver",
"Name of the topic the DebugObserver listens on");
43 return "TopicTimingClient";
58 debugObserver = getTopicFromProperty<DebugObserverInterfacePrx>(
"DebugObserverName");
63 lastSmallTime = IceUtil::Time::now();
65 updateTimes = boost::circular_buffer<IceUtil::Time>(11);
67 simulateWorkForMS = getProperty<int>(
"SimulateWorkForMS").getValue();
99 std::unique_lock<std::mutex> lock(mutex);
100 dur_cycle = time_now - lastSmallTime;
101 lastSmallTime = time_now;
102 updateTimes.push_back(time_now);
104 usleep(simulateWorkForMS * 1000);
108 float updatesPerSecond = 0.0f;
110 if (updateTimes.size() > 1)
112 duration = updateTimes.back() - updateTimes.front();
113 updatesPerSecond = (updateTimes.size() - 1) / duration.toSecondsDouble();
117 channel[
"DurationTransfer"] =
new Variant(dur_transfer.toMilliSecondsDouble());
118 channel[
"DurationCycle"] =
new Variant(dur_cycle.toMilliSecondsDouble());
119 channel[
"Duration10"] =
new Variant(duration.toMilliSecondsDouble());
120 channel[
"UpdatesPerSecond"] =
new Variant(updatesPerSecond);
121 debugObserver->setDebugChannel(
"TopicTimingClientSmall-" +
getName(), channel);