diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2010-05-25 04:48:51 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2010-06-09 04:34:49 -0400 |
commit | c676329abb2b8359d9a5d734dec0c81779823fd6 (patch) | |
tree | b6c33715176221a87100228399c2a6f5049e44ea /include/linux/sched.h | |
parent | 95ae3c59fa8ad616c73745e21154b5af0fb10168 (diff) |
sched_clock: Add local_clock() API and improve documentation
For people who otherwise get to write: cpu_clock(smp_processor_id()),
there is now: local_clock().
Also, as per suggestion from Andrew, provide some documentation on
the various clock interfaces, and minimize the unsigned long long vs
u64 mess.
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Jens Axboe <jaxboe@fusionio.com>
LKML-Reference: <1275052414.1645.52.camel@laptop>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include/linux/sched.h')
-rw-r--r-- | include/linux/sched.h | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index edc3dd168d87..c2d4316a04bb 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -1791,20 +1791,23 @@ static inline int set_cpus_allowed(struct task_struct *p, cpumask_t new_mask) | |||
1791 | #endif | 1791 | #endif |
1792 | 1792 | ||
1793 | /* | 1793 | /* |
1794 | * Architectures can set this to 1 if they have specified | 1794 | * Do not use outside of architecture code which knows its limitations. |
1795 | * CONFIG_HAVE_UNSTABLE_SCHED_CLOCK in their arch Kconfig, | 1795 | * |
1796 | * but then during bootup it turns out that sched_clock() | 1796 | * sched_clock() has no promise of monotonicity or bounded drift between |
1797 | * is reliable after all: | 1797 | * CPUs, use (which you should not) requires disabling IRQs. |
1798 | * | ||
1799 | * Please use one of the three interfaces below. | ||
1798 | */ | 1800 | */ |
1799 | #ifdef CONFIG_HAVE_UNSTABLE_SCHED_CLOCK | ||
1800 | extern int sched_clock_stable; | ||
1801 | #endif | ||
1802 | |||
1803 | /* ftrace calls sched_clock() directly */ | ||
1804 | extern unsigned long long notrace sched_clock(void); | 1801 | extern unsigned long long notrace sched_clock(void); |
1802 | /* | ||
1803 | * See the comment in kernel/sched_clock.c | ||
1804 | */ | ||
1805 | extern u64 cpu_clock(int cpu); | ||
1806 | extern u64 local_clock(void); | ||
1807 | extern u64 sched_clock_cpu(int cpu); | ||
1808 | |||
1805 | 1809 | ||
1806 | extern void sched_clock_init(void); | 1810 | extern void sched_clock_init(void); |
1807 | extern u64 sched_clock_cpu(int cpu); | ||
1808 | 1811 | ||
1809 | #ifndef CONFIG_HAVE_UNSTABLE_SCHED_CLOCK | 1812 | #ifndef CONFIG_HAVE_UNSTABLE_SCHED_CLOCK |
1810 | static inline void sched_clock_tick(void) | 1813 | static inline void sched_clock_tick(void) |
@@ -1819,17 +1822,19 @@ static inline void sched_clock_idle_wakeup_event(u64 delta_ns) | |||
1819 | { | 1822 | { |
1820 | } | 1823 | } |
1821 | #else | 1824 | #else |
1825 | /* | ||
1826 | * Architectures can set this to 1 if they have specified | ||
1827 | * CONFIG_HAVE_UNSTABLE_SCHED_CLOCK in their arch Kconfig, | ||
1828 | * but then during bootup it turns out that sched_clock() | ||
1829 | * is reliable after all: | ||
1830 | */ | ||
1831 | extern int sched_clock_stable; | ||
1832 | |||
1822 | extern void sched_clock_tick(void); | 1833 | extern void sched_clock_tick(void); |
1823 | extern void sched_clock_idle_sleep_event(void); | 1834 | extern void sched_clock_idle_sleep_event(void); |
1824 | extern void sched_clock_idle_wakeup_event(u64 delta_ns); | 1835 | extern void sched_clock_idle_wakeup_event(u64 delta_ns); |
1825 | #endif | 1836 | #endif |
1826 | 1837 | ||
1827 | /* | ||
1828 | * For kernel-internal use: high-speed (but slightly incorrect) per-cpu | ||
1829 | * clock constructed from sched_clock(): | ||
1830 | */ | ||
1831 | extern unsigned long long cpu_clock(int cpu); | ||
1832 | |||
1833 | extern unsigned long long | 1838 | extern unsigned long long |
1834 | task_sched_runtime(struct task_struct *task); | 1839 | task_sched_runtime(struct task_struct *task); |
1835 | extern unsigned long long thread_group_sched_runtime(struct task_struct *task); | 1840 | extern unsigned long long thread_group_sched_runtime(struct task_struct *task); |