[Click] How to read queueLen and packetCount from code?

Tilak, Bhaskar A batila at essex.ac.uk
Thu Jul 7 05:53:48 EDT 2011


Hello Group,

Seeking help in following work related to click modular router.
I am running it in userlevel. I am trying to read the queue length
and packet count;  I have already done this using
script in click config file but now I want to do it from the code. 
I have following configuration.

fw[2] -> Queue(1000) -> outc::Counter() -> ToDevice(eth0);

 66         par.queue = output(2).element();
 67         par.h = (Handler *)router()->handler(par.queue,"length");
 68         click_chatter("count = %u", par.count);
 69         par.count = par.queue->output(0).element();
 70         click_chatter("count = %u", par.count);
 71         click_chatter("name of the element = %s", par.count->name().c_str());
 72         if (par.count)
 73         par.hc = (Handler *)router()->handler(par.count,"count");

In the forwarder (fw = forwarder) initialise function, at line 66 I get the address of
 queue connected to port 2 of fw & at 67 install the handler.
I try to use same trick on queue element to get an address of counter but it
returns me 0 as I checked that an output port of queue is not active.

I also trying forcing the initialization of forwarder late using
CONFIGURE_PHASE_LAST but it didnt work.

Is there any way I can get address of counter and install handler OR

Any other way for reading queue length and packet count in the code, because
I want to read these values every 10 second and send it to the central node.

Thanks,
- Bhaskar.



More information about the click mailing list