qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2 1/1] monitor: improve tracing in handle_qmp_c


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH v2 1/1] monitor: improve tracing in handle_qmp_command
Date: Tue, 25 Jul 2017 09:44:25 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1

On 07/25/2017 09:39 AM, Denis V. Lunev wrote:
> Calculate req_json only if trace_handle_qmp_command enabled.
> 
> Signed-off-by: Denis V. Lunev <address@hidden>
> CC: Stefan Hajnoczi <address@hidden>
> CC: LluĂ­s Vilanova <address@hidden>
> CC: Dr. David Alan Gilbert <address@hidden>
> CC: Markus Armbruster <address@hidden>
> ---
> Changes from v1:
> - written in the explicit for, as discussed in the mailing list

I could live with this being considered a bug-fix for 2.10, as we
regressed in speed/memory usage during normal untraced QMP commands.

Reviewed-by: Eric Blake <address@hidden>

> 
>  monitor.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/monitor.c b/monitor.c
> index d8ac20f6ca..2bfeb9bbcc 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -3822,7 +3822,6 @@ static void handle_qmp_command(JSONMessageParser 
> *parser, GQueue *tokens)
>      QDict *qdict = NULL;
>      Monitor *mon = cur_mon;
>      Error *err = NULL;
> -    QString *req_json;
>  
>      req = json_parser_parse_err(tokens, NULL, &err);
>      if (!req && !err) {
> @@ -3840,9 +3839,11 @@ static void handle_qmp_command(JSONMessageParser 
> *parser, GQueue *tokens)
>          qdict_del(qdict, "id");
>      } /* else will fail qmp_dispatch() */
>  
> -    req_json = qobject_to_json(req);
> -    trace_handle_qmp_command(mon, qstring_get_str(req_json));
> -    qobject_decref(QOBJECT(req_json));
> +    if (trace_event_get_state(TRACE_HANDLE_QMP_COMMAND)) {
> +        QString *req_json = qobject_to_json(req);
> +        trace_handle_qmp_command(mon, qstring_get_str(req_json));
> +        qobject_decref(QOBJECT(req_json));
> +    }
>  
>      rsp = qmp_dispatch(cur_mon->qmp.commands, req);
>  
> 

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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