diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-generic/cputime_jiffies.h | 4 | ||||
-rw-r--r-- | include/asm-generic/cputime_nsecs.h | 5 | ||||
-rw-r--r-- | include/linux/cputime.h | 16 | ||||
-rw-r--r-- | include/linux/kernel_stat.h | 2 | ||||
-rw-r--r-- | include/linux/sched.h | 2 |
5 files changed, 25 insertions, 4 deletions
diff --git a/include/asm-generic/cputime_jiffies.h b/include/asm-generic/cputime_jiffies.h index 272ecba9f588..d5cb78f53986 100644 --- a/include/asm-generic/cputime_jiffies.h +++ b/include/asm-generic/cputime_jiffies.h @@ -15,8 +15,10 @@ typedef u64 __nocast cputime64_t; /* - * Convert nanoseconds to cputime + * Convert nanoseconds <-> cputime */ +#define cputime_to_nsecs(__ct) \ + jiffies_to_nsecs(cputime_to_jiffies(__ct)) #define nsecs_to_cputime64(__nsec) \ jiffies64_to_cputime64(nsecs_to_jiffies64(__nsec)) #define nsecs_to_cputime(__nsec) \ diff --git a/include/asm-generic/cputime_nsecs.h b/include/asm-generic/cputime_nsecs.h index 2c9e62c2bfd0..4e817606c549 100644 --- a/include/asm-generic/cputime_nsecs.h +++ b/include/asm-generic/cputime_nsecs.h @@ -44,7 +44,10 @@ typedef u64 __nocast cputime64_t; /* * Convert cputime <-> nanoseconds */ -#define nsecs_to_cputime(__nsecs) ((__force u64)(__nsecs)) +#define cputime_to_nsecs(__ct) \ + (__force u64)(__ct) +#define nsecs_to_cputime(__nsecs) \ + (__force cputime_t)(__nsecs) /* diff --git a/include/linux/cputime.h b/include/linux/cputime.h new file mode 100644 index 000000000000..f2eb2ee535ca --- /dev/null +++ b/include/linux/cputime.h @@ -0,0 +1,16 @@ +#ifndef __LINUX_CPUTIME_H +#define __LINUX_CPUTIME_H + +#include <asm/cputime.h> + +#ifndef cputime_to_nsecs +# define cputime_to_nsecs(__ct) \ + (cputime_to_usecs(__ct) * NSEC_PER_USEC) +#endif + +#ifndef nsecs_to_cputime +# define nsecs_to_cputime(__nsecs) \ + usecs_to_cputime((__nsecs) / NSEC_PER_USEC) +#endif + +#endif /* __LINUX_CPUTIME_H */ diff --git a/include/linux/kernel_stat.h b/include/linux/kernel_stat.h index 51c72be4a7c3..d7c61317db86 100644 --- a/include/linux/kernel_stat.h +++ b/include/linux/kernel_stat.h @@ -9,7 +9,7 @@ #include <linux/sched.h> #include <linux/vtime.h> #include <asm/irq.h> -#include <asm/cputime.h> +#include <linux/cputime.h> /* * 'kernel_stat.h' contains the definitions needed for doing diff --git a/include/linux/sched.h b/include/linux/sched.h index 825ed838d4b9..c399ed826648 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -29,7 +29,7 @@ struct sched_param { #include <asm/page.h> #include <asm/ptrace.h> -#include <asm/cputime.h> +#include <linux/cputime.h> #include <linux/smp.h> #include <linux/sem.h> |