14#include <yarp/companion/impl/Companion.h>
28 if (NetworkProfiler::progCallback) {
33 unsigned int itr_count = 0;
34 for(itr = details_set.begin(); itr!= details_set.end(); itr++) {
54 auto itrVert=graph.
insert(*process);
72 if(NetworkProfiler::progCallback) {
73 NetworkProfiler::progCallback->
onProgress((
unsigned int) (++itr_count/((
float)(details_set.size()*2)) * 100.0) );
79 for(itr = details_set.begin(); itr!= details_set.end(); itr++) {
84 for(
auto cnn : details.
outputs) {
88 Property edge_prop(
"(type connection)");
89 edge_prop.
put(
"carrier", cnn.carrier);
92 yWarning() <<
"Found a nonexistent port (" << cnn.port_name <<
")"
93 <<
"in the output list of" << (*vi1)->property.find(
"name").asString();
97 if(NetworkProfiler::progCallback) {
98 NetworkProfiler::progCallback->
onProgress((
unsigned int) (++itr_count/((
float)(details_set.size()*2)) * 100.0) );
101 if (NetworkProfiler::progCallback) {
102 NetworkProfiler::progCallback->
onProgress(100);
112 for(itr = vertices.begin(); itr!=vertices.end(); itr++) {
121 mv1->property.find(
"hostname").asString());
128 for(itr = vertices.begin(); itr!=vertices.end(); itr++) {
136 pv1->property.find(
"hostname").asString());
142 for(itr = vertices.begin(); itr!=vertices.end(); itr++) {
149 for(eitr = outs.begin(); eitr!=outs.end(); eitr++) {
150 const Edge& e = (*eitr);
155 for(peitr = pouts.begin(); peitr!=pouts.end(); peitr++) {
156 const Vertex& p2 = (*peitr).second();
160 prop.
put(
"label", label);
199 if (level ==
"NORMAL") {
202 if (level ==
"LOW") {
205 if (level ==
"HIGH") {
208 if (level ==
"CRITIC") {
211 if (level ==
"INVALID") {
222 for(itr = vertices.begin(); itr!=vertices.end(); itr++) {
223 const Vertex &v1 = (**itr);
224 for(
const auto& i : v1.
outEdges()) {
260 Contact srcCon = Contact::fromString(portName);
263 yError()<<
"Cannot write to"<<portName;
280 Contact srcCon = Contact::fromString(portName);
283 yError()<<
"Cannot write to"<<portName;
302 Contact srcCon = Contact::fromString(portName);
305 yError()<<
"Cannot write to"<<portName;
308 if(reply.
size() > 1) {
327 Contact srcCon = Contact::fromString(portName);
330 yError()<<
"Cannot write to"<<portName;
333 if(param.
size() > 1) {
edge_set::const_iterator edge_const_iterator
pvertex_set::const_iterator pvertex_const_iterator
std::vector< yarp::profiler::graph::Vertex * > pvertex_set
pvertex_set::iterator pvertex_iterator
std::vector< yarp::profiler::graph::Edge > edge_set
A simple collection of objects that can be described and transmitted in a portable way.
void add(const Value &value)
Add a Value to the bottle, at the end of the list.
void fromString(const std::string &text)
Initializes bottle from a string.
size_type size() const
Gets the number of elements in the bottle.
Value & get(size_type index) const
Reads a Value v from a certain part of the list.
void addString(const char *str)
Places a string in the bottle, at the end of the list.
std::string toString() const override
Gives a human-readable textual representation of the bottle.
static bool getConnectionQos(const std::string &src, const std::string &dest, QosStyle &srcStyle, QosStyle &destStyle, bool quiet=true)
Gets the Qos preferences of a connection.
static bool write(const Contact &contact, PortWriter &cmd, PortReader &reply, bool admin=false, bool quiet=false, double timeout=-1)
Send a single command to a port and await a single response.
A class for storing options and configuration information.
Value & find(const std::string &key) const override
Gets a value corresponding to a given keyword.
std::string toString() const override
Return a standard text representation of the content of the object.
void put(const std::string &key, const std::string &value)
Associate the given key with the given string.
bool check(const std::string &key) const override
Check if there exists a property of the given name.
Preferences for the port's Quality of Service.
int getThreadPolicy() const
returns the communication thread scheduling policy
int getThreadPriority() const
returns the communication thread priority level
PacketPriorityLevel
The PacketPriorityLevel defines the packets quality of service (priority) levels.
PacketPriorityLevel getPacketPriorityAsLevel() const
returns the packet TOS value
virtual bool isString() const
Checks if value is a string.
virtual std::int32_t asInt32() const
Get 32-bit integer value.
virtual bool isInt32() const
Checks if value is a 32-bit integer.
virtual std::string asString() const
Get string value.
ports_detail_set::iterator ports_detail_iterator
std::vector< PortDetails > ports_detail_set
virtual void onProgress(unsigned int percentage)
static bool getPortmonitorParams(std::string portName, yarp::os::Bottle ¶m)
static std::string packetPrioToString(yarp::os::QosStyle::PacketPriorityLevel level)
static bool attachPortmonitorPlugin(std::string portName, yarp::os::Property pluginProp)
static bool updateConnectionQosStatus(yarp::profiler::graph::Graph &graph)
static bool setPortmonitorParams(std::string portName, yarp::os::Property ¶m)
static yarp::os::QosStyle::PacketPriorityLevel packetStringToPrio(std::string level)
static bool creatSimpleModuleGraph(yarp::profiler::graph::Graph &graph, yarp::profiler::graph::Graph &subgraph)
static bool detachPortmonitorPlugin(std::string portName)
The yarp::profiler::graph::Edge class.
const yarp::profiler::graph::Vertex & second() const
yarp::os::Property property
The yarp::profiler::graph::Graph class.
void insertEdge(const Vertex &v1, const Vertex &v2, const yarp::os::Property &property="")
const pvertex_set & vertices()
const pvertex_iterator find(const Vertex &v1)
pvertex_iterator insert(const Vertex &vertex)
bool setOwner(yarp::profiler::graph::Vertex *_owner)
The yarp::profiler::graph::Vertex class.
yarp::os::Property property
const edge_set & outEdges() const
An interface to the operating system, including Port based communication.
std::vector< ConnectedPortInfo > outputs
std::vector< ConnectedPortInfo > inputs
ProcessInfo owner_process
MachineInfo owner_machine