33 defineOptionalProperty<std::string>(
"TimingTestTopicName",
"TimingTestTopic",
"-");
34 defineOptionalProperty<int>(
"SimulateWorkForMS", 20,
"Sleeps until it returns from the topic call");
36 defineOptionalProperty<std::string>(
"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();
103 std::unique_lock<std::mutex> lock(mutex);
104 dur_cycle = time_now - lastSmallTime;
105 lastSmallTime = time_now;
106 updateTimes.push_back(time_now);
108 usleep(simulateWorkForMS * 1000);
112 float updatesPerSecond = 0.0f;
114 if (updateTimes.size() > 1)
116 duration = updateTimes.back() - updateTimes.front();
117 updatesPerSecond = (updateTimes.size() - 1) / duration.toSecondsDouble();
121 channel[
"DurationTransfer"] =
new Variant(dur_transfer.toMilliSecondsDouble());
122 channel[
"DurationCycle"] =
new Variant(dur_cycle.toMilliSecondsDouble());
123 channel[
"Duration10"] =
new Variant(duration.toMilliSecondsDouble());
124 channel[
"UpdatesPerSecond"] =
new Variant(updatesPerSecond);
125 debugObserver->setDebugChannel(
"TopicTimingClientSmall-" +
getName(), channel);