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> |
| 8 | #include <linux/perf_event.h> |
| 9 | |
| 10 | extern bool test_attr__enabled; |
Jiri Olsa | 10213e2 | 2017-07-03 16:50:18 +0200 | [diff] [blame] | 11 | void test_attr__ready(void); |
Jiri Olsa | 82baa0e | 2014-05-05 12:58:31 +0200 | [diff] [blame] | 12 | void test_attr__init(void); |
| 13 | void test_attr__open(struct perf_event_attr *attr, pid_t pid, int cpu, |
| 14 | int fd, int group_fd, unsigned long flags); |
| 15 | |
| 16 | #define HAVE_ATTR_TEST |
Jiri Olsa | 43599d1 | 2014-05-05 12:53:20 +0200 | [diff] [blame] | 17 | #include "perf-sys.h" |
Peter Zijlstra | a94d342 | 2013-10-30 11:42:46 +0100 | [diff] [blame] | 18 | |
Thomas Gleixner | a92e70237 | 2009-05-01 18:39:47 +0200 | [diff] [blame] | 19 | static inline unsigned long long rdclock(void) |
| 20 | { |
| 21 | struct timespec ts; |
| 22 | |
| 23 | clock_gettime(CLOCK_MONOTONIC, &ts); |
| 24 | return ts.tv_sec * 1000000000ULL + ts.tv_nsec; |
| 25 | } |
Thomas Gleixner | 6eda583 | 2009-05-01 18:29:57 +0200 | [diff] [blame] | 26 | |
David Ahern | 4d25576 | 2015-03-24 12:10:38 -0400 | [diff] [blame] | 27 | #define MAX_NR_CPUS 1024 |
Thomas Gleixner | 6eda583 | 2009-05-01 18:29:57 +0200 | [diff] [blame] | 28 | |
Feng Tang | 70cb4e9 | 2012-10-30 11:56:02 +0800 | [diff] [blame] | 29 | extern const char *input_name; |
Arnaldo Carvalho de Melo | 8035458 | 2010-05-17 15:51:10 -0300 | [diff] [blame] | 30 | extern bool perf_host, perf_guest; |
Stephane Eranian | fbe96f2 | 2011-09-30 15:40:40 +0200 | [diff] [blame] | 31 | extern const char perf_version_string[]; |
Zhang, Yanmin | a1645ce | 2010-04-19 13:32:50 +0800 | [diff] [blame] | 32 | |
Arnaldo Carvalho de Melo | 3af6e33 | 2011-10-13 08:52:46 -0300 | [diff] [blame] | 33 | void pthread__unblock_sigwinch(void); |
| 34 | |
Namhyung Kim | 12864b3 | 2012-04-26 14:15:22 +0900 | [diff] [blame] | 35 | #include "util/target.h" |
Namhyung Kim | bea0340 | 2012-04-26 14:15:15 +0900 | [diff] [blame] | 36 | |
Arnaldo Carvalho de Melo | b400679 | 2013-12-19 14:43:45 -0300 | [diff] [blame] | 37 | struct record_opts { |
Arnaldo Carvalho de Melo | 602ad87 | 2013-11-12 16:46:16 -0300 | [diff] [blame] | 38 | struct target target; |
Arnaldo Carvalho de Melo | ed80f58 | 2011-11-11 15:12:56 -0200 | [diff] [blame] | 39 | bool group; |
Arnaldo Carvalho de Melo | 0f82ebc | 2011-11-08 14:41:57 -0200 | [diff] [blame] | 40 | bool inherit_stat; |
Arnaldo Carvalho de Melo | 509051e | 2014-01-14 17:52:14 -0300 | [diff] [blame] | 41 | bool no_buffering; |
Arnaldo Carvalho de Melo | 0f82ebc | 2011-11-08 14:41:57 -0200 | [diff] [blame] | 42 | bool no_inherit; |
Adrian Hunter | 69e7e5b | 2013-11-18 11:55:57 +0200 | [diff] [blame] | 43 | bool no_inherit_set; |
Arnaldo Carvalho de Melo | 0f82ebc | 2011-11-08 14:41:57 -0200 | [diff] [blame] | 44 | bool no_samples; |
| 45 | bool raw_samples; |
| 46 | bool sample_address; |
Kan Liang | 3b0a5da | 2017-08-29 13:11:08 -0400 | [diff] [blame] | 47 | bool sample_phys_addr; |
Andi Kleen | 0548429 | 2013-01-24 16:10:29 +0100 | [diff] [blame] | 48 | bool sample_weight; |
Arnaldo Carvalho de Melo | 0f82ebc | 2011-11-08 14:41:57 -0200 | [diff] [blame] | 49 | bool sample_time; |
Adrian Hunter | 3abebc5 | 2015-07-06 14:51:01 +0300 | [diff] [blame] | 50 | bool sample_time_set; |
Jiri Olsa | b6f35ed | 2016-08-01 20:02:35 +0200 | [diff] [blame] | 51 | bool sample_cpu; |
Andrew Vagin | 3e76ac7 | 2011-12-20 17:32:45 +0300 | [diff] [blame] | 52 | bool period; |
Jiri Olsa | f290aa1 | 2018-02-01 09:38:11 +0100 | [diff] [blame] | 53 | bool period_set; |
Andi Kleen | 85c273d | 2015-02-24 15:13:40 -0800 | [diff] [blame] | 54 | bool running_time; |
Adrian Hunter | 9e0cc4f | 2015-04-09 18:53:44 +0300 | [diff] [blame] | 55 | bool full_auxtrace; |
Adrian Hunter | d20031b | 2015-04-30 17:37:31 +0300 | [diff] [blame] | 56 | bool auxtrace_snapshot_mode; |
Hari Bathini | f3b3614 | 2017-03-08 02:11:43 +0530 | [diff] [blame] | 57 | bool record_namespaces; |
Adrian Hunter | b757bb0 | 2015-07-21 12:44:04 +0300 | [diff] [blame] | 58 | bool record_switch_events; |
Jiri Olsa | 8572388 | 2016-02-15 09:34:31 +0100 | [diff] [blame] | 59 | bool all_kernel; |
| 60 | bool all_user; |
Wang Nan | 4ea648a | 2016-07-14 08:34:47 +0000 | [diff] [blame] | 61 | bool tail_synthesize; |
Wang Nan | 626a6b7 | 2016-07-14 08:34:45 +0000 | [diff] [blame] | 62 | bool overwrite; |
Jiri Olsa | a359c17 | 2016-12-13 08:46:22 +0100 | [diff] [blame] | 63 | bool ignore_missing_thread; |
Arnaldo Carvalho de Melo | 0f82ebc | 2011-11-08 14:41:57 -0200 | [diff] [blame] | 64 | unsigned int freq; |
Arnaldo Carvalho de Melo | 01c2d99 | 2011-11-09 09:16:26 -0200 | [diff] [blame] | 65 | unsigned int mmap_pages; |
Adrian Hunter | 9e0cc4f | 2015-04-09 18:53:44 +0300 | [diff] [blame] | 66 | unsigned int auxtrace_mmap_pages; |
Arnaldo Carvalho de Melo | 0f82ebc | 2011-11-08 14:41:57 -0200 | [diff] [blame] | 67 | unsigned int user_freq; |
Stephane Eranian | a00dc31 | 2012-05-25 23:13:44 +0200 | [diff] [blame] | 68 | u64 branch_stack; |
Stephane Eranian | bcc84ec | 2015-08-31 18:41:12 +0200 | [diff] [blame] | 69 | u64 sample_intr_regs; |
Andi Kleen | 84c4174 | 2017-09-05 10:00:28 -0700 | [diff] [blame] | 70 | u64 sample_user_regs; |
Arnaldo Carvalho de Melo | 0f82ebc | 2011-11-08 14:41:57 -0200 | [diff] [blame] | 71 | u64 default_interval; |
| 72 | u64 user_interval; |
Adrian Hunter | d20031b | 2015-04-30 17:37:31 +0300 | [diff] [blame] | 73 | size_t auxtrace_snapshot_size; |
| 74 | const char *auxtrace_snapshot_opts; |
Andi Kleen | 475eeab | 2013-09-20 07:40:43 -0700 | [diff] [blame] | 75 | bool sample_transaction; |
Andi Kleen | 6619a53 | 2014-01-11 13:38:27 -0800 | [diff] [blame] | 76 | unsigned initial_delay; |
Peter Zijlstra | 814c8c3 | 2015-03-31 00:19:31 +0200 | [diff] [blame] | 77 | bool use_clockid; |
| 78 | clockid_t clockid; |
Kan Liang | 9d9cad7 | 2015-06-17 09:51:11 -0400 | [diff] [blame] | 79 | unsigned int proc_map_timeout; |
Arnaldo Carvalho de Melo | 0f82ebc | 2011-11-08 14:41:57 -0200 | [diff] [blame] | 80 | }; |
| 81 | |
Namhyung Kim | e5b2c20 | 2014-10-23 00:15:46 +0900 | [diff] [blame] | 82 | struct option; |
| 83 | extern const char * const *record_usage; |
| 84 | extern struct option *record_options; |
Arnaldo Carvalho de Melo | 6723047 | 2018-03-01 13:46:23 -0300 | [diff] [blame^] | 85 | |
| 86 | 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] | 87 | #endif |