The Android Open Source Project | a27d2ba | 2008-10-21 07:00:00 -0700 | [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 |
| 14 | |
| 15 | #include <linux/time.h> |
| 16 | #include <linux/jiffies.h> |
| 17 | |
| 18 | typedef unsigned long cputime_t; |
| 19 | |
| 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) |
| 33 | |
| 34 | typedef u64 cputime64_t; |
| 35 | |
| 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) |
| 42 | |
| 43 | #define cputime_to_msecs(__ct) jiffies_to_msecs(__ct) |
| 44 | #define msecs_to_cputime(__msecs) msecs_to_jiffies(__msecs) |
| 45 | |
| 46 | #define cputime_to_secs(jif) ((jif) / HZ) |
| 47 | #define secs_to_cputime(sec) ((sec) * HZ) |
| 48 | |
| 49 | #define timespec_to_cputime(__val) timespec_to_jiffies(__val) |
| 50 | #define cputime_to_timespec(__ct,__val) jiffies_to_timespec(__ct,__val) |
| 51 | |
| 52 | #define timeval_to_cputime(__val) timeval_to_jiffies(__val) |
| 53 | #define cputime_to_timeval(__ct,__val) jiffies_to_timeval(__ct,__val) |
| 54 | |
| 55 | #define cputime_to_clock_t(__ct) jiffies_to_clock_t(__ct) |
| 56 | #define clock_t_to_cputime(__x) clock_t_to_jiffies(__x) |
| 57 | |
| 58 | #define cputime64_to_clock_t(__ct) jiffies_64_to_clock_t(__ct) |
| 59 | |
| 60 | #endif |