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/div64.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 typedef unsigned long long __nocast cputime_t; 19 typedef unsigned long long __nocast cputime64_t; 20 21 #define cmpxchg_cputime(ptr, old, new) cmpxchg64(ptr, old, new) 22 23 static inline unsigned long __div(unsigned long long n, unsigned long base) 24 { 25 return n / base; 26 } 27 28 /* 29 * Convert cputime to microseconds and back. 30 */ 31 static inline unsigned int cputime_to_usecs(const cputime_t cputime) 32 { 33 return (__force unsigned long long) cputime >> 12; 34 } 35 36 37 u64 arch_cpu_idle_time(int cpu); 38 39 #define arch_idle_time(cpu) arch_cpu_idle_time(cpu) 40 41 #endif /* _S390_CPUTIME_H */ 42