From: Jiri Olsa <olsajiri@gmail.com>
To: Shunsuke <nakamura.shun@fujitsu.com>
Cc: peterz@infradead.org, mingo@redhat.com, acme@kernel.org,
mark.rutland@arm.com, alexander.shishkin@linux.intel.com,
jolsa@redhat.com, namhyung@kernel.org,
linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org
Subject: Re: [RFC PATCH 0/7] libperf: Add overflow detection of sampling events
Date: Sat, 26 Feb 2022 18:23:10 +0100 [thread overview]
Message-ID: <Yhph/u/Jxl31uXew@krava> (raw)
In-Reply-To: <20220225103114.144239-1-nakamura.shun@fujitsu.com>
On Fri, Feb 25, 2022 at 07:31:07PM +0900, Shunsuke wrote:
> From: Shunsuke Nakamura <nakamura.shun@fujitsu.com>
>
> This patch series adds sampling event overflow detection capability
> to libperf.
>
> First patch fixes a typo in the error message that I noticed.
>
> Second patch adds a interface to set PERF_FLAG_FD_CLOEXEC
>
> Third patch adds a interface to perform IOC_REFRESH and IOC_PERIOD.
>
> Fourth patch adds a interface to set the signal handler.
>
> Fifth patch adds a interface to detect overflowed events.
>
> Sixth and seventh patch adds tests.
>
> Shunsuke Nakamura (7):
> libperf tests: Fix typo in the error message "evsel" -> "evlist"
> libperf: Add perf_evsel__set_close_on_exec() function
> libperf: Add perf_evsel__refresh()/period() functions
> libperf: Add perf_evsel__set_signal() functions
> libperf: Add perf_evsel__check_fd() functions
> libperf test: Add test_stat_overflow()
> libperf test: Add test_detect_overflow_event()
hi,
I think the interface might be more clear if we use additional options
for new and open functions, same way like it's done in libbpf
how about adding following interface:
- perf_evsel__new_opts would allow to setup needed attr fields before opening
struct perf_evsel_new_opts {
/* size of this struct, for forward/backward compatiblity */
size_t sz;
int open_flags;
int sample_period;
}
struct perf_evsel *perf_evsel__new_opts(struct perf_event_attr *attr,
struct perf_evsel_new_opts *opts);
- perf_evlist__open_opts would do additional setup 'after' the event
is open and we have file descriptor available
struct perf_evsel_open_opts {
/* size of this struct, for forward/backward compatiblity */
size_t sz;
int flags; /* fcntl flags */
int signal;
int owner_type;
}
int perf_evlist__open_opts(struct perf_evlist *evlist,
struct perf_evsel_open_opts *opts);)
int perf_evsel__open_opts(struct perf_evsel *evsel,
struct perf_cpu_map *cpus,
struct perf_thread_map *threads,
struct perf_evsel_open_opts *opts)
not sure we want special opts for evlist.. the evlist open
is just a wrapper and I don't think there's special open
info just for evlist
I did not analyze your usecases deeply, so I might be missing some
case where above API would need some adjustment, but from the quick
look this could fit and I think it's better than special functions
for each feature
there are additional macros like DECLARE_LIBBPF_OPTS that allows to
define the opts structures in backward compatible way, we'd need to
'borrow' that as well
thoughts?
thanks,
jirka
next prev parent reply other threads:[~2022-02-26 17:23 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-25 10:31 [RFC PATCH 0/7] libperf: Add overflow detection of sampling events Shunsuke
2022-02-25 10:31 ` [RFC PATCH 1/7] libperf tests: Fix typo in the error message "evsel" -> "evlist" Shunsuke
2022-02-25 10:31 ` [RFC PATCH 2/7] libperf: Add perf_evsel__set_close_on_exec() function Shunsuke
2022-02-25 10:31 ` [RFC PATCH 3/7] libperf: Add perf_evsel__refresh()/period() functions Shunsuke
2022-02-25 10:31 ` [RFC PATCH 4/7] libperf: Add perf_evsel__set_signal() functions Shunsuke
2022-02-25 10:31 ` [RFC PATCH 5/7] libperf: Add perf_evsel__check_fd() functions Shunsuke
2022-02-25 10:31 ` [RFC PATCH 6/7] libperf test: Add test_stat_overflow() Shunsuke
2022-02-25 10:31 ` [RFC PATCH 7/7] libperf test: Add test_detect_overflow_event() Shunsuke
2022-02-26 17:23 ` Jiri Olsa [this message]
2022-03-01 8:32 ` [RFC PATCH 0/7] libperf: Add overflow detection of sampling events nakamura.shun
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Yhph/u/Jxl31uXew@krava \
--to=olsajiri@gmail.com \
--cc=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=nakamura.shun@fujitsu.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).