aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-generic/cputime.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /include/asm-generic/cputime.h
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'include/asm-generic/cputime.h')
-rw-r--r--include/asm-generic/cputime.h66
1 files changed, 66 insertions, 0 deletions
diff --git a/include/asm-generic/cputime.h b/include/asm-generic/cputime.h
new file mode 100644
index 000000000000..6f178563e336
--- /dev/null
+++ b/include/asm-generic/cputime.h
@@ -0,0 +1,66 @@
1#ifndef _ASM_GENERIC_CPUTIME_H
2#define _ASM_GENERIC_CPUTIME_H
3
4#include <linux/time.h>
5#include <linux/jiffies.h>
6
7typedef 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_div(__a, __n) ((__a) / (__n))
14#define cputime_halve(__a) ((__a) >> 1)
15#define cputime_eq(__a, __b) ((__a) == (__b))
16#define cputime_gt(__a, __b) ((__a) > (__b))
17#define cputime_ge(__a, __b) ((__a) >= (__b))
18#define cputime_lt(__a, __b) ((__a) < (__b))
19#define cputime_le(__a, __b) ((__a) <= (__b))
20#define cputime_to_jiffies(__ct) (__ct)
21#define jiffies_to_cputime(__hz) (__hz)
22
23typedef u64 cputime64_t;
24
25#define cputime64_zero (0ULL)
26#define cputime64_add(__a, __b) ((__a) + (__b))
27#define cputime64_to_jiffies64(__ct) (__ct)
28#define cputime_to_cputime64(__ct) ((u64) __ct)
29
30
31/*
32 * Convert cputime to milliseconds and back.
33 */
34#define cputime_to_msecs(__ct) jiffies_to_msecs(__ct)
35#define msecs_to_cputime(__msecs) msecs_to_jiffies(__msecs)
36
37/*
38 * Convert cputime to seconds and back.
39 */
40#define cputime_to_secs(jif) ((jif) / HZ)
41#define secs_to_cputime(sec) ((sec) * HZ)
42
43/*
44 * Convert cputime to timespec and back.
45 */
46#define timespec_to_cputime(__val) timespec_to_jiffies(__val)
47#define cputime_to_timespec(__ct,__val) jiffies_to_timespec(__ct,__val)
48
49/*
50 * Convert cputime to timeval and back.
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/*
56 * Convert cputime to clock and back.
57 */
58#define cputime_to_clock_t(__ct) jiffies_to_clock_t(__ct)
59#define clock_t_to_cputime(__x) clock_t_to_jiffies(__x)
60
61/*
62 * Convert cputime64 to clock.
63 */
64#define cputime64_to_clock_t(__ct) jiffies_64_to_clock_t(__ct)
65
66#endif