[Click] PUSH processed element with timer not working

muralidharan at tce.edu muralidharan at tce.edu
Mon Feb 7 02:14:56 EST 2011


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



More information about the click mailing list