[Click] Question on cycle counts
Harald Schioeberg
harald at net.t-labs.tu-berlin.de
Sat Feb 5 05:14:02 EST 2011
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
More information about the click
mailing list