[PATCH] tevent patches

Stefan (metze) Metzmacher metze at samba.org
Tue Mar 18 01:27:32 MDT 2014

Hi Amitay,

I thought about the topic a it more...

A while ago I found that
tevent_debug(te->event_ctx, TEVENT_DEBUG_TRACE, ...)
is a bit of a performance problem.

I think we could move that into a tracing handler
and make it optional.

In order to make this work, we would need to pass pointers to
the specific event.

What about having new functions instead of reusing
tevent_set_trace_callback(), e.g.
tevent_fd_set_trace_callback, tevent_timer_set_trace_callback, ...

We also need to keep tevent_trace_point_callback() as function call
in order to keep external backends working.

What do you think?

> I have now two separate implementations.
> 1. Based on my initial patch set.  This one just adds calls to trace
> callbacks in various places.  This adds a small cost when tracing is
> disabled.  However, this patchset is least intrusive and does not change
> any ABI.
> http://git.samba.org/?p=amitay/samba.git;a=shortlog;h=refs/heads/tevent-wip
> 2. Second approach maintains zero additional cost when tracing is
> disabled.  This approach provides mechanisms for enabling/disabling tracing
> for individual events.  So it's much more fine grained control over
> tracing. This one uses the wrapper functions to get/set callback
> handler/data, so the implementation can be changed to call backend specific
> functions when they are added.
> http://git.samba.org/?p=amitay/samba.git;a=shortlog;h=refs/heads/tevent-wip2
> These are two extremes.  We probably want something in the middle.  I guess
> we can go ahead with first approach for now.  When we decide to change the
> ABI, use some of the elements from the second approach.
> Amitay.
> On Fri, Feb 28, 2014 at 11:44 PM, Stefan (metze) Metzmacher <metze at samba.org
>> wrote:
>> Am 28.02.2014 12:41, schrieb Volker Lendecke:
>>> On Fri, Feb 28, 2014 at 10:26:32AM +0100, Stefan (metze) Metzmacher
>> wrote:
>>>> The problem I have with this is that this costs much more than
>>>> the first patchset for the most performance critical users
>>>> smbd and ctdbd. A additional talloc() call per event registration
>>>> costs a lot more than a function call to a noop function.
>>> What about adding the tevent_trace_handler_data at the end
>>> of the tevent structures in case they are needed and play
>>> some offsetof magic in case the additional memory used is a
>>> concern if the trace points are not needed?
>> Yes, I think we can just add them into the structures, but that would be
>> an incompatible change, which I'd like to avoid for now.
>> Adding this information at tevent_add_fd() time would make things like
>> turning tracing on and off at runtime, similar to 'smbcontrol debug',
>> impossible.
>> Maybe specifying the desired tracepoints after tevent_set_trace_callback()
>> would be better.
>> metze

More information about the samba-technical mailing list