* [PATCH] perf inject: Make --strip keep evsels
@ 2019-11-05 10:00 Adrian Hunter
2019-11-06 11:03 ` Jiri Olsa
2019-11-12 11:17 ` [tip: perf/core] " tip-bot2 for Adrian Hunter
0 siblings, 2 replies; 4+ messages in thread
From: Adrian Hunter @ 2019-11-05 10:00 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo; +Cc: Jiri Olsa, linux-kernel
create_gcov (refer to the autofdo example in
tools/perf/Documentation/intel-pt.txt) now needs the evsels to read the
perf.data file. So don't strip them.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
tools/perf/builtin-inject.c | 54 -------------------------------------
1 file changed, 54 deletions(-)
diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c
index 372ecb3e2c06..1e5d28311e14 100644
--- a/tools/perf/builtin-inject.c
+++ b/tools/perf/builtin-inject.c
@@ -578,58 +578,6 @@ static void strip_init(struct perf_inject *inject)
evsel->handler = drop_sample;
}
-static bool has_tracking(struct evsel *evsel)
-{
- return evsel->core.attr.mmap || evsel->core.attr.mmap2 || evsel->core.attr.comm ||
- evsel->core.attr.task;
-}
-
-#define COMPAT_MASK (PERF_SAMPLE_ID | PERF_SAMPLE_TID | PERF_SAMPLE_TIME | \
- PERF_SAMPLE_ID | PERF_SAMPLE_CPU | PERF_SAMPLE_IDENTIFIER)
-
-/*
- * In order that the perf.data file is parsable, tracking events like MMAP need
- * their selected event to exist, except if there is only 1 selected event left
- * and it has a compatible sample type.
- */
-static bool ok_to_remove(struct evlist *evlist,
- struct evsel *evsel_to_remove)
-{
- struct evsel *evsel;
- int cnt = 0;
- bool ok = false;
-
- if (!has_tracking(evsel_to_remove))
- return true;
-
- evlist__for_each_entry(evlist, evsel) {
- if (evsel->handler != drop_sample) {
- cnt += 1;
- if ((evsel->core.attr.sample_type & COMPAT_MASK) ==
- (evsel_to_remove->core.attr.sample_type & COMPAT_MASK))
- ok = true;
- }
- }
-
- return ok && cnt == 1;
-}
-
-static void strip_fini(struct perf_inject *inject)
-{
- struct evlist *evlist = inject->session->evlist;
- struct evsel *evsel, *tmp;
-
- /* Remove non-synthesized evsels if possible */
- evlist__for_each_entry_safe(evlist, tmp, evsel) {
- if (evsel->handler == drop_sample &&
- ok_to_remove(evlist, evsel)) {
- pr_debug("Deleting %s\n", perf_evsel__name(evsel));
- evlist__remove(evlist, evsel);
- evsel__delete(evsel);
- }
- }
-}
-
static int __cmd_inject(struct perf_inject *inject)
{
int ret = -EINVAL;
@@ -729,8 +677,6 @@ static int __cmd_inject(struct perf_inject *inject)
evlist__remove(session->evlist, evsel);
evsel__delete(evsel);
}
- if (inject->strip)
- strip_fini(inject);
}
session->header.data_offset = output_data_offset;
session->header.data_size = inject->bytes_written;
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] perf inject: Make --strip keep evsels
2019-11-05 10:00 [PATCH] perf inject: Make --strip keep evsels Adrian Hunter
@ 2019-11-06 11:03 ` Jiri Olsa
2019-11-06 13:56 ` Arnaldo Carvalho de Melo
2019-11-12 11:17 ` [tip: perf/core] " tip-bot2 for Adrian Hunter
1 sibling, 1 reply; 4+ messages in thread
From: Jiri Olsa @ 2019-11-06 11:03 UTC (permalink / raw)
To: Adrian Hunter; +Cc: Arnaldo Carvalho de Melo, linux-kernel
On Tue, Nov 05, 2019 at 12:00:57PM +0200, Adrian Hunter wrote:
> create_gcov (refer to the autofdo example in
> tools/perf/Documentation/intel-pt.txt) now needs the evsels to read the
> perf.data file. So don't strip them.
>
> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
> ---
> tools/perf/builtin-inject.c | 54 -------------------------------------
> 1 file changed, 54 deletions(-)
good stats ;-)
Acked-by: Jiri Olsa <jolsa@kernel.org>
thanks,
jirka
>
> diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c
> index 372ecb3e2c06..1e5d28311e14 100644
> --- a/tools/perf/builtin-inject.c
> +++ b/tools/perf/builtin-inject.c
> @@ -578,58 +578,6 @@ static void strip_init(struct perf_inject *inject)
> evsel->handler = drop_sample;
> }
>
> -static bool has_tracking(struct evsel *evsel)
> -{
> - return evsel->core.attr.mmap || evsel->core.attr.mmap2 || evsel->core.attr.comm ||
> - evsel->core.attr.task;
> -}
> -
> -#define COMPAT_MASK (PERF_SAMPLE_ID | PERF_SAMPLE_TID | PERF_SAMPLE_TIME | \
> - PERF_SAMPLE_ID | PERF_SAMPLE_CPU | PERF_SAMPLE_IDENTIFIER)
> -
> -/*
> - * In order that the perf.data file is parsable, tracking events like MMAP need
> - * their selected event to exist, except if there is only 1 selected event left
> - * and it has a compatible sample type.
> - */
> -static bool ok_to_remove(struct evlist *evlist,
> - struct evsel *evsel_to_remove)
> -{
> - struct evsel *evsel;
> - int cnt = 0;
> - bool ok = false;
> -
> - if (!has_tracking(evsel_to_remove))
> - return true;
> -
> - evlist__for_each_entry(evlist, evsel) {
> - if (evsel->handler != drop_sample) {
> - cnt += 1;
> - if ((evsel->core.attr.sample_type & COMPAT_MASK) ==
> - (evsel_to_remove->core.attr.sample_type & COMPAT_MASK))
> - ok = true;
> - }
> - }
> -
> - return ok && cnt == 1;
> -}
> -
> -static void strip_fini(struct perf_inject *inject)
> -{
> - struct evlist *evlist = inject->session->evlist;
> - struct evsel *evsel, *tmp;
> -
> - /* Remove non-synthesized evsels if possible */
> - evlist__for_each_entry_safe(evlist, tmp, evsel) {
> - if (evsel->handler == drop_sample &&
> - ok_to_remove(evlist, evsel)) {
> - pr_debug("Deleting %s\n", perf_evsel__name(evsel));
> - evlist__remove(evlist, evsel);
> - evsel__delete(evsel);
> - }
> - }
> -}
> -
> static int __cmd_inject(struct perf_inject *inject)
> {
> int ret = -EINVAL;
> @@ -729,8 +677,6 @@ static int __cmd_inject(struct perf_inject *inject)
> evlist__remove(session->evlist, evsel);
> evsel__delete(evsel);
> }
> - if (inject->strip)
> - strip_fini(inject);
> }
> session->header.data_offset = output_data_offset;
> session->header.data_size = inject->bytes_written;
> --
> 2.17.1
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] perf inject: Make --strip keep evsels
2019-11-06 11:03 ` Jiri Olsa
@ 2019-11-06 13:56 ` Arnaldo Carvalho de Melo
0 siblings, 0 replies; 4+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-11-06 13:56 UTC (permalink / raw)
To: Jiri Olsa; +Cc: Adrian Hunter, linux-kernel
Em Wed, Nov 06, 2019 at 12:03:52PM +0100, Jiri Olsa escreveu:
> On Tue, Nov 05, 2019 at 12:00:57PM +0200, Adrian Hunter wrote:
> > create_gcov (refer to the autofdo example in
> > tools/perf/Documentation/intel-pt.txt) now needs the evsels to read the
> > perf.data file. So don't strip them.
> >
> > Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
> > ---
> > tools/perf/builtin-inject.c | 54 -------------------------------------
> > 1 file changed, 54 deletions(-)
>
> good stats ;-)
:-)
> Acked-by: Jiri Olsa <jolsa@kernel.org>
thanks, applied.
> thanks,
> jirka
>
> >
> > diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c
> > index 372ecb3e2c06..1e5d28311e14 100644
> > --- a/tools/perf/builtin-inject.c
> > +++ b/tools/perf/builtin-inject.c
> > @@ -578,58 +578,6 @@ static void strip_init(struct perf_inject *inject)
> > evsel->handler = drop_sample;
> > }
> >
> > -static bool has_tracking(struct evsel *evsel)
> > -{
> > - return evsel->core.attr.mmap || evsel->core.attr.mmap2 || evsel->core.attr.comm ||
> > - evsel->core.attr.task;
> > -}
> > -
> > -#define COMPAT_MASK (PERF_SAMPLE_ID | PERF_SAMPLE_TID | PERF_SAMPLE_TIME | \
> > - PERF_SAMPLE_ID | PERF_SAMPLE_CPU | PERF_SAMPLE_IDENTIFIER)
> > -
> > -/*
> > - * In order that the perf.data file is parsable, tracking events like MMAP need
> > - * their selected event to exist, except if there is only 1 selected event left
> > - * and it has a compatible sample type.
> > - */
> > -static bool ok_to_remove(struct evlist *evlist,
> > - struct evsel *evsel_to_remove)
> > -{
> > - struct evsel *evsel;
> > - int cnt = 0;
> > - bool ok = false;
> > -
> > - if (!has_tracking(evsel_to_remove))
> > - return true;
> > -
> > - evlist__for_each_entry(evlist, evsel) {
> > - if (evsel->handler != drop_sample) {
> > - cnt += 1;
> > - if ((evsel->core.attr.sample_type & COMPAT_MASK) ==
> > - (evsel_to_remove->core.attr.sample_type & COMPAT_MASK))
> > - ok = true;
> > - }
> > - }
> > -
> > - return ok && cnt == 1;
> > -}
> > -
> > -static void strip_fini(struct perf_inject *inject)
> > -{
> > - struct evlist *evlist = inject->session->evlist;
> > - struct evsel *evsel, *tmp;
> > -
> > - /* Remove non-synthesized evsels if possible */
> > - evlist__for_each_entry_safe(evlist, tmp, evsel) {
> > - if (evsel->handler == drop_sample &&
> > - ok_to_remove(evlist, evsel)) {
> > - pr_debug("Deleting %s\n", perf_evsel__name(evsel));
> > - evlist__remove(evlist, evsel);
> > - evsel__delete(evsel);
> > - }
> > - }
> > -}
> > -
> > static int __cmd_inject(struct perf_inject *inject)
> > {
> > int ret = -EINVAL;
> > @@ -729,8 +677,6 @@ static int __cmd_inject(struct perf_inject *inject)
> > evlist__remove(session->evlist, evsel);
> > evsel__delete(evsel);
> > }
> > - if (inject->strip)
> > - strip_fini(inject);
> > }
> > session->header.data_offset = output_data_offset;
> > session->header.data_size = inject->bytes_written;
> > --
> > 2.17.1
> >
--
- Arnaldo
^ permalink raw reply [flat|nested] 4+ messages in thread
* [tip: perf/core] perf inject: Make --strip keep evsels
2019-11-05 10:00 [PATCH] perf inject: Make --strip keep evsels Adrian Hunter
2019-11-06 11:03 ` Jiri Olsa
@ 2019-11-12 11:17 ` tip-bot2 for Adrian Hunter
1 sibling, 0 replies; 4+ messages in thread
From: tip-bot2 for Adrian Hunter @ 2019-11-12 11:17 UTC (permalink / raw)
To: linux-tip-commits
Cc: Adrian Hunter, Jiri Olsa, Arnaldo Carvalho de Melo, Ingo Molnar,
Borislav Petkov, linux-kernel
The following commit has been merged into the perf/core branch of tip:
Commit-ID: ef5502a1d9bd042dcf457378a6ac96701e498b1b
Gitweb: https://git.kernel.org/tip/ef5502a1d9bd042dcf457378a6ac96701e498b1b
Author: Adrian Hunter <adrian.hunter@intel.com>
AuthorDate: Tue, 05 Nov 2019 12:00:57 +02:00
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitterDate: Wed, 06 Nov 2019 15:49:40 -03:00
perf inject: Make --strip keep evsels
create_gcov (refer to the autofdo example in tools/perf/Documentation/intel-pt.txt)
now needs the evsels to read the perf.data file. So don't strip them.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Link: http://lore.kernel.org/lkml/20191105100057.21465-1-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/builtin-inject.c | 54 +------------------------------------
1 file changed, 54 deletions(-)
diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c
index 372ecb3..1e5d283 100644
--- a/tools/perf/builtin-inject.c
+++ b/tools/perf/builtin-inject.c
@@ -578,58 +578,6 @@ static void strip_init(struct perf_inject *inject)
evsel->handler = drop_sample;
}
-static bool has_tracking(struct evsel *evsel)
-{
- return evsel->core.attr.mmap || evsel->core.attr.mmap2 || evsel->core.attr.comm ||
- evsel->core.attr.task;
-}
-
-#define COMPAT_MASK (PERF_SAMPLE_ID | PERF_SAMPLE_TID | PERF_SAMPLE_TIME | \
- PERF_SAMPLE_ID | PERF_SAMPLE_CPU | PERF_SAMPLE_IDENTIFIER)
-
-/*
- * In order that the perf.data file is parsable, tracking events like MMAP need
- * their selected event to exist, except if there is only 1 selected event left
- * and it has a compatible sample type.
- */
-static bool ok_to_remove(struct evlist *evlist,
- struct evsel *evsel_to_remove)
-{
- struct evsel *evsel;
- int cnt = 0;
- bool ok = false;
-
- if (!has_tracking(evsel_to_remove))
- return true;
-
- evlist__for_each_entry(evlist, evsel) {
- if (evsel->handler != drop_sample) {
- cnt += 1;
- if ((evsel->core.attr.sample_type & COMPAT_MASK) ==
- (evsel_to_remove->core.attr.sample_type & COMPAT_MASK))
- ok = true;
- }
- }
-
- return ok && cnt == 1;
-}
-
-static void strip_fini(struct perf_inject *inject)
-{
- struct evlist *evlist = inject->session->evlist;
- struct evsel *evsel, *tmp;
-
- /* Remove non-synthesized evsels if possible */
- evlist__for_each_entry_safe(evlist, tmp, evsel) {
- if (evsel->handler == drop_sample &&
- ok_to_remove(evlist, evsel)) {
- pr_debug("Deleting %s\n", perf_evsel__name(evsel));
- evlist__remove(evlist, evsel);
- evsel__delete(evsel);
- }
- }
-}
-
static int __cmd_inject(struct perf_inject *inject)
{
int ret = -EINVAL;
@@ -729,8 +677,6 @@ static int __cmd_inject(struct perf_inject *inject)
evlist__remove(session->evlist, evsel);
evsel__delete(evsel);
}
- if (inject->strip)
- strip_fini(inject);
}
session->header.data_offset = output_data_offset;
session->header.data_size = inject->bytes_written;
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-11-12 11:22 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-05 10:00 [PATCH] perf inject: Make --strip keep evsels Adrian Hunter
2019-11-06 11:03 ` Jiri Olsa
2019-11-06 13:56 ` Arnaldo Carvalho de Melo
2019-11-12 11:17 ` [tip: perf/core] " tip-bot2 for Adrian Hunter
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).