blob: 3c5a632ee57c56437a4ce66bd091189c9abd6f34 [file] [log] [blame]
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00001/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __PERF_TSC_H
3#define __PERF_TSC_H
4
5#include <linux/types.h>
6
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00007struct perf_tsc_conversion {
8 u16 time_shift;
9 u32 time_mult;
10 u64 time_zero;
11};
David Brazdil0f672f62019-12-10 10:32:29 +000012
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000013struct perf_event_mmap_page;
14
15int perf_read_tsc_conversion(const struct perf_event_mmap_page *pc,
16 struct perf_tsc_conversion *tc);
17
18u64 perf_time_to_tsc(u64 ns, struct perf_tsc_conversion *tc);
19u64 tsc_to_perf_time(u64 cyc, struct perf_tsc_conversion *tc);
20u64 rdtsc(void);
21
David Brazdil0f672f62019-12-10 10:32:29 +000022#endif // __PERF_TSC_H