From: "Denis V. Lunev" <den@openvz.org>
To: Eric Blake <eblake@redhat.com>
Cc: Markus Armbruster <armbru@redhat.com>,
Luiz Capitulino <lcapitulino@redhat.com>,
qemu-devel@nongnu.org, Pavel Butsykin <pbutsykin@virtuozzo.com>
Subject: Re: [Qemu-devel] [PATCH 1/1] log hmp/qmp command
Date: Mon, 12 Oct 2015 16:58:20 +0300 [thread overview]
Message-ID: <561BBC7C.1020401@openvz.org> (raw)
In-Reply-To: <561BBA5C.6050505@redhat.com>
On 10/12/2015 04:49 PM, Eric Blake wrote:
> On 10/12/2015 02:41 AM, Denis V. Lunev wrote:
>> From: Pavel Butsykin <pbutsykin@virtuozzo.com>
>>
>> This log would be very welcome for long-term diagnostics of the system
>> in the production. This log is at least necessary to understand what
>> has been happened on the system and to identify issues at higher-level
>> subsystems (libvirt, etc).
>>
>> Signed-off-by: Pavel Butsykin <pbutsykin@virtuozzo.com>
>> Signed-off-by: Denis V. Lunev <den@openvz.org>
>> CC: Markus Armbruster <armbru@redhat.com>
>> CC: Luiz Capitulino <lcapitulino@redhat.com>
>> CC: Eric Blake <eblake@redhat.com>
>> ---
>> @@ -3822,6 +3824,8 @@ static void handle_qmp_command(JSONMessageParser *parser, QList *tokens)
>> error_setg(&local_err, QERR_JSON_PARSING);
>> goto err_out;
>> }
>> + qemu_log_mask(LOG_CMD, "qmp \"%s\" requested\n",
>> + qobject_to_json(obj)->string);
>>
> In addition to the leak already pointed out, qobject_to_json() can be
> expensive, and it looks like we are doing that work unconditionally even
> if the logging is not turned on. Is there a way to optimize so that the
> conversion is only done when logging is enabled?
>
this seems quite reasonable.
Will it be good if we'll change logging implementation to
use macros, something like
#define qemu_log_mask(int mask, const char *ftp, ...) \
do { \
va_list ap; \
\
if (!(qemu_loglevel & mask) || !qemu_logfile) {\
break;\
}\
qemu_log(ftp, __VA_ARGS__); \
} while (0)
This IMHO makes sense even out of the scope of this patch.
Den
next prev parent reply other threads:[~2015-10-12 13:58 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-12 8:41 [Qemu-devel] [PATCH 1/1] log hmp/qmp command Denis V. Lunev
2015-10-12 9:54 ` Denis V. Lunev
2015-10-12 13:49 ` Eric Blake
2015-10-12 13:58 ` Denis V. Lunev [this message]
2015-10-13 13:05 ` Luiz Capitulino
2015-10-13 13:18 ` Denis V. Lunev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=561BBC7C.1020401@openvz.org \
--to=den@openvz.org \
--cc=armbru@redhat.com \
--cc=eblake@redhat.com \
--cc=lcapitulino@redhat.com \
--cc=pbutsykin@virtuozzo.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.