summaryrefslogtreecommitdiffstats
path: root/tools/perf/perf-sys.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-06 01:02:30 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-06 01:02:30 +0000
commit76cb841cb886eef6b3bee341a2266c76578724ad (patch)
treef5892e5ba6cc11949952a6ce4ecbe6d516d6ce58 /tools/perf/perf-sys.h
parentInitial commit. (diff)
downloadlinux-76cb841cb886eef6b3bee341a2266c76578724ad.tar.xz
linux-76cb841cb886eef6b3bee341a2266c76578724ad.zip
Adding upstream version 4.19.249.upstream/4.19.249
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tools/perf/perf-sys.h')
-rw-r--r--tools/perf/perf-sys.h74
1 files changed, 74 insertions, 0 deletions
diff --git a/tools/perf/perf-sys.h b/tools/perf/perf-sys.h
new file mode 100644
index 000000000..3eb7a3916
--- /dev/null
+++ b/tools/perf/perf-sys.h
@@ -0,0 +1,74 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _PERF_SYS_H
+#define _PERF_SYS_H
+
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/syscall.h>
+#include <linux/types.h>
+#include <linux/compiler.h>
+#include <linux/perf_event.h>
+#include <asm/barrier.h>
+
+#ifdef __powerpc__
+#define CPUINFO_PROC {"cpu"}
+#endif
+
+#ifdef __s390__
+#define CPUINFO_PROC {"vendor_id"}
+#endif
+
+#ifdef __sh__
+#define CPUINFO_PROC {"cpu type"}
+#endif
+
+#ifdef __hppa__
+#define CPUINFO_PROC {"cpu"}
+#endif
+
+#ifdef __sparc__
+#define CPUINFO_PROC {"cpu"}
+#endif
+
+#ifdef __alpha__
+#define CPUINFO_PROC {"cpu model"}
+#endif
+
+#ifdef __arm__
+#define CPUINFO_PROC {"model name", "Processor"}
+#endif
+
+#ifdef __mips__
+#define CPUINFO_PROC {"cpu model"}
+#endif
+
+#ifdef __arc__
+#define CPUINFO_PROC {"Processor"}
+#endif
+
+#ifdef __xtensa__
+#define CPUINFO_PROC {"core ID"}
+#endif
+
+#ifndef CPUINFO_PROC
+#define CPUINFO_PROC { "model name", }
+#endif
+
+static inline int
+sys_perf_event_open(struct perf_event_attr *attr,
+ pid_t pid, int cpu, int group_fd,
+ unsigned long flags)
+{
+ int fd;
+
+ fd = syscall(__NR_perf_event_open, attr, pid, cpu,
+ group_fd, flags);
+
+#ifdef HAVE_ATTR_TEST
+ if (unlikely(test_attr__enabled))
+ test_attr__open(attr, pid, cpu, fd, group_fd, flags);
+#endif
+ return fd;
+}
+
+#endif /* _PERF_SYS_H */