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