[Click] Question on cycle counts

Harald Schioeberg harald at net.t-labs.tu-berlin.de
Sat Feb 5 17:05:15 EST 2011


On Sat, 2011-02-05 at 12:43 -0800, Bobby Longpocket wrote:
> 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?

will double-check that tomorrow, thanks for the hint. 
on the other hand, I'm using ( cycles / calls) from the respective
element; this script runs in /click/ElementName/ : 

avg_cycles.pl:
#!/usr/bin/perl -w

use strict; 

open C, ">cycles"; 
print C "reset\n"; 
close C; 

while (1) { 
    open C, "<cycles"; 
    while (<C>) { 
       my @f = split /\s/; 
       if ($f[0] eq "tasks" || $f[0] eq "timers") {
           print $f[0]." ".$f[2]/$f[1]."\n"; 
       }else { 
           print "self ".$f[1]/$f[0]."\n";
           print "child ".$f[2]/$f[0]."\n";
       } 

    }  
    close C; 
    sleep 1; 
} 

for reference: /click/ElementName/cycles is filled by lib/element.cc:

String
Element::read_cycles_handler(Element *e, void *)
{
    StringAccum sa;
    if (e->_calls)
	sa << e->_calls << ' ' << e->_self_cycles << ' '
	   << e->_child_cycles << '\n';
    if (e->_task_calls)
	sa << "tasks " << e->_task_calls << ' ' << e->_task_cycles << "\n";
    if (e->_timer_calls)
	sa << "timers " << e->_timer_calls << ' ' << e->_timer_cycles << "\n";
    return sa.take_string();
}




More information about the click mailing list