Eric Blake <ebl...@redhat.com> writes:

> On 09/25/2015 08:00 AM, Markus Armbruster wrote:
>> In preparation of finer grained throttling.
>> 
>> Signed-off-by: Markus Armbruster <arm...@redhat.com>
>> ---
>>  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 <ebl...@redhat.com>

Thanks!

Reply via email to