Received: from eggs.gnu.org ([2001:4830:134:3::10]:57377) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZgTrQ-0003uY-Oi for qemu-devel@nongnu.org; Mon, 28 Sep 2015 04:32:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZgTrN-0001Tb-J3 for qemu-devel@nongnu.org; Mon, 28 Sep 2015 04:32:36 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53541) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZgTrN-0001TP-Ee for qemu-devel@nongnu.org; Mon, 28 Sep 2015 04:32:33 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id 4D447461C2 for ; Mon, 28 Sep 2015 08:32:32 +0000 (UTC) From: Markus Armbruster References: <1443189647-11417-1-git-send-email-armbru@redhat.com> <1443189647-11417-5-git-send-email-armbru@redhat.com> <56059ED3.3030902@redhat.com> Date: Mon, 28 Sep 2015 10:32:29 +0200 In-Reply-To: <56059ED3.3030902@redhat.com> (Eric Blake's message of "Fri, 25 Sep 2015 13:21:55 -0600") Message-ID: <874miflzaa.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [RFC 4/6] monitor: Turn monitor_qapi_event_state[] into a hash table List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: amit.shah@redhat.com, marcandre.lureau@redhat.com, lersek@redhat.com, qemu-devel@nongnu.org Eric Blake writes: > On 09/25/2015 08:00 AM, Markus Armbruster wrote: >> In preparation of finer grained throttling. >> >> Signed-off-by: Markus Armbruster >> --- >> 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 Thanks!