aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/kernel/cpu/perf_event.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
index 116b040a73a8..f8bddb5b0600 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -32,6 +32,7 @@
32#include <asm/compat.h> 32#include <asm/compat.h>
33#include <asm/smp.h> 33#include <asm/smp.h>
34#include <asm/alternative.h> 34#include <asm/alternative.h>
35#include <asm/timer.h>
35 36
36#include "perf_event.h" 37#include "perf_event.h"
37 38
@@ -1627,6 +1628,19 @@ static struct pmu pmu = {
1627 .event_idx = x86_pmu_event_idx, 1628 .event_idx = x86_pmu_event_idx,
1628}; 1629};
1629 1630
1631void perf_update_user_clock(struct perf_event_mmap_page *userpg, u64 now)
1632{
1633 if (!boot_cpu_has(X86_FEATURE_CONSTANT_TSC))
1634 return;
1635
1636 if (!boot_cpu_has(X86_FEATURE_NONSTOP_TSC))
1637 return;
1638
1639 userpg->time_mult = this_cpu_read(cyc2ns);
1640 userpg->time_shift = CYC2NS_SCALE_FACTOR;
1641 userpg->time_offset = this_cpu_read(cyc2ns_offset) - now;
1642}
1643
1630/* 1644/*
1631 * callchain support 1645 * callchain support
1632 */ 1646 */