diff options
author | Frederic Weisbecker <fweisbec@gmail.com> | 2012-11-13 08:20:55 -0500 |
---|---|---|
committer | Frederic Weisbecker <fweisbec@gmail.com> | 2013-01-27 13:23:31 -0500 |
commit | 6fac4829ce0ef9b7f24369086ce5f0e9f38d37bc (patch) | |
tree | 44da712b66d778c2fd701f9c96b00e108530e1a9 /include/linux/sched.h | |
parent | 3f4724ea85b7d9055a9976fa8f30b471bdfbca93 (diff) |
cputime: Use accessors to read task cputime stats
This is in preparation for the full dynticks feature. While
remotely reading the cputime of a task running in a full
dynticks CPU, we'll need to do some extra-computation. This
way we can account the time it spent tickless in userspace
since its last cputime snapshot.
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Li Zhong <zhong@linux.vnet.ibm.com>
Cc: Namhyung Kim <namhyung.kim@lge.com>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'include/linux/sched.h')
-rw-r--r-- | include/linux/sched.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index 6fc8f45de4e9..a9c608b6154e 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -1792,6 +1792,29 @@ static inline void put_task_struct(struct task_struct *t) | |||
1792 | __put_task_struct(t); | 1792 | __put_task_struct(t); |
1793 | } | 1793 | } |
1794 | 1794 | ||
1795 | static inline cputime_t task_gtime(struct task_struct *t) | ||
1796 | { | ||
1797 | return t->gtime; | ||
1798 | } | ||
1799 | |||
1800 | static inline void task_cputime(struct task_struct *t, | ||
1801 | cputime_t *utime, cputime_t *stime) | ||
1802 | { | ||
1803 | if (utime) | ||
1804 | *utime = t->utime; | ||
1805 | if (stime) | ||
1806 | *stime = t->stime; | ||
1807 | } | ||
1808 | |||
1809 | static inline void task_cputime_scaled(struct task_struct *t, | ||
1810 | cputime_t *utimescaled, | ||
1811 | cputime_t *stimescaled) | ||
1812 | { | ||
1813 | if (utimescaled) | ||
1814 | *utimescaled = t->utimescaled; | ||
1815 | if (stimescaled) | ||
1816 | *stimescaled = t->stimescaled; | ||
1817 | } | ||
1795 | extern void task_cputime_adjusted(struct task_struct *p, cputime_t *ut, cputime_t *st); | 1818 | extern void task_cputime_adjusted(struct task_struct *p, cputime_t *ut, cputime_t *st); |
1796 | extern void thread_group_cputime_adjusted(struct task_struct *p, cputime_t *ut, cputime_t *st); | 1819 | extern void thread_group_cputime_adjusted(struct task_struct *p, cputime_t *ut, cputime_t *st); |
1797 | 1820 | ||