61 #ifndef _INCLUDE_CLOCK_H 64 #define _INCLUDE_CLOCK_H 70 #include <tinyara/config.h> 72 #include <sys/types.h> 76 #include <tinyara/compiler.h> 97 #undef __HAVE_KERNEL_GLOBALS 98 #if defined(CONFIG_SCHED_TICKLESS) 101 #elif defined(CONFIG_BUILD_PROTECTED) && defined(__KERNEL__) 104 #define __HAVE_KERNEL_GLOBALS 1 106 #elif defined(CONFIG_BUILD_KERNEL) && defined(__KERNEL__) 109 #define __HAVE_KERNEL_GLOBALS 1 111 #elif defined(CONFIG_LIB_SYSCALL) 117 #define __HAVE_KERNEL_GLOBALS 1 124 #ifndef CONFIG_HAVE_LONG_LONG 125 #undef CONFIG_SYSTEM_TIME64 130 #define NSEC_PER_SEC 1000000000 131 #define USEC_PER_SEC 1000000 132 #define MSEC_PER_SEC 1000 133 #define DSEC_PER_SEC 10 134 #define NSEC_PER_DSEC 100000000 135 #define USEC_PER_DSEC 100000 136 #define MSEC_PER_DSEC 100 137 #define NSEC_PER_MSEC 1000000 138 #define USEC_PER_MSEC 1000 139 #define NSEC_PER_USEC 1000 155 #ifdef CONFIG_USEC_PER_TICK 156 #define USEC_PER_TICK (CONFIG_USEC_PER_TICK) 158 #define USEC_PER_TICK (10000) 166 #define TICK_PER_DSEC (USEC_PER_DSEC / USEC_PER_TICK) 167 #define TICK_PER_SEC (USEC_PER_SEC / USEC_PER_TICK) 168 #define TICK_PER_MSEC (USEC_PER_MSEC / USEC_PER_TICK) 169 #define MSEC_PER_TICK (USEC_PER_TICK / USEC_PER_MSEC) 170 #define NSEC_PER_TICK (USEC_PER_TICK * NSEC_PER_USEC) 172 #define NSEC2TICK(nsec) (((nsec)+(NSEC_PER_TICK/2))/NSEC_PER_TICK) 173 #define USEC2TICK(usec) (((usec)+(USEC_PER_TICK/2))/USEC_PER_TICK) 175 #if (MSEC_PER_TICK * USEC_PER_MSEC) == USEC_PER_TICK 176 #define MSEC2TICK(msec) (((msec)+(MSEC_PER_TICK/2))/MSEC_PER_TICK) 178 #define MSEC2TICK(msec) USEC2TICK((msec) * USEC_PER_MSEC) 181 #define DSEC2TICK(dsec) MSEC2TICK((dsec) * MSEC_PER_DSEC) 182 #define SEC2TICK(sec) MSEC2TICK((sec) * MSEC_PER_SEC) 184 #define TICK2NSEC(tick) ((tick) * NSEC_PER_TICK) 185 #define TICK2USEC(tick) ((tick) * USEC_PER_TICK) 187 #if (MSEC_PER_TICK * USEC_PER_MSEC) == USEC_PER_TICK 188 #define TICK2MSEC(tick) ((tick)*MSEC_PER_TICK) 190 #define TICK2MSEC(tick) (((tick)*USEC_PER_TICK)/USEC_PER_MSEC) 193 #define TICK2DSEC(tick) (((tick)+(TICK_PER_DSEC/2))/TICK_PER_DSEC) 194 #define TICK2SEC(tick) (((tick)+(TICK_PER_SEC/2))/TICK_PER_SEC) 201 #ifdef CONFIG_SCHED_CPULOAD 203 volatile uint32_t total;
204 volatile uint32_t active;
207 #ifdef CONFIG_SCHED_MULTI_CPULOAD 208 #define SCHED_NCPULOAD 3 210 #define SCHED_NCPULOAD 1 219 #define EXTERN extern "C" 222 #define EXTERN extern 232 #ifdef __HAVE_KERNEL_GLOBALS 235 #ifndef CONFIG_SYSTEM_TIME64 236 #define clock_systimer() g_system_timer 277 void clock_synchronize(
void);
305 #if !defined(__HAVE_KERNEL_GLOBALS) || defined(CONFIG_SYSTEM_TIME64) 338 int clock_systimespec(FAR
struct timespec *ts);
362 #ifdef CONFIG_SCHED_CPULOAD 367 int clock_cpuload(
int pid,
int index, FAR
struct cpuload_s *cpuload);
EXTERN volatile clock_t g_system_timer
structure represents an elapsed time