|
@@ -1,18 +1,21 @@
|
|
#ifndef _PERF_PERF_H
|
|
#ifndef _PERF_PERF_H
|
|
#define _PERF_PERF_H
|
|
#define _PERF_PERF_H
|
|
|
|
|
|
-#include "perf-sys.h"
|
|
|
|
-
|
|
|
|
-#define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x))
|
|
|
|
-
|
|
|
|
#include <time.h>
|
|
#include <time.h>
|
|
-#include <unistd.h>
|
|
|
|
-#include <sys/types.h>
|
|
|
|
-#include <sys/syscall.h>
|
|
|
|
-
|
|
|
|
|
|
+#include <stdbool.h>
|
|
#include <linux/types.h>
|
|
#include <linux/types.h>
|
|
#include <linux/perf_event.h>
|
|
#include <linux/perf_event.h>
|
|
|
|
|
|
|
|
+extern bool test_attr__enabled;
|
|
|
|
+void test_attr__init(void);
|
|
|
|
+void test_attr__open(struct perf_event_attr *attr, pid_t pid, int cpu,
|
|
|
|
+ int fd, int group_fd, unsigned long flags);
|
|
|
|
+
|
|
|
|
+#define HAVE_ATTR_TEST
|
|
|
|
+#include "perf-sys.h"
|
|
|
|
+
|
|
|
|
+#define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x))
|
|
|
|
+
|
|
#ifndef NSEC_PER_SEC
|
|
#ifndef NSEC_PER_SEC
|
|
# define NSEC_PER_SEC 1000000000ULL
|
|
# define NSEC_PER_SEC 1000000000ULL
|
|
#endif
|
|
#endif
|
|
@@ -28,27 +31,6 @@ static inline unsigned long long rdclock(void)
|
|
return ts.tv_sec * 1000000000ULL + ts.tv_nsec;
|
|
return ts.tv_sec * 1000000000ULL + ts.tv_nsec;
|
|
}
|
|
}
|
|
|
|
|
|
-extern bool test_attr__enabled;
|
|
|
|
-void test_attr__init(void);
|
|
|
|
-void test_attr__open(struct perf_event_attr *attr, pid_t pid, int cpu,
|
|
|
|
- int fd, int group_fd, unsigned long flags);
|
|
|
|
-
|
|
|
|
-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);
|
|
|
|
-
|
|
|
|
- if (unlikely(test_attr__enabled))
|
|
|
|
- test_attr__open(attr, pid, cpu, fd, group_fd, flags);
|
|
|
|
-
|
|
|
|
- return fd;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
#define MAX_NR_CPUS 256
|
|
#define MAX_NR_CPUS 256
|
|
|
|
|
|
extern const char *input_name;
|
|
extern const char *input_name;
|