xref: /linux/tools/perf/util/off_cpu.h (revision e9ef810dfee7a2227da9d423aecb0ced35faddbe)
1 #ifndef PERF_UTIL_OFF_CPU_H
2 #define PERF_UTIL_OFF_CPU_H
3 
4 #include <linux/perf_event.h>
5 
6 struct evlist;
7 struct target;
8 struct perf_session;
9 struct record_opts;
10 
11 #define OFFCPU_EVENT  "offcpu-time"
12 
13 #define OFFCPU_SAMPLE_TYPES  (PERF_SAMPLE_IDENTIFIER | PERF_SAMPLE_IP | \
14 			      PERF_SAMPLE_TID | PERF_SAMPLE_TIME | \
15 			      PERF_SAMPLE_ID | PERF_SAMPLE_CPU | \
16 			      PERF_SAMPLE_PERIOD | PERF_SAMPLE_RAW | \
17 			      PERF_SAMPLE_CGROUP)
18 
19 #define OFFCPU_THRESH 500000000ULL
20 
21 #ifdef HAVE_BPF_SKEL
22 int off_cpu_prepare(struct evlist *evlist, struct target *target,
23 		    struct record_opts *opts);
24 int off_cpu_write(struct perf_session *session);
25 #else
off_cpu_prepare(struct evlist * evlist __maybe_unused,struct target * target __maybe_unused,struct record_opts * opts __maybe_unused)26 static inline int off_cpu_prepare(struct evlist *evlist __maybe_unused,
27 				  struct target *target __maybe_unused,
28 				  struct record_opts *opts __maybe_unused)
29 {
30 	return -1;
31 }
32 
off_cpu_write(struct perf_session * session __maybe_unused)33 static inline int off_cpu_write(struct perf_session *session __maybe_unused)
34 {
35 	return -1;
36 }
37 #endif
38 
39 #endif  /* PERF_UTIL_OFF_CPU_H */
40