qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 0/2] improve tracing


From: Philippe Mathieu-Daudé
Subject: Re: [Qemu-devel] [PATCH 0/2] improve tracing
Date: Mon, 24 Jul 2017 13:24:07 -0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1

On 07/24/2017 09:17 AM, Denis V. Lunev wrote:
On 07/24/2017 02:34 PM, Stefan Hajnoczi wrote:
On Fri, Jul 21, 2017 at 05:31:47PM +0300, Vladimir Sementsov-Ogievskiy wrote:
Current trace system have a drawback: parameters of trace functions
are calculated even if corresponding tracepoint is disabled. Also, it
looks like trace function are not actually inlined by compiler (at
least for me).

Here is a fix proposal: move from function call to macros. Patch 02
is an example, of how to reduce extra calculations with help of
patch 01.

Vladimir Sementsov-Ogievskiy (2):
   trace: do not calculate arguments for disabled trace-points
   monitor: improve tracing in handle_qmp_command
Please use the TRACE_FOO_ENABLED macro instead of putting computation
inside the trace event arguments.  This makes the code cleaner and
easier to read.
At our opinion this ENABLED is compile time check while the option
could be tuned in runtime. Thus normally it would normally be
enabled while the trace is silent.

So, under load, we will have extra allocation, copying the command buffer,
freeing memory without actual trace. In order to fix that we should
do something like

if (trace_event_get_state(TRACE_HANDLE_QMP_COMMAND)) {
    req_json = qobject_to_json(req);
    trace_handle_qmp_command(mon, req_json);
    QDECREF(req_json);
}

which is possible, but at our (me + Vova) opinion is ugly.

It seems to me much cleaner/easier to read than your patch, I really prefer this way. It is so nice/useful that it deserves to be starred as an example in docs/devel/tracing.txt :)

That is why we are proposing to switch to macro, which
will not require such tweaking.

Arguments will be only evaluated when necessary and we
will not have side-effects if the tracepoint is compile time
enabled and run-time disabled.

Though if the code above is acceptable, we can send the
patch with it. No problem.

Den



reply via email to

[Prev in Thread] Current Thread [Next in Thread]