qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [RFC 4/6] monitor: Turn monitor_qapi_event_state[] into


From: Markus Armbruster
Subject: Re: [Qemu-devel] [RFC 4/6] monitor: Turn monitor_qapi_event_state[] into a hash table
Date: Mon, 28 Sep 2015 10:32:29 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Eric Blake <address@hidden> writes:

> On 09/25/2015 08:00 AM, Markus Armbruster wrote:
>> In preparation of finer grained throttling.
>> 
>> Signed-off-by: Markus Armbruster <address@hidden>
>> ---
>>  monitor.c | 55 ++++++++++++++++++++++++++++++++++++++-----------------
>>  1 file changed, 38 insertions(+), 17 deletions(-)
>> 
>
>> @@ -512,6 +518,14 @@ monitor_qapi_event_queue(QAPIEvent event, QDict *qdict, 
>> Error **errp)
>>              int64_t now = qemu_clock_get_ns(QEMU_CLOCK_REALTIME);
>>  
>>              monitor_qapi_event_emit(event, qdict);
>> +
>> +            evstate = g_new(MonitorQAPIEventState, 1);
>> +            evstate->event = event;
>> +            evstate->qdict = NULL;
>> +            evstate->timer = timer_new_ns(QEMU_CLOCK_REALTIME,
>> +                                          monitor_qapi_event_handler,
>> +                                          evstate);
>
> Now timers are created and destroyed dynamically upon use rather than
> reused and just waiting to be rearmed; I hope there aren't any obvious
> inefficiencies from doing that.

I hope there aren't any unobvious inefficienies!  :)

If I read qemu-timer.c correctly, creating and destroying timers is
cheap.

Hmm, looks like I'm missing a timer_del() before timer_free().

> The conversion looks sane:
> Reviewed-by: Eric Blake <address@hidden>

Thanks!



reply via email to

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