Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions
hrtimer.h File Reference
#include <linux/rbtree.h>
#include <linux/ktime.h>
#include <linux/init.h>
#include <linux/list.h>
#include <linux/wait.h>
#include <linux/percpu.h>
#include <linux/timer.h>
#include <linux/timerqueue.h>

Go to the source code of this file.

Data Structures

struct  hrtimer
 
struct  hrtimer_sleeper
 
struct  hrtimer_clock_base
 
struct  hrtimer_cpu_base
 

Macros

#define HRTIMER_STATE_INACTIVE   0x00
 
#define HRTIMER_STATE_ENQUEUED   0x01
 
#define HRTIMER_STATE_CALLBACK   0x02
 
#define HRTIMER_STATE_MIGRATE   0x04
 
#define MONOTONIC_RES_NSEC   LOW_RES_NSEC
 
#define KTIME_MONOTONIC_RES   KTIME_LOW_RES
 

Enumerations

enum  hrtimer_mode {
  HRTIMER_MODE_ABS = 0x0, HRTIMER_MODE_REL = 0x1, HRTIMER_MODE_PINNED = 0x02, HRTIMER_MODE_ABS_PINNED = 0x02,
  HRTIMER_MODE_REL_PINNED = 0x03
}
 
enum  hrtimer_restart { HRTIMER_NORESTART, HRTIMER_RESTART }
 
enum  hrtimer_base_type { HRTIMER_BASE_MONOTONIC, HRTIMER_BASE_REALTIME, HRTIMER_BASE_BOOTTIME, HRTIMER_MAX_CLOCK_BASES }
 

Functions

void clock_was_set (void)
 
void hrtimers_resume (void)
 
ktime_t ktime_get (void)
 
ktime_t ktime_get_real (void)
 
ktime_t ktime_get_boottime (void)
 
ktime_t ktime_get_monotonic_offset (void)
 
ktime_t ktime_get_update_offsets (ktime_t *offs_real, ktime_t *offs_boot)
 
 DECLARE_PER_CPU (struct tick_device, tick_cpu_device)
 
void hrtimer_init (struct hrtimer *timer, clockid_t which_clock, enum hrtimer_mode mode)
 
int hrtimer_start (struct hrtimer *timer, ktime_t tim, const enum hrtimer_mode mode)
 
int hrtimer_start_range_ns (struct hrtimer *timer, ktime_t tim, unsigned long range_ns, const enum hrtimer_mode mode)
 
int __hrtimer_start_range_ns (struct hrtimer *timer, ktime_t tim, unsigned long delta_ns, const enum hrtimer_mode mode, int wakeup)
 
int hrtimer_cancel (struct hrtimer *timer)
 
int hrtimer_try_to_cancel (struct hrtimer *timer)
 
ktime_t hrtimer_get_remaining (const struct hrtimer *timer)
 
int hrtimer_get_res (const clockid_t which_clock, struct timespec *tp)
 
ktime_t hrtimer_get_next_event (void)
 
u64 hrtimer_forward (struct hrtimer *timer, ktime_t now, ktime_t interval)
 
long hrtimer_nanosleep (struct timespec *rqtp, struct timespec __user *rmtp, const enum hrtimer_mode mode, const clockid_t clockid)
 
long hrtimer_nanosleep_restart (struct restart_block *restart_block)
 
void hrtimer_init_sleeper (struct hrtimer_sleeper *sl, struct task_struct *tsk)
 
int schedule_hrtimeout_range (ktime_t *expires, unsigned long delta, const enum hrtimer_mode mode)
 
int schedule_hrtimeout_range_clock (ktime_t *expires, unsigned long delta, const enum hrtimer_mode mode, int clock)
 
int schedule_hrtimeout (ktime_t *expires, const enum hrtimer_mode mode)
 
void hrtimer_run_queues (void)
 
void hrtimer_run_pending (void)
 
void __init hrtimers_init (void)
 
u64 ktime_divns (const ktime_t kt, s64 div)
 
void sysrq_timer_list_show (void)
 

Macro Definition Documentation

#define HRTIMER_STATE_CALLBACK   0x02

Definition at line 82 of file hrtimer.h.

#define HRTIMER_STATE_ENQUEUED   0x01

Definition at line 81 of file hrtimer.h.

#define HRTIMER_STATE_INACTIVE   0x00

Definition at line 80 of file hrtimer.h.

#define HRTIMER_STATE_MIGRATE   0x04

Definition at line 83 of file hrtimer.h.

#define KTIME_MONOTONIC_RES   KTIME_LOW_RES

Definition at line 296 of file hrtimer.h.

#define MONOTONIC_RES_NSEC   LOW_RES_NSEC

Definition at line 295 of file hrtimer.h.

Enumeration Type Documentation

Enumerator:
HRTIMER_BASE_MONOTONIC 
HRTIMER_BASE_REALTIME 
HRTIMER_BASE_BOOTTIME 
HRTIMER_MAX_CLOCK_BASES 

Definition at line 156 of file hrtimer.h.

Enumerator:
HRTIMER_MODE_ABS 
HRTIMER_MODE_REL 
HRTIMER_MODE_PINNED 
HRTIMER_MODE_ABS_PINNED 
HRTIMER_MODE_REL_PINNED 

Definition at line 33 of file hrtimer.h.

Enumerator:
HRTIMER_NORESTART 
HRTIMER_RESTART 

Definition at line 44 of file hrtimer.h.

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.

DECLARE_PER_CPU ( struct tick_device  ,
tick_cpu_device   
)
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_next_event ( void  )
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 tsk 
)

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 hrtimer_nanosleep_restart ( struct restart_block restart_block)

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.

u64 ktime_divns ( const ktime_t  kt,
s64  div 
)

Definition at line 312 of file hrtimer.c.

ktime_t ktime_get ( void  )

Definition at line 249 of file timekeeping.c.

ktime_t ktime_get_boottime ( void  )

ktime_get_boottime - Returns monotonic time since boot in a ktime

Returns the monotonic time since boot in a ktime

This is similar to CLOCK_MONTONIC/ktime_get, but also includes the time spent in suspend.

Definition at line 1231 of file timekeeping.c.

ktime_t ktime_get_monotonic_offset ( void  )

ktime_get_monotonic_offset() - get wall_to_monotonic in ktime_t format

Definition at line 1369 of file timekeeping.c.

ktime_t ktime_get_real ( void  )

ktime_get_real - get the real (wall-) time in ktime_t format

returns the time in ktime_t format

Definition at line 487 of file timekeeping.c.

ktime_t ktime_get_update_offsets ( ktime_t offs_real,
ktime_t offs_boot 
)
int 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 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 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.

void sysrq_timer_list_show ( void  )

Definition at line 275 of file timer_list.c.