qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [RFC] [PATCHv8 12/30] aio / timers: aio_ctx_prepare set


From: Alex Bligh
Subject: Re: [Qemu-devel] [RFC] [PATCHv8 12/30] aio / timers: aio_ctx_prepare sets timeout from AioContext timers
Date: Fri, 9 Aug 2013 15:55:42 +0100

On 9 Aug 2013, at 15:41, Paolo Bonzini wrote:

> It would just be these five lines of code, no?
> 
>    for (type = 0; type < QEMU_CLOCK_MAX; type++) {
>        if (qemu_clock_use_for_deadline(qemu_clock_ptr(type))) {
>            deadline = qemu_soonest_timeout(deadline,
>                                            
> timerlist_deadline_ns(ctx->timerlist[type]));
>        }
>    }
> 
> I'm not sure if it is a worthwhile to keep 80 lines of code just to
> abstract a single loop.

It's actually this code in the final version (rather than the elastoplast
version)

int64_t timerlistgroup_deadline_ns(QEMUTimerListGroup tlg)
{
    int64_t deadline = -1;
    QEMUClockType type;
    for (type = 0; type < QEMU_CLOCK_MAX; type++) {
        if (qemu_clock_use_for_deadline(tlg[type]->clock->type)) {
            deadline = qemu_soonest_timeout(deadline,
                                            timerlist_deadline_ns(tlg[type]));
        }
    }
    return deadline;
}

which looks right into the clock struct. It's the same 5-ish lines of code
whether it's in qemu-timer.c or async.c so I don't think you'd save anything
either way. The 80 or so lines of tlg code is still going to be needed
in AioContext.

As I've said, is not that I'm against putting the tlg array in the AioContext
per se, it's that I'm against doing it now.

-- 
Alex Bligh







reply via email to

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