[PATCH] lib/tevent: Add trace point callback

Volker Lendecke Volker.Lendecke at SerNet.DE
Fri Jun 8 06:10:43 MDT 2012


On Fri, Jun 08, 2012 at 08:01:13AM -0400, simo wrote:
> On Fri, 2012-06-08 at 13:53 +0200, Volker Lendecke wrote: 
> > On Fri, Jun 08, 2012 at 07:36:10AM -0400, simo wrote:
> > > On Fri, 2012-06-08 at 13:32 +0200, Volker Lendecke wrote: 
> > > > On Fri, Jun 08, 2012 at 07:29:34AM -0400, simo wrote:
> > > > > I guess it would also be a good idea to inline
> > > > > tevent_trace_point_callback()
> > > > 
> > > > Are you sure? What about the branch prediction cache?
> > > 
> > > It really depends on how much this will end up being used.
> > > Perhaps right now it is not a big deal, but tracing functions have the
> > > bad habit of ending up being used in critical paths in the long run :)
> > 
> > Right. That's why I think there's a trade-off. How expensive
> > is calling a function vs a branch prediction miss? We have
> > an if-statement in that function that has the same outcome
> > throughout the whole program run. Do we benefit from a
> > correct branch prediction more than we do from a
> > non-executed call/return?
> 
> I am not sure I see your point, as it is the function call is always
> executed, the inline would remove that part. The if statement will
> always be executed (eventually branch predicted) but in the main
> function.

My understanding of the branch prediction cache and function
inlining might be wrong, so please excuse if I am talking
rubbish.

Function inlining if I understood it right makes a copy of
the function that is being called everywhere. This means
that we have the if-statement multiple times in the object
code. If I understood the branch prediction cache right, it
caches the result of an if-condition, indexed by instruction
pointer. If we have the if-condition multiple times due to
inlining, we pollute the cache more than we do when
executing the condition in one place.

If that understanding is wrong, please update my knowledge.

Thanks,

Volker

-- 
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de, mailto:kontakt at sernet.de


More information about the samba-technical mailing list