Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions | Variables
jiffies.h File Reference
#include <linux/math64.h>
#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/time.h>
#include <linux/timex.h>
#include <asm/param.h>

Go to the source code of this file.

Macros

#define SH_DIV(NOM, DEN, LSH)
 
#define LATCH   ((CLOCK_TICK_RATE + HZ/2) / HZ) /* For divider */
 
#define TICK_NSEC   ((NSEC_PER_SEC+HZ/2)/HZ)
 
#define TICK_USEC   ((1000000UL + USER_HZ/2) / USER_HZ)
 
#define __jiffy_data   __attribute__((section(".data")))
 
#define time_after(a, b)
 
#define time_before(a, b)   time_after(b,a)
 
#define time_after_eq(a, b)
 
#define time_before_eq(a, b)   time_after_eq(b,a)
 
#define time_in_range(a, b, c)
 
#define time_in_range_open(a, b, c)
 
#define time_after64(a, b)
 
#define time_before64(a, b)   time_after64(b,a)
 
#define time_after_eq64(a, b)
 
#define time_before_eq64(a, b)   time_after_eq64(b,a)
 
#define time_is_before_jiffies(a)   time_after(jiffies, a)
 
#define time_is_after_jiffies(a)   time_before(jiffies, a)
 
#define time_is_before_eq_jiffies(a)   time_after_eq(jiffies, a)
 
#define time_is_after_eq_jiffies(a)   time_before_eq(jiffies, a)
 
#define INITIAL_JIFFIES   ((unsigned long)(unsigned int) (-300*HZ))
 
#define MAX_JIFFY_OFFSET   ((LONG_MAX >> 1)-1)
 
#define SEC_JIFFIE_SC   (31 - SHIFT_HZ)
 
#define SEC_JIFFIE_SC   (32 - SHIFT_HZ)
 
#define NSEC_JIFFIE_SC   (SEC_JIFFIE_SC + 29)
 
#define USEC_JIFFIE_SC   (SEC_JIFFIE_SC + 19)
 
#define SEC_CONVERSION
 
#define NSEC_CONVERSION
 
#define USEC_CONVERSION
 
#define USEC_ROUND   (u64)(((u64)1 << USEC_JIFFIE_SC) - 1)
 
#define MAX_SEC_IN_JIFFIES   (long)((u64)((u64)MAX_JIFFY_OFFSET * TICK_NSEC) / NSEC_PER_SEC)
 
#define TIMESTAMP_SIZE   30
 

Functions

int register_refined_jiffies (long clock_tick_rate)
 
u64 get_jiffies_64 (void)
 
unsigned int jiffies_to_msecs (const unsigned long j)
 
unsigned int jiffies_to_usecs (const unsigned long j)
 
unsigned long msecs_to_jiffies (const unsigned int m)
 
unsigned long usecs_to_jiffies (const unsigned int u)
 
unsigned long timespec_to_jiffies (const struct timespec *value)
 
void jiffies_to_timespec (const unsigned long jiffies, struct timespec *value)
 
unsigned long timeval_to_jiffies (const struct timeval *value)
 
void jiffies_to_timeval (const unsigned long jiffies, struct timeval *value)
 
clock_t jiffies_to_clock_t (unsigned long x)
 
unsigned long clock_t_to_jiffies (unsigned long x)
 
u64 jiffies_64_to_clock_t (u64 x)
 
u64 nsec_to_clock_t (u64 x)
 
u64 nsecs_to_jiffies64 (u64 n)
 
unsigned long nsecs_to_jiffies (u64 n)
 

Variables

u64 __jiffy_data jiffies_64
 
unsigned long volatile __jiffy_data jiffies
 
unsigned long preset_lpj
 

Macro Definition Documentation

#define __jiffy_data   __attribute__((section(".data")))

Definition at line 69 of file jiffies.h.

#define INITIAL_JIFFIES   ((unsigned long)(unsigned int) (-300*HZ))

Definition at line 162 of file jiffies.h.

#define LATCH   ((CLOCK_TICK_RATE + HZ/2) / HZ) /* For divider */

Definition at line 55 of file jiffies.h.

#define MAX_JIFFY_OFFSET   ((LONG_MAX >> 1)-1)

Definition at line 176 of file jiffies.h.

#define MAX_SEC_IN_JIFFIES   (long)((u64)((u64)MAX_JIFFY_OFFSET * TICK_NSEC) / NSEC_PER_SEC)

Definition at line 280 of file jiffies.h.

#define NSEC_CONVERSION
Value:
((unsigned long)((((u64)1 << NSEC_JIFFIE_SC) +\

Definition at line 261 of file jiffies.h.

#define NSEC_JIFFIE_SC   (SEC_JIFFIE_SC + 29)

Definition at line 256 of file jiffies.h.

#define SEC_CONVERSION
Value:
((unsigned long)((((u64)NSEC_PER_SEC << SEC_JIFFIE_SC) +\

Definition at line 258 of file jiffies.h.

#define SEC_JIFFIE_SC   (31 - SHIFT_HZ)

Definition at line 254 of file jiffies.h.

#define SEC_JIFFIE_SC   (32 - SHIFT_HZ)

Definition at line 254 of file jiffies.h.

#define SH_DIV (   NOM,
  DEN,
  LSH 
)
Value:
( (((NOM) / (DEN)) << (LSH)) \
+ ((((NOM) % (DEN)) << (LSH)) + (DEN) / 2) / (DEN))

Definition at line 51 of file jiffies.h.

#define TICK_NSEC   ((NSEC_PER_SEC+HZ/2)/HZ)

Definition at line 60 of file jiffies.h.

#define TICK_USEC   ((1000000UL + USER_HZ/2) / USER_HZ)

Definition at line 63 of file jiffies.h.

#define time_after (   a,
  b 
)
Value:
(typecheck(unsigned long, a) && \
typecheck(unsigned long, b) && \
((long)(b) - (long)(a) < 0))

Definition at line 101 of file jiffies.h.

#define time_after64 (   a,
  b 
)
Value:
(typecheck(__u64, a) && \
typecheck(__u64, b) && \
((__s64)(b) - (__s64)(a) < 0))

Definition at line 130 of file jiffies.h.

#define time_after_eq (   a,
  b 
)
Value:
(typecheck(unsigned long, a) && \
typecheck(unsigned long, b) && \
((long)(a) - (long)(b) >= 0))

Definition at line 107 of file jiffies.h.

#define time_after_eq64 (   a,
  b 
)
Value:
(typecheck(__u64, a) && \
typecheck(__u64, b) && \
((__s64)(a) - (__s64)(b) >= 0))

Definition at line 136 of file jiffies.h.

#define time_before (   a,
  b 
)    time_after(b,a)

Definition at line 105 of file jiffies.h.

#define time_before64 (   a,
  b 
)    time_after64(b,a)

Definition at line 134 of file jiffies.h.

#define time_before_eq (   a,
  b 
)    time_after_eq(b,a)

Definition at line 111 of file jiffies.h.

#define time_before_eq64 (   a,
  b 
)    time_after_eq64(b,a)

Definition at line 140 of file jiffies.h.

#define time_in_range (   a,
  b,
  c 
)
Value:
time_before_eq(a,c))

Definition at line 116 of file jiffies.h.

#define time_in_range_open (   a,
  b,
  c 
)
Value:
time_before(a,c))

Definition at line 123 of file jiffies.h.

#define time_is_after_eq_jiffies (   a)    time_before_eq(jiffies, a)

Definition at line 156 of file jiffies.h.

#define time_is_after_jiffies (   a)    time_before(jiffies, a)

Definition at line 150 of file jiffies.h.

#define time_is_before_eq_jiffies (   a)    time_after_eq(jiffies, a)

Definition at line 153 of file jiffies.h.

#define time_is_before_jiffies (   a)    time_after(jiffies, a)

Definition at line 147 of file jiffies.h.

#define TIMESTAMP_SIZE   30

Definition at line 314 of file jiffies.h.

#define USEC_CONVERSION
Value:
((unsigned long)((((u64)NSEC_PER_USEC << USEC_JIFFIE_SC) +\

Definition at line 263 of file jiffies.h.

#define USEC_JIFFIE_SC   (SEC_JIFFIE_SC + 19)

Definition at line 257 of file jiffies.h.

#define USEC_ROUND   (u64)(((u64)1 << USEC_JIFFIE_SC) - 1)

Definition at line 273 of file jiffies.h.

Function Documentation

unsigned long clock_t_to_jiffies ( unsigned long  x)

Definition at line 586 of file time.c.

u64 get_jiffies_64 ( void  )

Definition at line 71 of file jiffies.c.

u64 jiffies_64_to_clock_t ( u64  x)

Definition at line 603 of file time.c.

clock_t jiffies_to_clock_t ( unsigned long  x)

Definition at line 572 of file time.c.

unsigned int jiffies_to_msecs ( const unsigned long  j)
inline

Definition at line 235 of file time.c.

void jiffies_to_timespec ( const unsigned long  jiffies,
struct timespec value 
)

Definition at line 514 of file time.c.

void jiffies_to_timeval ( const unsigned long  jiffies,
struct timeval value 
)

Definition at line 555 of file time.c.

unsigned int jiffies_to_usecs ( const unsigned long  j)
inline

Definition at line 251 of file time.c.

unsigned long msecs_to_jiffies ( const unsigned int  m)

Definition at line 428 of file time.c.

u64 nsec_to_clock_t ( u64  x)

Definition at line 625 of file time.c.

unsigned long nsecs_to_jiffies ( u64  n)

nsecs_to_jiffies - Convert nsecs in u64 to jiffies


: nsecs in u64

Unlike {m,u}secs_to_jiffies, type of input is not unsigned int but u64. And this doesn't return MAX_JIFFY_OFFSET since this function is designed for scheduler, not for use in device drivers to calculate timeout value.

note: NSEC_PER_SEC = 10^9 = (5^9 * 2^9) = (1953125 * 512) ULLONG_MAX ns = 18446744073.709551615 secs = about 584 years

Definition at line 684 of file time.c.

u64 nsecs_to_jiffies64 ( u64  n)

nsecs_to_jiffies64 - Convert nsecs in u64 to jiffies64


: nsecs in u64

Unlike {m,u}secs_to_jiffies, type of input is not unsigned int but u64. And this doesn't return MAX_JIFFY_OFFSET since this function is designed for scheduler, not for use in device drivers to calculate timeout value.

note: NSEC_PER_SEC = 10^9 = (5^9 * 2^9) = (1953125 * 512) ULLONG_MAX ns = 18446744073.709551615 secs = about 584 years

Definition at line 654 of file time.c.

int register_refined_jiffies ( long  clock_tick_rate)

Definition at line 101 of file jiffies.c.

unsigned long timespec_to_jiffies ( const struct timespec value)

Definition at line 497 of file time.c.

unsigned long timeval_to_jiffies ( const struct timeval value)

Definition at line 540 of file time.c.

unsigned long usecs_to_jiffies ( const unsigned int  u)

Definition at line 470 of file time.c.

Variable Documentation

unsigned long volatile __jiffy_data jiffies
u64 __jiffy_data jiffies_64
unsigned long preset_lpj

Definition at line 15 of file calibrate.c.