EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024  Index 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: Jenkins test failures on macOS
From: "Johnson, Andrew N. via Core-talk" <core-talk at aps.anl.gov>
To: Michael Davidsaver <mdavidsaver at gmail.com>
Cc: EPICS core-talk <core-talk at aps.anl.gov>
Date: Tue, 4 Aug 2020 16:09:13 +0000
On Aug 3, 2020, at 9:37 PM, Michael Davidsaver <mdavidsaver at gmail.com> wrote:

On 8/3/20 6:07 PM, Johnson, Andrew N. wrote:
No. I get non-zero milli- and microseconds in my time stamps now, but (counting after the decimal point) digits 7 through 9 of a %.9f seconds value are always zero.

Ok, then this seems likely to be no worse that Windows.
Out of curiosity, have you checked (eg. with epicsTimerTest)
to see what the minimum delta actually is?

In the Github issue yesterday I explained that on my laptop reading the time using the Mach clock_get_time() API takes about 1.6 microseconds and gives nanosecond precision, whereas using clock_gettime() takes only about 58 nanoseconds but gives microsecond precision (as averaged over 100000 readings by epicsTimeTest). Which is better?

Truncating to microseconds makes me wonder if this is really
just wrapping gettimeofday().

It likely is using the same mechanism underneath. I assume that if you ask the Mach kernel for the accurate time the clock_get_time() API has to do a system call which takes a long time, whereas there is some other mechanism which doesn’t require a context switch to provide a lower resolution time-stamp for the other APIs.

Interesting, I just noticed the clocks listed on the Darwin manpage for clock_gettime(), which says exactly that for CLOCK_REALTIME:

     clock_id can be a value from one of 8 predefined values:

     CLOCK_REALTIME     the system's real time (i.e. wall time) clock,
                        expressed as the amount of time since the Epoch.  This
                        is the same as the value returned by gettimeofday(2).

     CLOCK_MONOTONIC    clock that increments monotonically, tracking the time
                        since an arbitrary point, and will continue to incre-
                        ment while the system is asleep.

     CLOCK_MONOTONIC_RAW
                        clock that increments monotonically, tracking the time
                        since an arbitrary point like CLOCK_MONOTONIC.  How-
                        ever, this clock is unaffected by frequency or time
                        adjustments.  It should not be compared to other sys-
                        tem time sources.

     CLOCK_MONOTONIC_RAW_APPROX
                        like CLOCK_MONOTONIC_RAW, but reads a value cached by
                        the system at context switch.  This can be read
                        faster, but at a loss of accuracy as it may return
                        values that are milliseconds old.

There are others for uptime, process and thread that I omitted. It might be interesting measuring how long it takes to read each of these, which would be done by counting the max number of times you can read it and get exactly the same time and divide the time increment by that max count. Linux has some _COARSE clocks that are similarly faster to read:

       CLOCK_REALTIME
              System-wide  clock  that  measures real (i.e., wall-clock) time.
              Setting this clock requires appropriate privileges.  This  clock
              is  affected by discontinuous jumps in the system time (e.g., if
              the system administrator manually changes the clock), and by the
              incremental adjustments performed by adjtime(3) and NTP.

       CLOCK_REALTIME_COARSE (since Linux 2.6.32; Linux-specific)
              A  faster  but less precise version of CLOCK_REALTIME.  Use when
              you need very fast, but not fine-grained timestamps.

       CLOCK_MONOTONIC
              Clock that cannot be set and  represents  monotonic  time
              since some unspecified starting point.  This clock is not
              affected by discontinuous jumps in the system time (e.g.,
              if  the system administrator manually changes the clock),
              but is affected by the incremental adjustments  performed
              by adjtime(3) and NTP.

       CLOCK_MONOTONIC_COARSE (since Linux 2.6.32; Linux-specific)
              A  faster  but  less  precise version of CLOCK_MONOTONIC.
              Use when you need very fast, but not  fine-grained  time‐
              stamps.

       CLOCK_MONOTONIC_RAW (since Linux 2.6.28; Linux-specific)
              Similar  to CLOCK_MONOTONIC, but provides access to a raw
              hardware-based time that is not subject  to  NTP  adjust‐
              ments  or  the  incremental adjustments performed by adj‐
              time(3).

- Andrew

-- 
Complexity comes for free, simplicity you have to work for.


Replies:
Re: Jenkins test failures on macOS Michael Davidsaver via Core-talk
References:
Jenkins build became unstable: epics-7.0 » mac #245 APS Jenkins via Core-talk
Jenkins test failures on macOS Johnson, Andrew N. via Core-talk
Re: Jenkins test failures on macOS Michael Davidsaver via Core-talk
Re: Jenkins test failures on macOS Johnson, Andrew N. via Core-talk
Re: Jenkins test failures on macOS Michael Davidsaver via Core-talk

Navigate by Date:
Prev: Build failed: EPICS Base 7 base-7.0-58 AppVeyor via Core-talk
Next: Re: Jenkins test failures on macOS Michael Davidsaver via Core-talk
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024 
Navigate by Thread:
Prev: Re: Jenkins test failures on macOS Michael Davidsaver via Core-talk
Next: Re: Jenkins test failures on macOS Michael Davidsaver via Core-talk
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024 
ANJ, 04 Aug 2020 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·