This commit was manufactured by cvs2svn to create branch 'vserver'.
[linux-2.6.git] / include / asm-generic / cputime.h
1 #ifndef _ASM_GENERIC_CPUTIME_H
2 #define _ASM_GENERIC_CPUTIME_H
3
4 #include <linux/time.h>
5 #include <linux/jiffies.h>
6
7 typedef unsigned long cputime_t;
8
9 #define cputime_zero                    (0UL)
10 #define cputime_max                     ((~0UL >> 1) - 1)
11 #define cputime_add(__a, __b)           ((__a) +  (__b))
12 #define cputime_sub(__a, __b)           ((__a) -  (__b))
13 #define cputime_eq(__a, __b)            ((__a) == (__b))
14 #define cputime_gt(__a, __b)            ((__a) >  (__b))
15 #define cputime_ge(__a, __b)            ((__a) >= (__b))
16 #define cputime_lt(__a, __b)            ((__a) <  (__b))
17 #define cputime_le(__a, __b)            ((__a) <= (__b))
18 #define cputime_to_jiffies(__ct)        (__ct)
19 #define jiffies_to_cputime(__hz)        (__hz)
20
21 typedef u64 cputime64_t;
22
23 #define cputime64_zero (0ULL)
24 #define cputime64_add(__a, __b)         ((__a) + (__b))
25 #define cputime64_to_jiffies64(__ct)    (__ct)
26 #define cputime_to_cputime64(__ct)      ((u64) __ct)
27
28
29 /*
30  * Convert cputime to milliseconds and back.
31  */
32 #define cputime_to_msecs(__ct)          jiffies_to_msecs(__ct)
33 #define msecs_to_cputime(__msecs)       msecs_to_jiffies(__msecs)
34
35 /*
36  * Convert cputime to seconds and back.
37  */
38 #define cputime_to_secs(jif)            ((jif) / HZ)
39 #define secs_to_cputime(sec)            ((sec) * HZ)
40
41 /*
42  * Convert cputime to timespec and back.
43  */
44 #define timespec_to_cputime(__val)      timespec_to_jiffies(__val)
45 #define cputime_to_timespec(__ct,__val) jiffies_to_timespec(__ct,__val)
46
47 /*
48  * Convert cputime to timeval and back.
49  */
50 #define timeval_to_cputime(__val)       timeval_to_jiffies(__val)
51 #define cputime_to_timeval(__ct,__val)  jiffies_to_timeval(__ct,__val)
52
53 /*
54  * Convert cputime to clock and back.
55  */
56 #define cputime_to_clock_t(__ct)        jiffies_to_clock_t(__ct)
57 #define clock_t_to_cputime(__x)         clock_t_to_jiffies(__x)
58
59 /*
60  * Convert cputime64 to clock.
61  */
62 #define cputime64_to_clock_t(__ct)      jiffies_64_to_clock_t(__ct)
63
64 #endif