perf.h 1.7 KB
Newer Older
1 2 3
#ifndef _PERF_PERF_H
#define _PERF_PERF_H

4
#include <time.h>
5
#include <stdbool.h>
B
Borislav Petkov 已提交
6
#include <linux/types.h>
7
#include <linux/perf_event.h>
8

9 10 11 12 13 14 15 16
extern bool test_attr__enabled;
void test_attr__init(void);
void test_attr__open(struct perf_event_attr *attr, pid_t pid, int cpu,
		     int fd, int group_fd, unsigned long flags);

#define HAVE_ATTR_TEST
#include "perf-sys.h"

17 18 19
#ifndef NSEC_PER_SEC
# define NSEC_PER_SEC			1000000000ULL
#endif
20 21 22
#ifndef NSEC_PER_USEC
# define NSEC_PER_USEC			1000ULL
#endif
23 24 25 26 27 28 29 30

static inline unsigned long long rdclock(void)
{
	struct timespec ts;

	clock_gettime(CLOCK_MONOTONIC, &ts);
	return ts.tv_sec * 1000000000ULL + ts.tv_nsec;
}
31

32
#define MAX_NR_CPUS			1024
33

34
extern const char *input_name;
35
extern bool perf_host, perf_guest;
36
extern const char perf_version_string[];
37

38 39
void pthread__unblock_sigwinch(void);

40
#include "util/target.h"
41

42
struct record_opts {
43
	struct target target;
44
	bool	     group;
45
	bool	     inherit_stat;
46
	bool	     no_buffering;
47
	bool	     no_inherit;
48
	bool	     no_inherit_set;
49 50 51
	bool	     no_samples;
	bool	     raw_samples;
	bool	     sample_address;
52
	bool	     sample_weight;
53
	bool	     sample_time;
54
	bool	     period;
55
	bool	     sample_intr_regs;
56
	bool	     running_time;
57
	bool	     full_auxtrace;
58
	bool	     auxtrace_snapshot_mode;
59
	unsigned int freq;
60
	unsigned int mmap_pages;
61
	unsigned int auxtrace_mmap_pages;
62
	unsigned int user_freq;
63
	u64          branch_stack;
64 65
	u64	     default_interval;
	u64	     user_interval;
66 67
	size_t	     auxtrace_snapshot_size;
	const char   *auxtrace_snapshot_opts;
68
	bool	     sample_transaction;
69
	unsigned     initial_delay;
70 71
	bool         use_clockid;
	clockid_t    clockid;
72
	unsigned int proc_map_timeout;
73 74
};

75 76 77
struct option;
extern const char * const *record_usage;
extern struct option *record_options;
78
#endif