The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 1 | /**************************************************************************** |
| 2 | **************************************************************************** |
| 3 | *** |
| 4 | *** This header was automatically generated from a Linux kernel header |
| 5 | *** of the same name, to make information necessary for userspace to |
| 6 | *** call into the kernel available to libc. It contains only constants, |
| 7 | *** structures, and macros generated from the original header, and thus, |
| 8 | *** contains no copyrightable information. |
| 9 | *** |
| 10 | **************************************************************************** |
| 11 | ****************************************************************************/ |
| 12 | #ifndef _ASM_GENERIC_CPUTIME_H |
| 13 | #define _ASM_GENERIC_CPUTIME_H |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 14 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 15 | #include <linux/time.h> |
| 16 | #include <linux/jiffies.h> |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 17 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 18 | typedef unsigned long cputime_t; |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 19 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 20 | #define cputime_zero (0UL) |
| 21 | #define cputime_max ((~0UL >> 1) - 1) |
| 22 | #define cputime_add(__a, __b) ((__a) + (__b)) |
| 23 | #define cputime_sub(__a, __b) ((__a) - (__b)) |
| 24 | #define cputime_div(__a, __n) ((__a) / (__n)) |
| 25 | #define cputime_halve(__a) ((__a) >> 1) |
| 26 | #define cputime_eq(__a, __b) ((__a) == (__b)) |
| 27 | #define cputime_gt(__a, __b) ((__a) > (__b)) |
| 28 | #define cputime_ge(__a, __b) ((__a) >= (__b)) |
| 29 | #define cputime_lt(__a, __b) ((__a) < (__b)) |
| 30 | #define cputime_le(__a, __b) ((__a) <= (__b)) |
| 31 | #define cputime_to_jiffies(__ct) (__ct) |
| 32 | #define jiffies_to_cputime(__hz) (__hz) |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 33 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 34 | typedef u64 cputime64_t; |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 35 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 36 | #define cputime64_zero (0ULL) |
| 37 | #define cputime64_add(__a, __b) ((__a) + (__b)) |
| 38 | #define cputime64_sub(__a, __b) ((__a) - (__b)) |
| 39 | #define cputime64_to_jiffies64(__ct) (__ct) |
| 40 | #define jiffies64_to_cputime64(__jif) (__jif) |
| 41 | #define cputime_to_cputime64(__ct) ((u64) __ct) |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 42 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 43 | #define cputime_to_msecs(__ct) jiffies_to_msecs(__ct) |
| 44 | #define msecs_to_cputime(__msecs) msecs_to_jiffies(__msecs) |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 45 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 46 | #define cputime_to_secs(jif) ((jif) / HZ) |
| 47 | #define secs_to_cputime(sec) ((sec) * HZ) |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 48 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 49 | #define timespec_to_cputime(__val) timespec_to_jiffies(__val) |
| 50 | #define cputime_to_timespec(__ct,__val) jiffies_to_timespec(__ct,__val) |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 51 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 52 | #define timeval_to_cputime(__val) timeval_to_jiffies(__val) |
| 53 | #define cputime_to_timeval(__ct,__val) jiffies_to_timeval(__ct,__val) |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 54 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 55 | #define cputime_to_clock_t(__ct) jiffies_to_clock_t(__ct) |
| 56 | #define clock_t_to_cputime(__x) clock_t_to_jiffies(__x) |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 57 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 58 | #define cputime64_to_clock_t(__ct) jiffies_64_to_clock_t(__ct) |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 59 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 60 | #endif |