tsc.h 584 B

123456789101112131415161718192021222324252627
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef __PERF_TSC_H
  3. #define __PERF_TSC_H
  4. #include <linux/types.h>
  5. struct perf_tsc_conversion {
  6. u16 time_shift;
  7. u32 time_mult;
  8. u64 time_zero;
  9. u64 time_cycles;
  10. u64 time_mask;
  11. bool cap_user_time_zero;
  12. bool cap_user_time_short;
  13. };
  14. struct perf_event_mmap_page;
  15. int perf_read_tsc_conversion(const struct perf_event_mmap_page *pc,
  16. struct perf_tsc_conversion *tc);
  17. u64 perf_time_to_tsc(u64 ns, struct perf_tsc_conversion *tc);
  18. u64 tsc_to_perf_time(u64 cyc, struct perf_tsc_conversion *tc);
  19. u64 rdtsc(void);
  20. #endif // __PERF_TSC_H