xref: /openbmc/linux/tools/perf/util/tsc.h (revision bf070bb0)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __PERF_TSC_H
3 #define __PERF_TSC_H
4 
5 #include <linux/types.h>
6 
7 #include "event.h"
8 
9 struct perf_tsc_conversion {
10 	u16 time_shift;
11 	u32 time_mult;
12 	u64 time_zero;
13 };
14 struct perf_event_mmap_page;
15 
16 int perf_read_tsc_conversion(const struct perf_event_mmap_page *pc,
17 			     struct perf_tsc_conversion *tc);
18 
19 u64 perf_time_to_tsc(u64 ns, struct perf_tsc_conversion *tc);
20 u64 tsc_to_perf_time(u64 cyc, struct perf_tsc_conversion *tc);
21 u64 rdtsc(void);
22 
23 struct perf_event_mmap_page;
24 struct perf_tool;
25 struct machine;
26 
27 int perf_event__synth_time_conv(const struct perf_event_mmap_page *pc,
28 				struct perf_tool *tool,
29 				perf_event__handler_t process,
30 				struct machine *machine);
31 
32 #endif
33