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