Changeset View
Changeset View
Standalone View
Standalone View
graphics/igt-gpu-tools/files/patch-lib_igt__perf.h
- This file was added.
--- lib/igt_perf.h.orig 2022-08-17 23:41:16 UTC | |||||
+++ lib/igt_perf.h | |||||
@@ -27,10 +27,18 @@ | |||||
#include <stdint.h> | |||||
+#ifdef __linux__ | |||||
#include <linux/perf_event.h> | |||||
+#endif | |||||
#include "igt_gt.h" | |||||
+#ifdef __FreeBSD__ | |||||
+struct perf_event_attr { | |||||
+ size_t size; | |||||
+}; | |||||
+#endif | |||||
+ | |||||
static inline int | |||||
perf_event_open(struct perf_event_attr *attr, | |||||
pid_t pid, | |||||
@@ -38,6 +46,8 @@ perf_event_open(struct perf_event_attr *attr, | |||||
int group_fd, | |||||
unsigned long flags) | |||||
{ | |||||
+#ifdef __linux__ | |||||
+ | |||||
#ifndef __NR_perf_event_open | |||||
#if defined(__i386__) | |||||
#define __NR_perf_event_open 336 | |||||
@@ -49,6 +59,9 @@ perf_event_open(struct perf_event_attr *attr, | |||||
#endif | |||||
attr->size = sizeof(*attr); | |||||
return syscall(__NR_perf_event_open, attr, pid, cpu, group_fd, flags); | |||||
+#elif defined(__FreeBSD__) | |||||
+ return -ENOSYS; | |||||
+#endif /* __linux__ */ | |||||
} | |||||
uint64_t igt_perf_type_id(const char *device); |