aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/sched.h
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2010-05-25 04:48:51 -0400
committerIngo Molnar <mingo@elte.hu>2010-06-09 04:34:49 -0400
commitc676329abb2b8359d9a5d734dec0c81779823fd6 (patch)
treeb6c33715176221a87100228399c2a6f5049e44ea /include/linux/sched.h
parent95ae3c59fa8ad616c73745e21154b5af0fb10168 (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.h37
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
1800extern int sched_clock_stable;
1801#endif
1802
1803/* ftrace calls sched_clock() directly */
1804extern unsigned long long notrace sched_clock(void); 1801extern unsigned long long notrace sched_clock(void);
1802/*
1803 * See the comment in kernel/sched_clock.c
1804 */
1805extern u64 cpu_clock(int cpu);
1806extern u64 local_clock(void);
1807extern u64 sched_clock_cpu(int cpu);
1808
1805 1809
1806extern void sched_clock_init(void); 1810extern void sched_clock_init(void);
1807extern u64 sched_clock_cpu(int cpu);
1808 1811
1809#ifndef CONFIG_HAVE_UNSTABLE_SCHED_CLOCK 1812#ifndef CONFIG_HAVE_UNSTABLE_SCHED_CLOCK
1810static inline void sched_clock_tick(void) 1813static 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 */
1831extern int sched_clock_stable;
1832
1822extern void sched_clock_tick(void); 1833extern void sched_clock_tick(void);
1823extern void sched_clock_idle_sleep_event(void); 1834extern void sched_clock_idle_sleep_event(void);
1824extern void sched_clock_idle_wakeup_event(u64 delta_ns); 1835extern 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 */
1831extern unsigned long long cpu_clock(int cpu);
1832
1833extern unsigned long long 1838extern unsigned long long
1834task_sched_runtime(struct task_struct *task); 1839task_sched_runtime(struct task_struct *task);
1835extern unsigned long long thread_group_sched_runtime(struct task_struct *task); 1840extern unsigned long long thread_group_sched_runtime(struct task_struct *task);