Lines Matching +full:sample +full:- +full:time

1 // SPDX-License-Identifier: GPL-2.0
15 #include "util/sample.h"
19 int i, cpu = -1, nrcpus = 1024; in sched__get_first_possible_cpu()
23 if (sched_getaffinity(pid, sizeof(*maskp), maskp) == -1) { in sched__get_first_possible_cpu()
29 return -1; in sched__get_first_possible_cpu()
34 if (cpu == -1) in sched__get_first_possible_cpu()
58 struct perf_sample sample; in test__PERF_RECORD() local
68 int err = -1, errs = 0, i, wakeups = 0; in test__PERF_RECORD()
83 * we start with all threads and cpus (-1, -1) but then in in test__PERF_RECORD()
96 * so that we have time to open the evlist (calling sys_perf_event_open in test__PERF_RECORD()
106 * Config the evsels, setting attr->comm on the first one, etc. in test__PERF_RECORD()
111 evsel__set_sample_bit(evsel, TIME); in test__PERF_RECORD()
114 err = sched__get_first_possible_cpu(evlist->workload.pid, &cpu_mask); in test__PERF_RECORD()
126 if (sched_setaffinity(evlist->workload.pid, cpu_mask_size, &cpu_mask) < 0) { in test__PERF_RECORD()
169 for (i = 0; i < evlist->core.nr_mmaps; i++) { in test__PERF_RECORD()
173 md = &evlist->mmap[i]; in test__PERF_RECORD()
174 if (perf_mmap__read_init(&md->core) < 0) in test__PERF_RECORD()
177 while ((event = perf_mmap__read_event(&md->core)) != NULL) { in test__PERF_RECORD()
178 const u32 type = event->header.type; in test__PERF_RECORD()
185 err = evlist__parse_sample(evlist, event, &sample); in test__PERF_RECORD()
189 pr_debug("Couldn't parse sample\n"); in test__PERF_RECORD()
194 pr_info("%" PRIu64" %d ", sample.time, sample.cpu); in test__PERF_RECORD()
198 if (prev_time > sample.time) { in test__PERF_RECORD()
199 pr_debug("%s going backwards in time, prev=%" PRIu64 ", curr=%" PRIu64 "\n", in test__PERF_RECORD()
200 name, prev_time, sample.time); in test__PERF_RECORD()
204 prev_time = sample.time; in test__PERF_RECORD()
206 if (sample.cpu != cpu) { in test__PERF_RECORD()
208 name, cpu, sample.cpu); in test__PERF_RECORD()
212 if ((pid_t)sample.pid != evlist->workload.pid) { in test__PERF_RECORD()
214 name, evlist->workload.pid, sample.pid); in test__PERF_RECORD()
218 if ((pid_t)sample.tid != evlist->workload.pid) { in test__PERF_RECORD()
220 name, evlist->workload.pid, sample.tid); in test__PERF_RECORD()
229 (pid_t)event->comm.pid != evlist->workload.pid) { in test__PERF_RECORD()
237 event->comm.pid != event->comm.tid) { in test__PERF_RECORD()
244 if (strcmp(event->comm.comm, cmd)) { in test__PERF_RECORD()
252 mmap_filename = event->mmap.filename; in test__PERF_RECORD()
255 mmap_filename = event->mmap2.filename; in test__PERF_RECORD()
275 pr_debug("Unexpected perf_event->header.type %d!\n", in test__PERF_RECORD()
280 perf_mmap__consume(&md->core); in test__PERF_RECORD()
282 perf_mmap__read_done(&md->core); in test__PERF_RECORD()
287 * PERF_RECORD_{!SAMPLE} events don't honour in test__PERF_RECORD()
291 evlist__poll(evlist, -1); in test__PERF_RECORD()
333 if (err == -EACCES) in test__PERF_RECORD()