Re: [PATCH v6 1/4] perf,record: Add clockid parameter

Peter Zijlstra
2015-03-31T07:16:21Z

On Tue, Mar 31, 2015 at 12:19:31AM +0200, Stephane Eranian wrote:

You seem to have misplaced the hunk that goes with the

fallback_missing_features:

label.

> @@ -1122,6 +1132,16 @@ static int __perf_evsel__open(struct perf_evsel *evsel, struct cpu_map *cpus,
> goto try_fallback;
> }
> set_rlimit = NO_CHANGE;
> +
> + /*
> + * If we succeeded but had to kill clockid, fail and
> + * have perf_evsel__open_strerror() print us a nice
> + * error.
> + */
> + if (perf_missing_features.clockid) {
> + err = -EINVAL;
> + goto out_close;
> + }
> }
> }
>
> @@ -1155,7 +1175,10 @@ static int __perf_evsel__open(struct perf_evsel *evsel, struct cpu_map *cpus,
> if (err != -EINVAL || cpu > 0 || thread > 0)
> goto out_close;
>
> - if (!perf_missing_features.cloexec && (flags & PERF_FLAG_FD_CLOEXEC)) {
> + if (!perf_missing_features.clockid && evsel->attr.use_clockid) {
> + perf_missing_features.clockid = true;
> + goto fallback_missing_features;
> + } else if (!perf_missing_features.cloexec && (flags & PERF_FLAG_FD_CLOEXEC)) {
> perf_missing_features.cloexec = true;
> goto fallback_missing_features;
> } else if (!perf_missing_features.mmap2 && evsel->attr.mmap2) {
> @@ -2080,6 +2103,8 @@ int perf_evsel__fprintf(struct perf_evsel *evsel,
> if_print(wakeup_events);
> if_print(bp_type);
> if_print(branch_sample_type);
> + if_print(clockid);
> +
> }
> out:
> fputc('\n', fp);