Fast-DDS icon indicating copy to clipboard operation
Fast-DDS copied to clipboard

Messages per second from Custom listener [5685]

Open Jimmy316 opened this issue 7 years ago • 4 comments

Is it possible to get the number of messages received per second on a given topic using the custom listener.

-- Jimmy

Jimmy316 avatar Jun 18 '19 00:06 Jimmy316

Hi Any update on this request

Thanks

Jimmy316 avatar Aug 28 '19 14:08 Jimmy316

Each subscriber has a single topic associated; thus, the SubscriberListener interface provided on creation will receive a:

    virtual void onNewDataMessage(Subscriber* sub)

callback each time a message on this topic is received from whatever publishers this subscriber has discovered.

There is no delay between message reception and the corresponding callback. If you want to calculate the rate of reception I'm afraid you will have to do the math yourself by generating a collection of reception times.

MiguelBarro avatar Sep 03 '19 06:09 MiguelBarro

I was hoping I can get this using the EDP Reader which lists the number of publisher and subscribers that are active per topic. Then it can be used for diagnostics - I already have something similar in my application.

Jimmy316 avatar Sep 03 '19 15:09 Jimmy316

EDP only can help you reporting how many publishers and subscribers deal with a given topic. It doesn't provide any user traffic info. You don't need EDP to know the publisher associated with a given sample.

When you create a subscriber for a given topic it matches all publishers which share topic with him (and have compatible QoS). Then you are forced to use either:

bool Subscriber::readNextData(void* data,SampleInfo_t* info)
bool Subscriber::takeNextData(void* data,SampleInfo_t* info)

to retrieve the samples. In both cases the info argument sample_identity member provides you the GUID_t from this sample publisher. That allows you to calculate the message rate for each individual publisher of the topic of interest.

MiguelBarro avatar Sep 05 '19 05:09 MiguelBarro