Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
hrtimer.c File Reference
#include <linux/cpu.h>
#include <linux/export.h>
#include <linux/percpu.h>
#include <linux/hrtimer.h>
#include <linux/notifier.h>
#include <linux/syscalls.h>
#include <linux/kallsyms.h>
#include <linux/interrupt.h>
#include <linux/tick.h>
#include <linux/seq_file.h>
#include <linux/err.h>
#include <linux/debugobjects.h>
#include <linux/sched.h>
#include <linux/timer.h>
#include <asm/uaccess.h>
#include <trace/events/timer.h>

Go to the source code of this file.

Macros

#define switch_hrtimer_base(t, b, p)   (b)
 

Functions

 DEFINE_PER_CPU (struct hrtimer_cpu_base, hrtimer_bases)
 
ktime_t ktime_add_ns (const ktime_t kt, u64 nsec)
 
 EXPORT_SYMBOL_GPL (ktime_add_ns)
 
ktime_t ktime_sub_ns (const ktime_t kt, u64 nsec)
 
 EXPORT_SYMBOL_GPL (ktime_sub_ns)
 
u64 ktime_divns (const ktime_t kt, s64 div)
 
ktime_t ktime_add_safe (const ktime_t lhs, const ktime_t rhs)
 
 EXPORT_SYMBOL_GPL (ktime_add_safe)
 
void clock_was_set (void)
 
void hrtimers_resume (void)
 
u64 hrtimer_forward (struct hrtimer *timer, ktime_t now, ktime_t interval)
 
 EXPORT_SYMBOL_GPL (hrtimer_forward)
 
int __hrtimer_start_range_ns (struct hrtimer *timer, ktime_t tim, unsigned long delta_ns, const enum hrtimer_mode mode, int wakeup)
 
int hrtimer_start_range_ns (struct hrtimer *timer, ktime_t tim, unsigned long delta_ns, const enum hrtimer_mode mode)
 
 EXPORT_SYMBOL_GPL (hrtimer_start_range_ns)
 
int hrtimer_start (struct hrtimer *timer, ktime_t tim, const enum hrtimer_mode mode)
 
 EXPORT_SYMBOL_GPL (hrtimer_start)
 
int hrtimer_try_to_cancel (struct hrtimer *timer)
 
 EXPORT_SYMBOL_GPL (hrtimer_try_to_cancel)
 
int hrtimer_cancel (struct hrtimer *timer)
 
 EXPORT_SYMBOL_GPL (hrtimer_cancel)
 
ktime_t hrtimer_get_remaining (const struct hrtimer *timer)
 
 EXPORT_SYMBOL_GPL (hrtimer_get_remaining)
 
void hrtimer_init (struct hrtimer *timer, clockid_t clock_id, enum hrtimer_mode mode)
 
 EXPORT_SYMBOL_GPL (hrtimer_init)
 
int hrtimer_get_res (const clockid_t which_clock, struct timespec *tp)
 
 EXPORT_SYMBOL_GPL (hrtimer_get_res)
 
void hrtimer_run_pending (void)
 
void hrtimer_run_queues (void)
 
void hrtimer_init_sleeper (struct hrtimer_sleeper *sl, struct task_struct *task)
 
 EXPORT_SYMBOL_GPL (hrtimer_init_sleeper)
 
long __sched hrtimer_nanosleep_restart (struct restart_block *restart)
 
long hrtimer_nanosleep (struct timespec *rqtp, struct timespec __user *rmtp, const enum hrtimer_mode mode, const clockid_t clockid)
 
 SYSCALL_DEFINE2 (nanosleep, struct timespec __user *, rqtp, struct timespec __user *, rmtp)
 
void __init hrtimers_init (void)
 
int __sched schedule_hrtimeout_range_clock (ktime_t *expires, unsigned long delta, const enum hrtimer_mode mode, int clock)
 
int __sched schedule_hrtimeout_range (ktime_t *expires, unsigned long delta, const enum hrtimer_mode mode)
 
 EXPORT_SYMBOL_GPL (schedule_hrtimeout_range)
 
int __sched schedule_hrtimeout (ktime_t *expires, const enum hrtimer_mode mode)
 
 EXPORT_SYMBOL_GPL (schedule_hrtimeout)
 

Macro Definition Documentation

#define switch_hrtimer_base (   t,
  b,
  p 
)    (b)

Definition at line 250 of file hrtimer.c.

Function Documentation

int __hrtimer_start_range_ns ( struct hrtimer timer,
ktime_t  tim,
unsigned long  delta_ns,
const enum hrtimer_mode  mode,
int  wakeup 
)

Definition at line 956 of file hrtimer.c.

void clock_was_set ( void  )

Definition at line 759 of file hrtimer.c.

DEFINE_PER_CPU ( struct hrtimer_cpu_base  ,
hrtimer_bases   
)
EXPORT_SYMBOL_GPL ( ktime_add_ns  )
EXPORT_SYMBOL_GPL ( ktime_sub_ns  )
EXPORT_SYMBOL_GPL ( ktime_add_safe  )
EXPORT_SYMBOL_GPL ( hrtimer_forward  )
EXPORT_SYMBOL_GPL ( hrtimer_start_range_ns  )
EXPORT_SYMBOL_GPL ( hrtimer_start  )
EXPORT_SYMBOL_GPL ( hrtimer_try_to_cancel  )
EXPORT_SYMBOL_GPL ( hrtimer_cancel  )
EXPORT_SYMBOL_GPL ( hrtimer_get_remaining  )
EXPORT_SYMBOL_GPL ( hrtimer_init  )
EXPORT_SYMBOL_GPL ( hrtimer_get_res  )
EXPORT_SYMBOL_GPL ( hrtimer_init_sleeper  )
EXPORT_SYMBOL_GPL ( schedule_hrtimeout_range  )
EXPORT_SYMBOL_GPL ( schedule_hrtimeout  )
int hrtimer_cancel ( struct hrtimer timer)

hrtimer_cancel - cancel a timer and wait for the handler to finish. : the timer to be cancelled

Returns: 0 when the timer was not active 1 when the timer was active

Definition at line 1078 of file hrtimer.c.

u64 hrtimer_forward ( struct hrtimer timer,
ktime_t  now,
ktime_t  interval 
)

hrtimer_forward - forward the timer expiry : hrtimer to forward : forward past this time : the interval to forward

Forward the timer expiry so it will expire in the future. Returns the number of overruns.

Definition at line 827 of file hrtimer.c.

ktime_t hrtimer_get_remaining ( const struct hrtimer timer)

hrtimer_get_remaining - get remaining time for the timer : the timer to read

Definition at line 1094 of file hrtimer.c.

int hrtimer_get_res ( const clockid_t  which_clock,
struct timespec tp 
)

hrtimer_get_res - get the timer resolution for a clock : which clock to query : pointer to timespec variable to store the resolution

Store the resolution of the clock selected by in the variable pointed to by .

Definition at line 1195 of file hrtimer.c.

void hrtimer_init ( struct hrtimer timer,
clockid_t  clock_id,
enum hrtimer_mode  mode 
)

hrtimer_init - initialize a timer to the given clock : the timer to be initialized : the clock to be used : timer mode abs/rel

Definition at line 1179 of file hrtimer.c.

void hrtimer_init_sleeper ( struct hrtimer_sleeper sl,
struct task_struct task 
)

Definition at line 1507 of file hrtimer.c.

long hrtimer_nanosleep ( struct timespec rqtp,
struct timespec __user rmtp,
const enum hrtimer_mode  mode,
const clockid_t  clockid 
)

Definition at line 1580 of file hrtimer.c.

long __sched hrtimer_nanosleep_restart ( struct restart_block restart)

Definition at line 1553 of file hrtimer.c.

void hrtimer_run_pending ( void  )

Definition at line 1435 of file hrtimer.c.

void hrtimer_run_queues ( void  )

Definition at line 1455 of file hrtimer.c.

int hrtimer_start ( struct hrtimer timer,
ktime_t  tim,
const enum hrtimer_mode  mode 
)

hrtimer_start - (re)start an hrtimer on the current CPU : the timer to be added : expiry time : expiry mode: absolute (HRTIMER_ABS) or relative (HRTIMER_REL)

Returns: 0 on success 1 when the timer was active

Definition at line 1035 of file hrtimer.c.

int hrtimer_start_range_ns ( struct hrtimer timer,
ktime_t  tim,
unsigned long  delta_ns,
const enum hrtimer_mode  mode 
)

hrtimer_start_range_ns - (re)start an hrtimer on the current CPU : the timer to be added : expiry time : "slack" range for the timer : expiry mode: absolute (HRTIMER_ABS) or relative (HRTIMER_REL)

Returns: 0 on success 1 when the timer was active

Definition at line 1017 of file hrtimer.c.

int hrtimer_try_to_cancel ( struct hrtimer timer)

hrtimer_try_to_cancel - try to deactivate a timer : hrtimer to stop

Returns: 0 when the timer was not active 1 when the timer was active -1 when the timer is currently excuting the callback function and cannot be stopped

Definition at line 1052 of file hrtimer.c.

void __init hrtimers_init ( void  )

Definition at line 1758 of file hrtimer.c.

void hrtimers_resume ( void  )

Definition at line 772 of file hrtimer.c.

ktime_t ktime_add_ns ( const ktime_t  kt,
u64  nsec 
)

ktime_add_ns - Add a scalar nanoseconds value to a ktime_t variable : addend : the scalar nsec value to add

Returns the sum of kt and nsec in ktime_t format

Definition at line 267 of file hrtimer.c.

ktime_t ktime_add_safe ( const ktime_t  lhs,
const ktime_t  rhs 
)

Definition at line 333 of file hrtimer.c.

u64 ktime_divns ( const ktime_t  kt,
s64  div 
)

Definition at line 312 of file hrtimer.c.

ktime_t ktime_sub_ns ( const ktime_t  kt,
u64  nsec 
)

ktime_sub_ns - Subtract a scalar nanoseconds value from a ktime_t variable : minuend : the scalar nsec value to subtract

Returns the subtraction of from in ktime_t format

Definition at line 291 of file hrtimer.c.

int __sched schedule_hrtimeout ( ktime_t expires,
const enum hrtimer_mode  mode 
)

schedule_hrtimeout - sleep until timeout : timeout value (ktime_t) : timer mode, HRTIMER_MODE_ABS or HRTIMER_MODE_REL

Make the current task sleep until the given expiry time has elapsed. The routine will return immediately unless the current task state has been set (see set_current_state()).

You can set the task state as follows -

TASK_UNINTERRUPTIBLE - at least time is guaranteed to pass before the routine returns.

TASK_INTERRUPTIBLE - the routine may return early if a signal is delivered to the current task.

The current task state is guaranteed to be TASK_RUNNING when this routine returns.

Returns 0 when the timer has expired otherwise -EINTR

Definition at line 1877 of file hrtimer.c.

int __sched schedule_hrtimeout_range ( ktime_t expires,
unsigned long  delta,
const enum hrtimer_mode  mode 
)

schedule_hrtimeout_range - sleep until timeout : timeout value (ktime_t) : slack in expires timeout (ktime_t) : timer mode, HRTIMER_MODE_ABS or HRTIMER_MODE_REL

Make the current task sleep until the given expiry time has elapsed. The routine will return immediately unless the current task state has been set (see set_current_state()).

The argument gives the kernel the freedom to schedule the actual wakeup to a time that is both power and performance friendly. The kernel give the normal best effort behavior for "@expires+@delta", but may decide to fire the timer earlier, but no earlier than .

You can set the task state as follows -

TASK_UNINTERRUPTIBLE - at least time is guaranteed to pass before the routine returns.

TASK_INTERRUPTIBLE - the routine may return early if a signal is delivered to the current task.

The current task state is guaranteed to be TASK_RUNNING when this routine returns.

Returns 0 when the timer has expired otherwise -EINTR

Definition at line 1847 of file hrtimer.c.

int __sched schedule_hrtimeout_range_clock ( ktime_t expires,
unsigned long  delta,
const enum hrtimer_mode  mode,
int  clock 
)

schedule_hrtimeout_range_clock - sleep until timeout : timeout value (ktime_t) : slack in expires timeout (ktime_t) : timer mode, HRTIMER_MODE_ABS or HRTIMER_MODE_REL : timer clock, CLOCK_MONOTONIC or CLOCK_REALTIME

Definition at line 1776 of file hrtimer.c.

SYSCALL_DEFINE2 ( nanosleep  ,
struct timespec __user ,
rqtp  ,
struct timespec __user ,
rmtp   
)

Definition at line 1621 of file hrtimer.c.