sched/clock: call up_timer_gettime() to get higher resolution
Signed-off-by: ligd <liguiding1@xiaomi.com>
This commit is contained in:
parent
90870ae62e
commit
1463a49396
4 changed files with 7 additions and 22 deletions
|
@ -334,10 +334,6 @@ extern "C"
|
||||||
|
|
||||||
#ifdef __HAVE_KERNEL_GLOBALS
|
#ifdef __HAVE_KERNEL_GLOBALS
|
||||||
EXTERN volatile clock_t g_system_ticks;
|
EXTERN volatile clock_t g_system_ticks;
|
||||||
|
|
||||||
# ifndef CONFIG_SYSTEM_TIME64
|
|
||||||
# define clock_systime_ticks() g_system_ticks
|
|
||||||
# endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
@ -695,9 +691,7 @@ void clock_resynchronize(FAR struct timespec *rtc_diff);
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#if !defined(__HAVE_KERNEL_GLOBALS) || defined(CONFIG_SYSTEM_TIME64)
|
|
||||||
clock_t clock_systime_ticks(void);
|
clock_t clock_systime_ticks(void);
|
||||||
#endif
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: clock_systime_timespec
|
* Name: clock_systime_timespec
|
||||||
|
|
|
@ -56,7 +56,7 @@
|
||||||
* Public Data
|
* Public Data
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#if !defined(CONFIG_SCHED_TICKLESS) && !defined(__HAVE_KERNEL_GLOBALS)
|
#if !defined(__HAVE_KERNEL_GLOBALS)
|
||||||
/* The system clock exists (CONFIG_SCHED_TICKLESS), but it not prototyped
|
/* The system clock exists (CONFIG_SCHED_TICKLESS), but it not prototyped
|
||||||
* globally in include/nuttx/clock.h.
|
* globally in include/nuttx/clock.h.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -85,19 +85,13 @@ clock_t clock_systime_ticks(void)
|
||||||
|
|
||||||
clock_systime_timespec(&ts);
|
clock_systime_timespec(&ts);
|
||||||
return clock_time2ticks(&ts);
|
return clock_time2ticks(&ts);
|
||||||
#elif defined(CONFIG_SCHED_TICKLESS_TICK_ARGUMENT)
|
#elif defined(CONFIG_ALARM_ARCH) || \
|
||||||
|
defined(CONFIG_TIMER_ARCH) || \
|
||||||
|
defined(CONFIG_SCHED_TICKLESS)
|
||||||
clock_t ticks = 0;
|
clock_t ticks = 0;
|
||||||
|
|
||||||
up_timer_gettick(&ticks);
|
up_timer_gettick(&ticks);
|
||||||
return ticks;
|
return ticks;
|
||||||
#elif defined(CONFIG_SCHED_TICKLESS)
|
|
||||||
struct timespec ts =
|
|
||||||
{
|
|
||||||
0
|
|
||||||
};
|
|
||||||
|
|
||||||
up_timer_gettime(&ts);
|
|
||||||
return clock_time2ticks(&ts);
|
|
||||||
#elif defined(CONFIG_SYSTEM_TIME64)
|
#elif defined(CONFIG_SYSTEM_TIME64)
|
||||||
clock_t sample;
|
clock_t sample;
|
||||||
clock_t verify;
|
clock_t verify;
|
||||||
|
|
|
@ -77,12 +77,9 @@ int clock_systime_timespec(FAR struct timespec *ts)
|
||||||
ts->tv_sec = 0;
|
ts->tv_sec = 0;
|
||||||
ts->tv_nsec = 0;
|
ts->tv_nsec = 0;
|
||||||
}
|
}
|
||||||
#elif defined(CONFIG_SCHED_TICKLESS_TICK_ARGUMENT)
|
#elif defined(CONFIG_ALARM_ARCH) || \
|
||||||
clock_t ticks = 0;
|
defined(CONFIG_TIMER_ARCH) || \
|
||||||
|
defined(CONFIG_SCHED_TICKLESS)
|
||||||
up_timer_gettick(&ticks);
|
|
||||||
clock_ticks2time(ts, ticks);
|
|
||||||
#elif defined(CONFIG_SCHED_TICKLESS)
|
|
||||||
up_timer_gettime(ts);
|
up_timer_gettime(ts);
|
||||||
#else
|
#else
|
||||||
clock_ticks2time(ts, g_system_ticks);
|
clock_ticks2time(ts, g_system_ticks);
|
||||||
|
|
Loading…
Reference in a new issue