blob: 0486b87b118a10acb9772a499ec4b8558d0a932d [file] [log] [blame]
The Android Open Source Project1dc9e472009-03-03 19:28:35 -08001/****************************************************************************
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 Cheng4b29af02012-03-07 16:14:53 -080014
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080015#include <linux/time.h>
16#include <linux/jiffies.h>
Ben Cheng4b29af02012-03-07 16:14:53 -080017
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080018typedef unsigned long cputime_t;
Ben Cheng4b29af02012-03-07 16:14:53 -080019
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080020#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 Cheng4b29af02012-03-07 16:14:53 -080033
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080034typedef u64 cputime64_t;
Ben Cheng4b29af02012-03-07 16:14:53 -080035
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080036#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 Cheng4b29af02012-03-07 16:14:53 -080042
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080043#define cputime_to_msecs(__ct) jiffies_to_msecs(__ct)
44#define msecs_to_cputime(__msecs) msecs_to_jiffies(__msecs)
Ben Cheng4b29af02012-03-07 16:14:53 -080045
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080046#define cputime_to_secs(jif) ((jif) / HZ)
47#define secs_to_cputime(sec) ((sec) * HZ)
Ben Cheng4b29af02012-03-07 16:14:53 -080048
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080049#define timespec_to_cputime(__val) timespec_to_jiffies(__val)
50#define cputime_to_timespec(__ct,__val) jiffies_to_timespec(__ct,__val)
Ben Cheng4b29af02012-03-07 16:14:53 -080051
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080052#define timeval_to_cputime(__val) timeval_to_jiffies(__val)
53#define cputime_to_timeval(__ct,__val) jiffies_to_timeval(__ct,__val)
Ben Cheng4b29af02012-03-07 16:14:53 -080054
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080055#define cputime_to_clock_t(__ct) jiffies_to_clock_t(__ct)
56#define clock_t_to_cputime(__x) clock_t_to_jiffies(__x)
Ben Cheng4b29af02012-03-07 16:14:53 -080057
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080058#define cputime64_to_clock_t(__ct) jiffies_64_to_clock_t(__ct)
Ben Cheng4b29af02012-03-07 16:14:53 -080059
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080060#endif