qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v9 5/7] monitor: remove event_clock_type


From: Peter Xu
Subject: Re: [Qemu-devel] [PATCH v9 5/7] monitor: remove event_clock_type
Date: Fri, 8 Jun 2018 11:54:04 +0800
User-agent: Mutt/1.9.5 (2018-04-13)

On Thu, Jun 07, 2018 at 04:32:54PM +0200, Markus Armbruster wrote:
> Peter Xu <address@hidden> writes:
> 
> > Instead, use a dynamic function to detect which clock we'll use.  The
> > problem is that the old code will let monitor initialization depends on
> > qtest_enabled().  After this change, we don't have such a dependency any
> > more.
> >
> > Suggested-by: Markus Armbruster <address@hidden>
> > Signed-off-by: Peter Xu <address@hidden>
> > ---
> >  monitor.c | 21 ++++++++++++---------
> >  1 file changed, 12 insertions(+), 9 deletions(-)
> >
> > diff --git a/monitor.c b/monitor.c
> > index 2504696d76..bd9ab5597f 100644
> > --- a/monitor.c
> > +++ b/monitor.c
> > @@ -282,8 +282,6 @@ QmpCommandList qmp_commands, 
> > qmp_cap_negotiation_commands;
> >  
> >  Monitor *cur_mon;
> >  
> > -static QEMUClockType event_clock_type = QEMU_CLOCK_REALTIME;
> > -
> >  static void monitor_command_cb(void *opaque, const char *cmdline,
> >                                 void *readline_opaque);
> >  
> > @@ -310,6 +308,15 @@ static inline bool 
> > monitor_is_hmp_non_interactive(const Monitor *mon)
> >      return !monitor_is_qmp(mon) && !monitor_uses_readline(mon);
> >  }
> >  
> > +static inline QEMUClockType monitor_get_clock(void)
> > +{
> > +    if (qtest_enabled()) {
> > +        return QEMU_CLOCK_VIRTUAL;
> > +    } else {
> > +        return QEMU_CLOCK_REALTIME;
> > +    }
> 
> Suggest the more laconic
> 
>        return qtest_enabled() ? QEMU_CLOCK_VIRTUAL : QEMU_CLOCK_REALTIME;
> 
> A comment explaining why we want QEMU_CLOCK_VIRTUAL would be nice.

Will do.

-- 
Peter Xu



reply via email to

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