Commit Graph

21 Commits

Author SHA1 Message Date
Xiang Xiao
f0c5c75042 sched/clock/: Don't call up_timer_gettime in clock_gettime and clock_systimer to ensure the return value from them consistent with clock_systimespec 2018-11-12 06:52:56 -06:00
Xiang Xiao
46bd8798c5 ched/clock/: Remove g_monotonic_basetime and g_clock_monotonic_time since we don't need ensure monotonic time start from zero as state here: http://pubs.opengroup.org/onlinepubs/009696899/functions/clock_getres.html 2018-11-12 06:50:37 -06:00
Gregory Nutt
8fdbb1e0a4 Elimate use of the non-standard type systime_t and replace it the equivalent, standard type clock_t
Squashed commit of the following:

    sched:  Rename all use of system_t to clock_t.
    syscall:  Rename all use of system_t to clock_t.
    net:  Rename all use of system_t to clock_t.
    libs:  Rename all use of system_t to clock_t.
    fs:  Rename all use of system_t to clock_t.
    drivers:  Rename all use of system_t to clock_t.
    arch:  Rename all use of system_t to clock_t.
    include:  Remove definition of systime_t; rename all use of system_t to clock_t.
2018-06-16 12:16:13 -06:00
Gregory Nutt
06e7533bb0 Update some comments. 2018-03-14 08:17:50 -06:00
Gregory Nutt
b54ffe858a Standardization of some function headers. 2018-03-13 09:52:27 -06:00
Gregory Nutt
7cf88d7dbd Make sure that labeling is used consistently in all function headers. 2018-02-01 10:00:02 -06:00
Gregory Nutt
e238c8b090 sched/clock/clock_systimer.c: Change the way that the 64-bit time is sampled. Previously, we disabled interrupts before sampling the 64-bit timer since the uint64_t access is not atomic on most CPUs. However, disabling (local) interrupts does not work in the SMP case. In that case, the timer interrupt will be running on only one of the CPUs; disabling interrupts on a different CPU will provide no protection from timer rollover. To work around this, logic was added that samples 64-bit timer is sampled twice and if 32-bit rollover was detected between samples, then loops until there is no rollover. 2018-01-15 11:05:45 -06:00
Masayuki Ishikawa
0ecef4dbcb clock_systimer: Replace critical section APIs with spinlock APIs. (64bit only)
If SMP=n or SMP=y && SPINLOCK_IRQ=n, this works in the same way as before.
If SMP=y && SPINLOCK_IRQ=y, performance will be improved.

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2018-01-15 15:08:11 +09:00
Rajan Gill
0d8e191d69 sched/clock: Correct calculation for the case of Tickless mode with a 32-bit timer. In that case, the calculation was returning millisecond accuracy. That is not good when the timer accuracy is < 1 msec. 2016-11-19 09:55:21 -06:00
Gregory Nutt
246773faa7 Rename CONFIG_SCHED_TIMEKEEPING to CONFIG_CLOCK_TIMEKEEPING. That is a better compartmentalized name. 2016-07-11 06:54:02 -06:00
Max Neklyudov
8db29071da timekeeping: initial implementation 2016-07-10 16:14:25 -06:00
Gregory Nutt
6e3107650d nuttx/sched: Replace irqsave() with enter_critical_section(); replace irqrestore() with leave_critical_section() 2016-02-14 08:17:46 -06:00
Gregory Nutt
84d4cb007b clock_systimer: 64-bit timer accesses are not atomic. Noted by Freddie Chopin. 2016-01-22 12:24:36 -06:00
Gregory Nutt
032ad1b70b Remove clock_systimer32 and clock_systimer64. There is now only clock_systimer 2016-01-21 16:49:24 -06:00
Gregory Nutt
a4f5254cbe Fix a typo introduced into the last commit 2016-01-21 13:48:35 -06:00
Gregory Nutt
f348e68069 Update to use 64-bit timer when available 2016-01-21 11:54:26 -06:00
Gregory Nutt
d9f960e97b Fix a problem in clock_systimer64 that occurs when (1) the 64-bit system time is enabled, and (2) the value of CONFIG_USEC_PER_TICK is less than 1 millisconds (such as when using the tickless mode of operation). In that case, the convertion of time to 64-bit millisecond value in clock_systmer64() causes some bad times to be returned. Time was converted to milliseconds, then to configured ticks. Precision was lost in the millisecond convertion.
The fix is to first convert time to a 64-bit microsecond value, then to the configured tick value.

Noted by David Sidrane.
2015-02-13 06:13:47 -06:00
Gregory Nutt
da29907ac9 Update TODO list + cosmetic changes to clock_systimer.c 2014-10-03 11:21:35 -06:00
Gregory Nutt
8d43a6bdcd Fix build error with CONFIG_SYSTEM_TIME64 2014-10-03 10:20:46 -06:00
Gregory Nutt
2029236ed0 Back out and replace recent kludges for errno and clock_systimer. There is a cleaner way 2014-08-30 14:26:56 -06:00
Gregory Nutt
d4b56eb3cc Move clock functions from sched/ to sched/clock 2014-08-08 14:43:02 -06:00