2 #include <linux/compiler.h> 21 const char *argv[] = {
"true", NULL, };
25 pr_debug(
"attaching to spawned child, enable on exec\n");
29 pr_debug(
"Not enough memory to create thread/cpu maps\n");
35 pr_debug(
"Couldn't run the workload!\n");
39 evsel->
attr.enable_on_exec = 1;
44 str_error_r(errno, sbuf,
sizeof(sbuf)));
63 pr_debug(
"attaching to current thread as disabled\n");
66 if (threads == NULL) {
71 evsel->
attr.disabled = 1;
75 pr_debug(
"Failed to open event cpu-clock:u\n");
89 pr_debug(
"attaching to current thread as enabled\n");
92 if (threads == NULL) {
93 pr_debug(
"failed to call thread_map__new\n");
116 pr_debug(
"attaching to CPU 0 as enabled\n");
120 pr_debug(
"failed to call cpu_map__new\n");
124 evsel->
attr.disabled = 1;
131 pr_debug(
"Failed to open event cpu-clock:u\n");
145 pr_debug(
"attaching to CPU 0 as enabled\n");
149 pr_debug(
"failed to call cpu_map__new\n");
171 pr_debug(
"failed to create event list\n");
177 pr_debug(
"failed to parse event cpu-clock:u\n");
182 evsel->
attr.read_format |=
183 PERF_FORMAT_TOTAL_TIME_ENABLED |
184 PERF_FORMAT_TOTAL_TIME_RUNNING;
186 err = attach(evlist);
188 pr_debug(
" SKIP : not enough rights\n");
194 for (i = 0; i < 100000000; i++) { }
200 err = !(count.
ena == count.
run);
202 pr_debug(
" %s: ena %" PRIu64
", run %" PRIu64
"\n",
203 !err ?
"OK " :
"FAILED",
221 #define _T(attach, detach) \ 222 err = test_times(attach, detach); \ 223 if (err && (ret == TEST_OK || ret == TEST_SKIP)) \ int perf_evlist__prepare_workload(struct perf_evlist *evlist, struct target *target, const char *argv[], bool pipe_output, void(*exec_error)(int signo, siginfo_t *info, void *ucontext))
struct perf_evlist::@110 workload
int perf_evlist__create_maps(struct perf_evlist *evlist, struct target *target)
static int detach__disable(struct perf_evlist *evlist)
#define TEST_ASSERT_VAL(text, cond)
int perf_evsel__read(struct perf_evsel *evsel, int cpu, int thread, struct perf_counts_values *count)
static int attach__cpu_disabled(struct perf_evlist *evlist)
void perf_evlist__delete(struct perf_evlist *evlist)
static int attach__enable_on_exec(struct perf_evlist *evlist)
int perf_evlist__start_workload(struct perf_evlist *evlist)
#define _T(attach, detach)
int parse_events(struct perf_evlist *evlist, const char *str, struct parse_events_error *err)
int perf_evsel__open_per_cpu(struct perf_evsel *evsel, struct cpu_map *cpus)
void cpu_map__put(struct cpu_map *map)
struct perf_evlist * evlist
#define pr_debug(fmt,...)
static int attach__current_enabled(struct perf_evlist *evlist)
int perf_evlist__open(struct perf_evlist *evlist)
int perf_evsel__open_per_thread(struct perf_evsel *evsel, struct thread_map *threads)
static int attach__current_disabled(struct perf_evlist *evlist)
static int test_times(int(attach)(struct perf_evlist *), int(detach)(struct perf_evlist *))
static int attach__cpu_enabled(struct perf_evlist *evlist)
static int detach__enable_on_exec(struct perf_evlist *evlist)
static struct thread_data threads[THREADS]
int perf_evsel__enable(struct perf_evsel *evsel)
void thread_map__put(struct thread_map *map)
static struct perf_evsel * perf_evlist__last(struct perf_evlist *evlist)
struct thread_map * thread_map__new(pid_t pid, pid_t tid, uid_t uid)
int test__event_times(struct test *test __maybe_unused, int subtest __maybe_unused)
struct cpu_map * cpu_map__new(const char *cpu_list)
struct perf_evlist * perf_evlist__new(void)
struct perf_event_attr attr