lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YkRgHmEc2GDtXfZp@krava>
Date:   Wed, 30 Mar 2022 15:50:22 +0200
From:   Jiri Olsa <olsajiri@...il.com>
To:     Shunsuke Nakamura <nakamura.shun@...itsu.com>
Cc:     peterz@...radead.org, mingo@...hat.com, acme@...nel.org,
        mark.rutland@....com, alexander.shishkin@...ux.intel.com,
        jolsa@...hat.com, namhyung@...nel.org,
        linux-kernel@...r.kernel.org, linux-perf-users@...r.kernel.org
Subject: Re: [RFC PATCH v2 3/7] libperf: Add perf_evsel__{refresh, period}()
 functions

On Fri, Mar 25, 2022 at 01:38:25PM +0900, Shunsuke Nakamura wrote:

SNIP

> +int perf_evsel__refresh_cpu(struct perf_evsel *evsel, int refresh, int cpu_map_idx)
> +{
> +	return perf_evsel__run_ioctl(evsel, PERF_EVENT_IOC_REFRESH, refresh, cpu_map_idx);
> +}
> +
> +int perf_evsel__refresh(struct perf_evsel *evsel, int refresh)
> +{
> +	int i;
> +	int err = 0;
> +
> +	for (i = 0; i < xyarray__max_x(evsel->fd) && !err; i++)
> +		err = perf_evsel__run_ioctl(evsel, PERF_EVENT_IOC_REFRESH, refresh, i);
> +	return err;
> +}
> +
> +int perf_evsel__period_cpu(struct perf_evsel *evsel, __u64 period, int cpu_map_idx)
> +{
> +	struct perf_event_attr *attr;
> +	int err = 0;
> +
> +	attr = perf_evsel__attr(evsel);
> +	if (!attr)
> +		return -EINVAL;
> +
> +	err = perf_evsel__run_ioctl(evsel, PERF_EVENT_IOC_PERIOD,
> +				    (unsigned long)&period, cpu_map_idx);
> +	if (err)
> +		return err;
> +
> +	attr->sample_period = period;

what's the point in updating attr? this will be used after
event is created right?

> +
> +	return err;
> +}
> +
> +int perf_evsel__period(struct perf_evsel *evsel, __u64 period)
> +{
> +	struct perf_event_attr *attr;
> +	int i;
> +	int err = 0;
> +
> +	attr = perf_evsel__attr(evsel);
> +	if (!attr)
> +		return -EINVAL;
> +
> +	for (i = 0; i < xyarray__max_x(evsel->fd); i++) {
> +		err = perf_evsel__run_ioctl(evsel, PERF_EVENT_IOC_PERIOD,
> +					    (unsigned long)&period, i);
> +		if (err)
> +			return err;
> +	}
> +
> +	attr->sample_period = period;

same as above

thanks,
jirka

> +
>  	return err;
>  }
>  

SNIP

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ