34 "SimulateWorkForMS", 20,
"Sleeps until it returns from the topic call");
37 "DebugObserverName",
"DebugObserver",
"Name of the topic the DebugObserver listens on");
43 return "TopicTimingClient";
63 lastSmallTime = IceUtil::Time::now();
65 updateTimes = boost::circular_buffer<IceUtil::Time>(11);
91 IceUtil::Time time_now = IceUtil::Time::now();
93 IceUtil::Time time_sent = IceUtil::Time::microSeconds(
data.sentTimestamp);
95 IceUtil::Time dur_transfer = time_now - time_sent;
97 IceUtil::Time dur_cycle;
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;
109 IceUtil::Time duration = IceUtil::Time::microSeconds(0);
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);
127 IceUtil::Time sentTime = IceUtil::Time::microSeconds(
data.sentTimestamp);
ComponentPropertyDefinitions(std::string prefix, bool hasObjectNameParameter=true)
TopicProxyType getTopicFromProperty(const std::string &propertyName)
Get a topic proxy whose name is specified by the given property.
void offeringTopicFromProperty(const std::string &propertyName)
Offer a topic whose name is specified by the given property.
void usingTopicFromProperty(const std::string &propertyName, bool orderedPublishing=false)
Use a topic whose name is specified by the given property.
std::string getConfigIdentifier()
Retrieve config identifier for this component as set in constructor.
Property< PropertyType > getProperty(const std::string &name)
std::string getName() const
Retrieve name of object.
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
PropertyDefinition< PropertyType > & defineOptionalProperty(const std::string &name, PropertyType defaultValue, const std::string &description="", PropertyDefinitionBase::PropertyConstness constness=PropertyDefinitionBase::eConstant)
TopicTimingClientPropertyDefinitions(std::string prefix)
virtual void onInitComponent() override
void reportBig(const topic_timing::BigData &data, const Ice::Current &) override
virtual void onDisconnectComponent() override
virtual armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
void reportSmall(const topic_timing::SmallData &data, const Ice::Current &) override
virtual void onConnectComponent() override
virtual void onExitComponent() override
virtual std::string getDefaultName() const override
The Variant class is described here: Variants.
This file offers overloads of toIce() and fromIce() functions for STL container types.
std::map< std::string, VariantBasePtr > StringVariantBaseMap
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.