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