1 #ifndef _PERF_PERF_H 2 #define _PERF_PERF_H 3 4 #include <time.h> 5 #include <stdbool.h> 6 #include <linux/types.h> 7 #include <linux/perf_event.h> 8 9 extern bool test_attr__enabled; 10 void test_attr__init(void); 11 void test_attr__open(struct perf_event_attr *attr, pid_t pid, int cpu, 12 int fd, int group_fd, unsigned long flags); 13 14 #define HAVE_ATTR_TEST 15 #include "perf-sys.h" 16 17 #ifndef NSEC_PER_SEC 18 # define NSEC_PER_SEC 1000000000ULL 19 #endif 20 #ifndef NSEC_PER_USEC 21 # define NSEC_PER_USEC 1000ULL 22 #endif 23 rdclock(void)24static inline unsigned long long rdclock(void) 25 { 26 struct timespec ts; 27 28 clock_gettime(CLOCK_MONOTONIC, &ts); 29 return ts.tv_sec * 1000000000ULL + ts.tv_nsec; 30 } 31 32 #ifndef MAX_NR_CPUS 33 #define MAX_NR_CPUS 1024 34 #endif 35 36 extern const char *input_name; 37 extern bool perf_host, perf_guest; 38 extern const char perf_version_string[]; 39 40 void pthread__unblock_sigwinch(void); 41 42 #include "util/target.h" 43 44 struct record_opts { 45 struct target target; 46 bool group; 47 bool inherit_stat; 48 bool no_buffering; 49 bool no_inherit; 50 bool no_inherit_set; 51 bool no_samples; 52 bool raw_samples; 53 bool sample_address; 54 bool sample_weight; 55 bool sample_time; 56 bool sample_time_set; 57 bool callgraph_set; 58 bool period; 59 bool running_time; 60 bool full_auxtrace; 61 bool auxtrace_snapshot_mode; 62 bool record_switch_events; 63 unsigned int freq; 64 unsigned int mmap_pages; 65 unsigned int auxtrace_mmap_pages; 66 unsigned int user_freq; 67 u64 branch_stack; 68 u64 sample_intr_regs; 69 u64 default_interval; 70 u64 user_interval; 71 size_t auxtrace_snapshot_size; 72 const char *auxtrace_snapshot_opts; 73 bool sample_transaction; 74 unsigned initial_delay; 75 bool use_clockid; 76 clockid_t clockid; 77 unsigned int proc_map_timeout; 78 }; 79 80 struct option; 81 extern const char * const *record_usage; 82 extern struct option *record_options; 83 #endif 84