[Click] Question on cycle counts

Bobby Longpocket bobbylongpocket at yahoo.com
Sat Feb 5 15:43:38 EST 2011


Hi Harald,

My guess is that there is a problem with how you are calculating the average per-packet cycle counts.

Note that the FromDevice task can run more than once per packet, and it won't call ToHost every time it is run.  If you look at the total cycle counts, is FromDevice task cycles larger than ToHost call cycles?

Regards,
BBL

--- On Sat, 2/5/11, Harald Schioeberg <harald at net.t-labs.tu-berlin.de> wrote:

> From: Harald Schioeberg <harald at net.t-labs.tu-berlin.de>
> Subject: [Click] Question on cycle counts
> To: "click" <click at pdos.csail.mit.edu>
> Date: Saturday, February 5, 2011, 2:14 AM
> Hi, 
> 
> Why does FromDevice->_task_cycles not include the cycles
> spend in ToHost
> in this config: 
> FromDevice -> ToHost 
> 
> When checking cpu-cyclecounts with --enable-stats=2 
> (x68_64,,somewhat recent click-git on 2.6.24.7 kernel with
> patches,
> opteron 1210 with tsc locked to cpu-clock),
> 
> I'm getting these average cycle-counts per packet: 
> 
> FromDevice: 
> task 2380
> 
> ToHost
> self 4800
> child 0 
> 
> No, when looking at the code, this is what I believe should
> happen:
> 
> Task::fire(FromDevice) 
> 
> task.hh:574 initialize the start_cycles reference 
>   click_cycles_t start_cycles = click_get_cycles();
> 
> task.hh:582 Element->run_task is called
> 
> FromDevice::run_task
> fromdevice.cc:389      output(0).push
> called
> 
>   Element::Port::push relevant part verbatim:
> 
>     click_cycles_t c0 = click_get_cycles();
>     _e->push(_port, p);
>     click_cycles_t x = click_get_cycles() - c0;
>     ++_e->_calls;
>     _e->_self_cycles += x;
>   
>     ok, now we have recorded the ~4800 ToHost
> cycles...
> 
> then return to task.hh
> task.hh:593 
>    _owner->_task_cycles +=
> click_get_cycles() - start_cycles;
> 
> this records only the 2380 task cycles.... why? 
> 
> IMHO: the _task_cycles variable should count all cycles,
> also the ones
> spend in the callee... But it apparently does not. 
> And the source says 
> element.hh:
>   click_cycles_t _task_cycles;    // Cycles
> spent in self from tasks.
> That seems to be the case... why only self???
> 
> Can somebody please explain the underlying magic to me?
> 
> Thanks
>     Harald
> 
> 
> _______________________________________________
> click mailing list
> click at amsterdam.lcs.mit.edu
> https://amsterdam.lcs.mit.edu/mailman/listinfo/click
> 


      



More information about the click mailing list