2022-05-18 15:47:21 -07:00
|
|
|
#ifndef PERF_UTIL_OFF_CPU_H
|
|
|
|
|
#define PERF_UTIL_OFF_CPU_H
|
|
|
|
|
|
2022-06-24 16:13:09 -07:00
|
|
|
#include <linux/perf_event.h>
|
|
|
|
|
|
2022-05-18 15:47:21 -07:00
|
|
|
struct evlist;
|
2022-05-18 15:47:22 -07:00
|
|
|
struct target;
|
2022-05-18 15:47:21 -07:00
|
|
|
struct perf_session;
|
2022-05-18 15:47:24 -07:00
|
|
|
struct record_opts;
|
2022-05-18 15:47:21 -07:00
|
|
|
|
|
|
|
|
#define OFFCPU_EVENT "offcpu-time"
|
|
|
|
|
|
2022-06-24 16:13:09 -07:00
|
|
|
#define OFFCPU_SAMPLE_TYPES (PERF_SAMPLE_IDENTIFIER | PERF_SAMPLE_IP | \
|
|
|
|
|
PERF_SAMPLE_TID | PERF_SAMPLE_TIME | \
|
|
|
|
|
PERF_SAMPLE_ID | PERF_SAMPLE_CPU | \
|
2025-04-30 19:28:04 -07:00
|
|
|
PERF_SAMPLE_PERIOD | PERF_SAMPLE_RAW | \
|
2022-06-24 16:13:09 -07:00
|
|
|
PERF_SAMPLE_CGROUP)
|
|
|
|
|
|
2025-04-30 19:28:07 -07:00
|
|
|
#define OFFCPU_THRESH 500000000ULL
|
2022-06-24 16:13:09 -07:00
|
|
|
|
2022-05-18 15:47:21 -07:00
|
|
|
#ifdef HAVE_BPF_SKEL
|
2022-05-18 15:47:24 -07:00
|
|
|
int off_cpu_prepare(struct evlist *evlist, struct target *target,
|
|
|
|
|
struct record_opts *opts);
|
2022-05-18 15:47:21 -07:00
|
|
|
int off_cpu_write(struct perf_session *session);
|
|
|
|
|
#else
|
2022-05-18 15:47:22 -07:00
|
|
|
static inline int off_cpu_prepare(struct evlist *evlist __maybe_unused,
|
2022-05-18 15:47:24 -07:00
|
|
|
struct target *target __maybe_unused,
|
|
|
|
|
struct record_opts *opts __maybe_unused)
|
2022-05-18 15:47:21 -07:00
|
|
|
{
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline int off_cpu_write(struct perf_session *session __maybe_unused)
|
|
|
|
|
{
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#endif /* PERF_UTIL_OFF_CPU_H */
|