qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] Use clock_gettime() on OpenBSD


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH] Use clock_gettime() on OpenBSD
Date: Sat, 30 Mar 2013 09:04:28 +0000

On 30 March 2013 06:25, Brad Smith <address@hidden> wrote:
> init_get_clock() already indicates to get_clock() to utilize
> clock_gettime() with a monotonic clock but OpenBSD was missing
> from the list of OS's to use a monotonic clock on.
>
> What I don't understand is why is init_get_clock() not called
> anywhere?

It's marked as a constructor so the C runtime will call it.

> diff --git a/include/qemu/timer.h b/include/qemu/timer.h
> index 1766b2d..8b86fa5 100644
> --- a/include/qemu/timer.h
> +++ b/include/qemu/timer.h
> @@ -118,7 +118,8 @@ extern int use_rt_clock;
>  static inline int64_t get_clock(void)
>  {
>  #if defined(__linux__) || (defined(__FreeBSD__) && __FreeBSD_version >= 
> 500000) \
> -    || defined(__DragonFly__) || defined(__FreeBSD_kernel__)
> +    || defined(__DragonFly__) || defined(__FreeBSD_kernel__) \
> +    || defined(__OpenBSD__)
>      if (use_rt_clock) {
>          struct timespec ts;
>          clock_gettime(CLOCK_MONOTONIC, &ts);

Rather than extending this already long OS dependent #if,
could you write a configure test for whatever we're using
and then just have a simple #ifdef CONFIG_WHATEVER ?

thanks
-- PMM



reply via email to

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