Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Thomas Gleixner | 6eda583 | 2009-05-01 18:29:57 +0200 | [diff] [blame] | 2 | #ifndef _PERF_PERF_H |
| 3 | #define _PERF_PERF_H |
| 4 | |
Jiri Olsa | 82baa0e | 2014-05-05 12:58:31 +0200 | [diff] [blame] | 5 | #include <time.h> |
| 6 | #include <stdbool.h> |
| 7 | #include <linux/types.h> |
Arnaldo Carvalho de Melo | 44fe619 | 2018-07-30 13:15:03 -0300 | [diff] [blame] | 8 | #include <linux/stddef.h> |
Jiri Olsa | 82baa0e | 2014-05-05 12:58:31 +0200 | [diff] [blame] | 9 | #include <linux/perf_event.h> |
| 10 | |
| 11 | extern bool test_attr__enabled; |
Jiri Olsa | 10213e2 | 2017-07-03 16:50:18 +0200 | [diff] [blame] | 12 | void test_attr__ready(void); |
Jiri Olsa | 82baa0e | 2014-05-05 12:58:31 +0200 | [diff] [blame] | 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 |
Jiri Olsa | 43599d1 | 2014-05-05 12:53:20 +0200 | [diff] [blame] | 18 | #include "perf-sys.h" |
Peter Zijlstra | a94d342 | 2013-10-30 11:42:46 +0100 | [diff] [blame] | 19 | |
Thomas Gleixner | a92e70237 | 2009-05-01 18:39:47 +0200 | [diff] [blame] | 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 | } |
Thomas Gleixner | 6eda583 | 2009-05-01 18:29:57 +0200 | [diff] [blame] | 27 | |
Christophe Leroy | 21b8732 | 2017-09-22 13:20:43 +0200 | [diff] [blame] | 28 | #ifndef MAX_NR_CPUS |
David Ahern | 4d25576 | 2015-03-24 12:10:38 -0400 | [diff] [blame] | 29 | #define MAX_NR_CPUS 1024 |
Christophe Leroy | 21b8732 | 2017-09-22 13:20:43 +0200 | [diff] [blame] | 30 | #endif |
Thomas Gleixner | 6eda583 | 2009-05-01 18:29:57 +0200 | [diff] [blame] | 31 | |
Feng Tang | 70cb4e9 | 2012-10-30 11:56:02 +0800 | [diff] [blame] | 32 | extern const char *input_name; |
Arnaldo Carvalho de Melo | 8035458 | 2010-05-17 15:51:10 -0300 | [diff] [blame] | 33 | extern bool perf_host, perf_guest; |
Stephane Eranian | fbe96f2 | 2011-09-30 15:40:40 +0200 | [diff] [blame] | 34 | extern const char perf_version_string[]; |
Zhang, Yanmin | a1645ce | 2010-04-19 13:32:50 +0800 | [diff] [blame] | 35 | |
Arnaldo Carvalho de Melo | 3af6e33 | 2011-10-13 08:52:46 -0300 | [diff] [blame] | 36 | void pthread__unblock_sigwinch(void); |
| 37 | |
Namhyung Kim | 12864b3 | 2012-04-26 14:15:22 +0900 | [diff] [blame] | 38 | #include "util/target.h" |
Namhyung Kim | bea0340 | 2012-04-26 14:15:15 +0900 | [diff] [blame] | 39 | |
Arnaldo Carvalho de Melo | b400679 | 2013-12-19 14:43:45 -0300 | [diff] [blame] | 40 | struct record_opts { |
Arnaldo Carvalho de Melo | 602ad87 | 2013-11-12 16:46:16 -0300 | [diff] [blame] | 41 | struct target target; |
Arnaldo Carvalho de Melo | ed80f58 | 2011-11-11 15:12:56 -0200 | [diff] [blame] | 42 | bool group; |
Arnaldo Carvalho de Melo | 0f82ebc | 2011-11-08 14:41:57 -0200 | [diff] [blame] | 43 | bool inherit_stat; |
Arnaldo Carvalho de Melo | 509051e | 2014-01-14 17:52:14 -0300 | [diff] [blame] | 44 | bool no_buffering; |
Arnaldo Carvalho de Melo | 0f82ebc | 2011-11-08 14:41:57 -0200 | [diff] [blame] | 45 | bool no_inherit; |
Adrian Hunter | 69e7e5b | 2013-11-18 11:55:57 +0200 | [diff] [blame] | 46 | bool no_inherit_set; |
Arnaldo Carvalho de Melo | 0f82ebc | 2011-11-08 14:41:57 -0200 | [diff] [blame] | 47 | bool no_samples; |
| 48 | bool raw_samples; |
| 49 | bool sample_address; |
Kan Liang | 3b0a5da | 2017-08-29 13:11:08 -0400 | [diff] [blame] | 50 | bool sample_phys_addr; |
Andi Kleen | 0548429 | 2013-01-24 16:10:29 +0100 | [diff] [blame] | 51 | bool sample_weight; |
Arnaldo Carvalho de Melo | 0f82ebc | 2011-11-08 14:41:57 -0200 | [diff] [blame] | 52 | bool sample_time; |
Adrian Hunter | 3abebc5 | 2015-07-06 14:51:01 +0300 | [diff] [blame] | 53 | bool sample_time_set; |
Jiri Olsa | b6f35ed | 2016-08-01 20:02:35 +0200 | [diff] [blame] | 54 | bool sample_cpu; |
Andrew Vagin | 3e76ac7 | 2011-12-20 17:32:45 +0300 | [diff] [blame] | 55 | bool period; |
Jiri Olsa | f290aa1 | 2018-02-01 09:38:11 +0100 | [diff] [blame] | 56 | bool period_set; |
Andi Kleen | 85c273d | 2015-02-24 15:13:40 -0800 | [diff] [blame] | 57 | bool running_time; |
Adrian Hunter | 9e0cc4f | 2015-04-09 18:53:44 +0300 | [diff] [blame] | 58 | bool full_auxtrace; |
Adrian Hunter | d20031b | 2015-04-30 17:37:31 +0300 | [diff] [blame] | 59 | bool auxtrace_snapshot_mode; |
Hari Bathini | f3b3614 | 2017-03-08 02:11:43 +0530 | [diff] [blame] | 60 | bool record_namespaces; |
Adrian Hunter | b757bb0 | 2015-07-21 12:44:04 +0300 | [diff] [blame] | 61 | bool record_switch_events; |
Jiri Olsa | 8572388 | 2016-02-15 09:34:31 +0100 | [diff] [blame] | 62 | bool all_kernel; |
| 63 | bool all_user; |
Wang Nan | 4ea648a | 2016-07-14 08:34:47 +0000 | [diff] [blame] | 64 | bool tail_synthesize; |
Wang Nan | 626a6b7 | 2016-07-14 08:34:45 +0000 | [diff] [blame] | 65 | bool overwrite; |
Jiri Olsa | a359c17 | 2016-12-13 08:46:22 +0100 | [diff] [blame] | 66 | bool ignore_missing_thread; |
Arnaldo Carvalho de Melo | b09c236 | 2018-03-01 14:52:50 -0300 | [diff] [blame] | 67 | bool strict_freq; |
Jiri Olsa | ad46e48c | 2018-03-02 17:13:54 +0100 | [diff] [blame] | 68 | bool sample_id; |
Song Liu | 71184c6 | 2019-03-11 22:30:37 -0700 | [diff] [blame] | 69 | bool no_bpf_event; |
Arnaldo Carvalho de Melo | 0f82ebc | 2011-11-08 14:41:57 -0200 | [diff] [blame] | 70 | unsigned int freq; |
Arnaldo Carvalho de Melo | 01c2d99 | 2011-11-09 09:16:26 -0200 | [diff] [blame] | 71 | unsigned int mmap_pages; |
Adrian Hunter | 9e0cc4f | 2015-04-09 18:53:44 +0300 | [diff] [blame] | 72 | unsigned int auxtrace_mmap_pages; |
Arnaldo Carvalho de Melo | 0f82ebc | 2011-11-08 14:41:57 -0200 | [diff] [blame] | 73 | unsigned int user_freq; |
Stephane Eranian | a00dc31 | 2012-05-25 23:13:44 +0200 | [diff] [blame] | 74 | u64 branch_stack; |
Stephane Eranian | bcc84ec | 2015-08-31 18:41:12 +0200 | [diff] [blame] | 75 | u64 sample_intr_regs; |
Andi Kleen | 84c4174 | 2017-09-05 10:00:28 -0700 | [diff] [blame] | 76 | u64 sample_user_regs; |
Arnaldo Carvalho de Melo | 0f82ebc | 2011-11-08 14:41:57 -0200 | [diff] [blame] | 77 | u64 default_interval; |
| 78 | u64 user_interval; |
Adrian Hunter | d20031b | 2015-04-30 17:37:31 +0300 | [diff] [blame] | 79 | size_t auxtrace_snapshot_size; |
| 80 | const char *auxtrace_snapshot_opts; |
Andi Kleen | 475eeab | 2013-09-20 07:40:43 -0700 | [diff] [blame] | 81 | bool sample_transaction; |
Andi Kleen | 6619a53 | 2014-01-11 13:38:27 -0800 | [diff] [blame] | 82 | unsigned initial_delay; |
Peter Zijlstra | 814c8c3 | 2015-03-31 00:19:31 +0200 | [diff] [blame] | 83 | bool use_clockid; |
| 84 | clockid_t clockid; |
Alexey Budankov | cf79051 | 2018-10-09 17:36:24 +0300 | [diff] [blame] | 85 | u64 clockid_res_ns; |
Alexey Budankov | d3d1af6 | 2018-11-06 12:04:58 +0300 | [diff] [blame] | 86 | int nr_cblocks; |
Alexey Budankov | 9d2ed64 | 2019-01-22 20:47:43 +0300 | [diff] [blame] | 87 | int affinity; |
| 88 | }; |
| 89 | |
| 90 | enum perf_affinity { |
| 91 | PERF_AFFINITY_SYS = 0, |
| 92 | PERF_AFFINITY_NODE, |
| 93 | PERF_AFFINITY_CPU, |
| 94 | PERF_AFFINITY_MAX |
Arnaldo Carvalho de Melo | 0f82ebc | 2011-11-08 14:41:57 -0200 | [diff] [blame] | 95 | }; |
| 96 | |
Namhyung Kim | e5b2c20 | 2014-10-23 00:15:46 +0900 | [diff] [blame] | 97 | struct option; |
| 98 | extern const char * const *record_usage; |
| 99 | extern struct option *record_options; |
Jin Yao | 3aa94b1 | 2018-03-30 17:27:15 +0800 | [diff] [blame] | 100 | extern int version_verbose; |
Arnaldo Carvalho de Melo | 6723047 | 2018-03-01 13:46:23 -0300 | [diff] [blame] | 101 | |
| 102 | int record__parse_freq(const struct option *opt, const char *str, int unset); |
Thomas Gleixner | 6eda583 | 2009-05-01 18:29:57 +0200 | [diff] [blame] | 103 | #endif |