[Click] PUSH processed element with timer not working

Beyers Cronje bcronje at gmail.com
Mon Feb 7 05:12:42 EST 2011


Post us your config file as well please.

On Mon, Feb 7, 2011 at 9:14 AM, <muralidharan at tce.edu> wrote:

> Hi,
> i wrote a pull processed element with timer to periodically reset a
> integer counter (the no. of packets encountered) to zero. The problem is
> that the push() method is never executed. the code is as follows
>
> Time::Time()
>    : _interval(0, Timestamp::subsec_per_sec / 2),
>      _count(0), _active(true), _timer(this)
> {
> }
>
> Time::~Time()
> {
> }
>
> int
> Time::configure(Vector<String> &conf, ErrorHandler *errh)
> {
>  if (cp_va_kparse(conf, this, errh,
>                   "INTERVAL", cpkP, cpTimestamp, &_interval,
>                   "ACTIVE", 0, cpBool, &_active,
>                    cpEnd) < 0)
>    return -1;
>
> }
>
> int
> Time::initialize(ErrorHandler *)
> {
>  _timer.initialize(this);
>  if (_active)
>    _timer.schedule_after(_interval);
>  return 0;
> }
>
> void
> Time::run_timer(Timer *)
> {
>  click_chatter("Timer activated and count=%d\ncounter reset",counter);
>  counter=0;
>  _timer.reschedule_after(_interval);
>        //do i need to call push() again here?. If so how?. this.push();???
> }
>
> void
> Time::push(int , Packet *p)
> {
>  click_chatter("push() executer");
>  counter+=1;
>  output(0).push(p);
> }
>
> output goes like this (one iteration every _interval seconds)
> Timer activated and count=0
> counter reset
> Timer activated and count=0
> counter reset
> Timer activated and count=0
> counter reset
> Timer activated and count=0
> counter reset
> Timer activated and count=0
> counter reset
> Timer activated and count=0
> counter reset
>
> I really need the push() method to be executed BETWEEN each run_timer()
> schedule.
>
> how do i do that?.
>
> Thanks in advance.
> Murali Dharan
>
>
> -----------------------------------------
> This email was sent using TCEMail Service.
> Thiagarajar College of Engineering
> Madurai-625 015, India
>
> _______________________________________________
> click mailing list
> click at amsterdam.lcs.mit.edu
> https://amsterdam.lcs.mit.edu/mailman/listinfo/click
>


More information about the click mailing list