blob: d215714f48df5ebb259d8fddf98d2f831dcee513 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Thomas Gleixner6eda5832009-05-01 18:29:57 +02002#ifndef _PERF_PERF_H
3#define _PERF_PERF_H
4
Jiri Olsa82baa0e2014-05-05 12:58:31 +02005#include <time.h>
6#include <stdbool.h>
7#include <linux/types.h>
Arnaldo Carvalho de Melo44fe6192018-07-30 13:15:03 -03008#include <linux/stddef.h>
Jiri Olsa82baa0e2014-05-05 12:58:31 +02009#include <linux/perf_event.h>
10
11extern bool test_attr__enabled;
Jiri Olsa10213e22017-07-03 16:50:18 +020012void test_attr__ready(void);
Jiri Olsa82baa0e2014-05-05 12:58:31 +020013void test_attr__init(void);
14void 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 Olsa43599d12014-05-05 12:53:20 +020018#include "perf-sys.h"
Peter Zijlstraa94d3422013-10-30 11:42:46 +010019
Thomas Gleixnera92e702372009-05-01 18:39:47 +020020static 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 Gleixner6eda5832009-05-01 18:29:57 +020027
David Ahern4d255762015-03-24 12:10:38 -040028#define MAX_NR_CPUS 1024
Thomas Gleixner6eda5832009-05-01 18:29:57 +020029
Feng Tang70cb4e92012-10-30 11:56:02 +080030extern const char *input_name;
Arnaldo Carvalho de Melo80354582010-05-17 15:51:10 -030031extern bool perf_host, perf_guest;
Stephane Eranianfbe96f22011-09-30 15:40:40 +020032extern const char perf_version_string[];
Zhang, Yanmina1645ce2010-04-19 13:32:50 +080033
Arnaldo Carvalho de Melo3af6e332011-10-13 08:52:46 -030034void pthread__unblock_sigwinch(void);
35
Namhyung Kim12864b32012-04-26 14:15:22 +090036#include "util/target.h"
Namhyung Kimbea03402012-04-26 14:15:15 +090037
Arnaldo Carvalho de Melob4006792013-12-19 14:43:45 -030038struct record_opts {
Arnaldo Carvalho de Melo602ad872013-11-12 16:46:16 -030039 struct target target;
Arnaldo Carvalho de Meloed80f582011-11-11 15:12:56 -020040 bool group;
Arnaldo Carvalho de Melo0f82ebc2011-11-08 14:41:57 -020041 bool inherit_stat;
Arnaldo Carvalho de Melo509051e2014-01-14 17:52:14 -030042 bool no_buffering;
Arnaldo Carvalho de Melo0f82ebc2011-11-08 14:41:57 -020043 bool no_inherit;
Adrian Hunter69e7e5b2013-11-18 11:55:57 +020044 bool no_inherit_set;
Arnaldo Carvalho de Melo0f82ebc2011-11-08 14:41:57 -020045 bool no_samples;
46 bool raw_samples;
47 bool sample_address;
Kan Liang3b0a5da2017-08-29 13:11:08 -040048 bool sample_phys_addr;
Andi Kleen05484292013-01-24 16:10:29 +010049 bool sample_weight;
Arnaldo Carvalho de Melo0f82ebc2011-11-08 14:41:57 -020050 bool sample_time;
Adrian Hunter3abebc52015-07-06 14:51:01 +030051 bool sample_time_set;
Jiri Olsab6f35ed2016-08-01 20:02:35 +020052 bool sample_cpu;
Andrew Vagin3e76ac72011-12-20 17:32:45 +030053 bool period;
Jiri Olsaf290aa12018-02-01 09:38:11 +010054 bool period_set;
Andi Kleen85c273d2015-02-24 15:13:40 -080055 bool running_time;
Adrian Hunter9e0cc4f2015-04-09 18:53:44 +030056 bool full_auxtrace;
Adrian Hunterd20031b2015-04-30 17:37:31 +030057 bool auxtrace_snapshot_mode;
Hari Bathinif3b36142017-03-08 02:11:43 +053058 bool record_namespaces;
Adrian Hunterb757bb02015-07-21 12:44:04 +030059 bool record_switch_events;
Jiri Olsa85723882016-02-15 09:34:31 +010060 bool all_kernel;
61 bool all_user;
Wang Nan4ea648a2016-07-14 08:34:47 +000062 bool tail_synthesize;
Wang Nan626a6b72016-07-14 08:34:45 +000063 bool overwrite;
Jiri Olsaa359c172016-12-13 08:46:22 +010064 bool ignore_missing_thread;
Arnaldo Carvalho de Melob09c2362018-03-01 14:52:50 -030065 bool strict_freq;
Jiri Olsaad46e48c2018-03-02 17:13:54 +010066 bool sample_id;
Arnaldo Carvalho de Melo0f82ebc2011-11-08 14:41:57 -020067 unsigned int freq;
Arnaldo Carvalho de Melo01c2d992011-11-09 09:16:26 -020068 unsigned int mmap_pages;
Adrian Hunter9e0cc4f2015-04-09 18:53:44 +030069 unsigned int auxtrace_mmap_pages;
Arnaldo Carvalho de Melo0f82ebc2011-11-08 14:41:57 -020070 unsigned int user_freq;
Stephane Eraniana00dc312012-05-25 23:13:44 +020071 u64 branch_stack;
Stephane Eranianbcc84ec2015-08-31 18:41:12 +020072 u64 sample_intr_regs;
Andi Kleen84c41742017-09-05 10:00:28 -070073 u64 sample_user_regs;
Arnaldo Carvalho de Melo0f82ebc2011-11-08 14:41:57 -020074 u64 default_interval;
75 u64 user_interval;
Adrian Hunterd20031b2015-04-30 17:37:31 +030076 size_t auxtrace_snapshot_size;
77 const char *auxtrace_snapshot_opts;
Andi Kleen475eeab2013-09-20 07:40:43 -070078 bool sample_transaction;
Andi Kleen6619a532014-01-11 13:38:27 -080079 unsigned initial_delay;
Peter Zijlstra814c8c32015-03-31 00:19:31 +020080 bool use_clockid;
81 clockid_t clockid;
Kan Liang9d9cad72015-06-17 09:51:11 -040082 unsigned int proc_map_timeout;
Arnaldo Carvalho de Melo0f82ebc2011-11-08 14:41:57 -020083};
84
Namhyung Kime5b2c202014-10-23 00:15:46 +090085struct option;
86extern const char * const *record_usage;
87extern struct option *record_options;
Jin Yao3aa94b12018-03-30 17:27:15 +080088extern int version_verbose;
Arnaldo Carvalho de Melo67230472018-03-01 13:46:23 -030089
90int record__parse_freq(const struct option *opt, const char *str, int unset);
Thomas Gleixner6eda5832009-05-01 18:29:57 +020091#endif