cputime.h 805 B

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