xref: /openbmc/linux/arch/s390/include/asm/cputime.h (revision 0ad53fe3)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  *  Copyright IBM Corp. 2004
4  *
5  *  Author: Martin Schwidefsky <schwidefsky@de.ibm.com>
6  */
7 
8 #ifndef _S390_CPUTIME_H
9 #define _S390_CPUTIME_H
10 
11 #include <linux/types.h>
12 #include <asm/timex.h>
13 
14 #define CPUTIME_PER_USEC 4096ULL
15 #define CPUTIME_PER_SEC (CPUTIME_PER_USEC * USEC_PER_SEC)
16 
17 /* We want to use full resolution of the CPU timer: 2**-12 micro-seconds. */
18 
19 #define cmpxchg_cputime(ptr, old, new) cmpxchg64(ptr, old, new)
20 
21 /*
22  * Convert cputime to microseconds.
23  */
24 static inline u64 cputime_to_usecs(const u64 cputime)
25 {
26 	return cputime >> 12;
27 }
28 
29 /*
30  * Convert cputime to nanoseconds.
31  */
32 #define cputime_to_nsecs(cputime) tod_to_ns(cputime)
33 
34 u64 arch_cpu_idle_time(int cpu);
35 
36 #define arch_idle_time(cpu) arch_cpu_idle_time(cpu)
37 
38 void account_idle_time_irq(void);
39 
40 #endif /* _S390_CPUTIME_H */
41