[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[altq 903] Re: Kernel profiling and ALTQ




Nicolas Christin wrote:
> > if_simloop() is in sys/net/if_loop.c.  It is used to receive packets
> > sent to itself (e.g., broadcast packets).
> 
> 	This makes sense since I was running a test on the loopback 
> interface. However, shouldn't I have also seen some calls to 
> hfsc_enqueue() and such? Maybe this has to do with the synchronization 
> problem you mentioned above (if interrupts the call to hfsc_enqueue() is 
> made by a clock interrupt, and if hfsc_enqueue() itself does not allow 
> for interrupts, I can see why it doesn't appear in the list). In fact, 
> to specify my problem a little bit further, I was wondering if there was 
> an actual way of measuring the time spent in hfsc_enqueue() or 
> hfsc_dequeue() since these are the functions for which I'm trying to 
> assess the computational complexity...

A possible way is to collect timestamps at the entrance and the exit
of the target function and save them in a preallocated buffer.

On i386, you can read the Pentium TSC (TimeStamp Counter) register.

#include <machine/cpufunc.h>

u_int64_t tstamp[TS_SIZE];

	if (i < TS_SIZE)
		tstamp[i++] = rdtsc();

-Kenjiro