diff options
author | Frederic Weisbecker <fweisbec@gmail.com> | 2014-03-05 19:33:42 +0400 |
---|---|---|
committer | Frederic Weisbecker <fweisbec@gmail.com> | 2014-03-13 18:56:43 +0400 |
commit | bfc3f0281e08066fa8111c3972cff6edc1049864 (patch) | |
tree | 6050b264fecd05de99bdff0dd6c98e8594ed70a4 /include/linux/cputime.h | |
parent | 69bb2600c9f8ca450fede9633edf9c2513c9ee6f (diff) | |
download | linux-bfc3f0281e08066fa8111c3972cff6edc1049864.tar.xz |
cputime: Default implementation of nsecs -> cputime conversion
The architectures that override cputime_t (s390, ppc) don't provide
any version of nsecs_to_cputime(). Indeed this cputime_t implementation
by backend only happens when CONFIG_VIRT_CPU_ACCOUNTING_NATIVE=y under
which the core code doesn't make any use of nsecs_to_cputime().
At least for now.
We are going to make a broader use of it so lets provide a default
version with a per usecs granularity. It should be good enough for most
usecases.
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Rik van Riel <riel@redhat.com>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Diffstat (limited to 'include/linux/cputime.h')
-rw-r--r-- | include/linux/cputime.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/include/linux/cputime.h b/include/linux/cputime.h new file mode 100644 index 000000000000..2842ebe2844d --- /dev/null +++ b/include/linux/cputime.h @@ -0,0 +1,11 @@ +#ifndef __LINUX_CPUTIME_H +#define __LINUX_CPUTIME_H + +#include <asm/cputime.h> + +#ifndef nsecs_to_cputime +# define nsecs_to_cputime(__nsecs) \ + usecs_to_cputime((__nsecs) / NSEC_PER_USEC) +#endif + +#endif /* __LINUX_CPUTIME_H */ |