summaryrefslogtreecommitdiffstats
path: root/tools/perf/arch/x86/util/tsc.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--tools/perf/arch/x86/util/tsc.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/tools/perf/arch/x86/util/tsc.c b/tools/perf/arch/x86/util/tsc.c
new file mode 100644
index 000000000..559365f8f
--- /dev/null
+++ b/tools/perf/arch/x86/util/tsc.c
@@ -0,0 +1,13 @@
+// SPDX-License-Identifier: GPL-2.0
+#include <linux/types.h>
+
+#include "../../../util/tsc.h"
+
+u64 rdtsc(void)
+{
+ unsigned int low, high;
+
+ asm volatile("rdtsc" : "=a" (low), "=d" (high));
+
+ return low | ((u64)high) << 32;
+}