Commit | Line | Data |
---|---|---|
b2441318 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
1da177e4 | 2 | /* |
a53c8fab | 3 | * Copyright IBM Corp. 2004 |
1da177e4 LT |
4 | * |
5 | * Author: Martin Schwidefsky <schwidefsky@de.ibm.com> | |
6 | */ | |
7 | ||
8 | #ifndef _S390_CPUTIME_H | |
9 | #define _S390_CPUTIME_H | |
10 | ||
76d4e00a | 11 | #include <linux/types.h> |
e53051e7 | 12 | #include <asm/timex.h> |
1da177e4 | 13 | |
8461b63c FW |
14 | #define CPUTIME_PER_USEC 4096ULL |
15 | #define CPUTIME_PER_SEC (CPUTIME_PER_USEC * USEC_PER_SEC) | |
a7e1a9e3 | 16 | |
aa5e97ce | 17 | /* We want to use full resolution of the CPU timer: 2**-12 micro-seconds. */ |
1da177e4 | 18 | |
347abad9 RR |
19 | #define cmpxchg_cputime(ptr, old, new) cmpxchg64(ptr, old, new) |
20 | ||
1da177e4 | 21 | /* |
e53051e7 | 22 | * Convert cputime to microseconds. |
1da177e4 | 23 | */ |
e69ca822 | 24 | static inline u64 cputime_to_usecs(const u64 cputime) |
1da177e4 | 25 | { |
e69ca822 | 26 | return cputime >> 12; |
1da177e4 LT |
27 | } |
28 | ||
e53051e7 MS |
29 | /* |
30 | * Convert cputime to nanoseconds. | |
31 | */ | |
32 | #define cputime_to_nsecs(cputime) tod_to_ns(cputime) | |
33 | ||
42b425b3 | 34 | u64 arch_cpu_idle_time(int cpu); |
76d4e00a | 35 | |
b5f87f15 | 36 | #define arch_idle_time(cpu) arch_cpu_idle_time(cpu) |
3c5d92a0 | 37 | |
1da177e4 | 38 | #endif /* _S390_CPUTIME_H */ |