Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
| 2 | #ifndef __PERF_TSC_H |
| 3 | #define __PERF_TSC_H |
| 4 | |
| 5 | #include <linux/types.h> |
| 6 | |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 7 | struct perf_tsc_conversion { |
| 8 | u16 time_shift; |
| 9 | u32 time_mult; |
| 10 | u64 time_zero; |
Olivier Deprez | 157378f | 2022-04-04 15:47:50 +0200 | [diff] [blame^] | 11 | u64 time_cycles; |
| 12 | u64 time_mask; |
| 13 | |
| 14 | bool cap_user_time_zero; |
| 15 | bool cap_user_time_short; |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 16 | }; |
David Brazdil | 0f672f6 | 2019-12-10 10:32:29 +0000 | [diff] [blame] | 17 | |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 18 | struct perf_event_mmap_page; |
| 19 | |
| 20 | int perf_read_tsc_conversion(const struct perf_event_mmap_page *pc, |
| 21 | struct perf_tsc_conversion *tc); |
| 22 | |
| 23 | u64 perf_time_to_tsc(u64 ns, struct perf_tsc_conversion *tc); |
| 24 | u64 tsc_to_perf_time(u64 cyc, struct perf_tsc_conversion *tc); |
| 25 | u64 rdtsc(void); |
| 26 | |
David Brazdil | 0f672f6 | 2019-12-10 10:32:29 +0000 | [diff] [blame] | 27 | #endif // __PERF_TSC_H |