Merge branch 'stable' of git://git.kernel.org/pub/scm/linux/kernel/git/cmetcalf/linux...
[firefly-linux-kernel-4.4.55.git] / tools / perf / perf.h
index 238f923f22181698f1610ed8b14f512b76706fb1..2c340e7da458e4fa53b2c08914f1acd976fa90c5 100644 (file)
@@ -26,6 +26,7 @@ void get_term_dimensions(struct winsize *ws);
 #endif
 
 #ifdef __powerpc__
+#include "../../arch/powerpc/include/uapi/asm/unistd.h"
 #define rmb()          asm volatile ("sync" ::: "memory")
 #define cpu_relax()    asm volatile ("" ::: "memory");
 #define CPUINFO_PROC   "cpu"
@@ -164,13 +165,25 @@ static inline unsigned long long rdclock(void)
        (void) (&_min1 == &_min2);              \
        _min1 < _min2 ? _min1 : _min2; })
 
+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)
 {
-       return syscall(__NR_perf_event_open, attr, pid, cpu,
-                      group_fd, 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_COUNTERS                   256
@@ -198,6 +211,7 @@ struct branch_stack {
        struct branch_entry     entries[0];
 };
 
+extern const char *input_name;
 extern bool perf_host, perf_guest;
 extern const char perf_version_string[];