Lines Matching +full:sample +full:- +full:time
1 // SPDX-License-Identifier: GPL-2.0
15 #include "parse-events.h"
23 #include "util/sample.h"
61 * test__perf_time_to_tsc - test converting perf time to TSC.
63 * This function implements a test that checks that the conversion of perf time
65 * %0 is returned, otherwise %-1 is returned. If TSC conversion is not
93 threads = thread_map__new(-1, getpid(), UINT_MAX); in test__perf_time_to_tsc()
102 perf_evlist__set_maps(&evlist->core, cpus, threads); in test__perf_time_to_tsc()
110 evsel->core.attr.comm = 1; in test__perf_time_to_tsc()
111 evsel->core.attr.disabled = 1; in test__perf_time_to_tsc()
112 evsel->core.attr.enable_on_exec = 0; in test__perf_time_to_tsc()
117 if (ret == -ENOENT) in test__perf_time_to_tsc()
126 pc = evlist->mmap[0].core.base; in test__perf_time_to_tsc()
129 if (ret == -EOPNOTSUPP) { in test__perf_time_to_tsc()
148 for (i = 0; i < evlist->core.nr_mmaps; i++) { in test__perf_time_to_tsc()
149 md = &evlist->mmap[i]; in test__perf_time_to_tsc()
150 if (perf_mmap__read_init(&md->core) < 0) in test__perf_time_to_tsc()
153 while ((event = perf_mmap__read_event(&md->core)) != NULL) { in test__perf_time_to_tsc()
154 struct perf_sample sample; in test__perf_time_to_tsc() local
156 if (event->header.type != PERF_RECORD_COMM || in test__perf_time_to_tsc()
157 (pid_t)event->comm.pid != getpid() || in test__perf_time_to_tsc()
158 (pid_t)event->comm.tid != getpid()) in test__perf_time_to_tsc()
161 if (strcmp(event->comm.comm, comm1) == 0) { in test__perf_time_to_tsc()
163 CHECK__(evsel__parse_sample(evsel, event, &sample)); in test__perf_time_to_tsc()
164 comm1_time = sample.time; in test__perf_time_to_tsc()
166 if (strcmp(event->comm.comm, comm2) == 0) { in test__perf_time_to_tsc()
168 CHECK__(evsel__parse_sample(evsel, event, &sample)); in test__perf_time_to_tsc()
169 comm2_time = sample.time; in test__perf_time_to_tsc()
172 perf_mmap__consume(&md->core); in test__perf_time_to_tsc()
174 perf_mmap__read_done(&md->core); in test__perf_time_to_tsc()
184 pr_debug("1st event perf time %"PRIu64" tsc %"PRIu64"\n", in test__perf_time_to_tsc()
186 pr_debug("rdtsc time %"PRIu64" tsc %"PRIu64"\n", in test__perf_time_to_tsc()
188 pr_debug("2nd event perf time %"PRIu64" tsc %"PRIu64"\n", in test__perf_time_to_tsc()
211 TEST_CASE_REASON("Perf time to TSC", perf_time_to_tsc,
217 .desc = "Convert perf time to TSC",