2022-09-26 04:07:25

by Chen Zhongjin

[permalink] [raw]
Subject: [PATCH -next 0/5] perf: Minor fixes and cleanup

This series fixes and cleans up some minor issues for perf-event and
perf-trace. Mainly about cleaning dead code and macros.

Chen Zhongjin (5):
perf: Fix show_arg_names not working for tp arg names
perf: Fix incorrectly parsed flags in filter
perf: Remove duplicate errbuf
perf: Remove unused macros __PERF_EVENT_FIELD
perf: Remove unused macro K

tools/perf/builtin-trace.c | 20 +++++---------------
tools/perf/util/parse-events.c | 8 --------
tools/perf/util/string.c | 1 -
3 files changed, 5 insertions(+), 24 deletions(-)

--
2.17.1


2022-09-26 04:14:40

by Chen Zhongjin

[permalink] [raw]
Subject: [PATCH -next 4/5] perf: Remove unused macros __PERF_EVENT_FIELD

Unused macros reported by [-Wunused-macros].

This macros were introduced as __PERF_COUNTER_FIELD and used for
reading the bit in config.

'cdd6c482c9ff ("perf: Do the big rename: Performance Counters -> Performance Events")'
Changes it to __PERF_EVENT_FIELD but at this commit there is already
nowhere else using these macros, also no macros called
PERF_EVENT_##name##_MASK/SHIFT.

Now we are not reading type or id from config. These macros are
useless and incomplete.

So removing them for code cleaning.

Signed-off-by: Chen Zhongjin <[email protected]>
---
tools/perf/util/parse-events.c | 8 --------
1 file changed, 8 deletions(-)

diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index f05e15acd33f..3ed914882b96 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -149,14 +149,6 @@ struct event_symbol event_symbols_sw[PERF_COUNT_SW_MAX] = {
},
};

-#define __PERF_EVENT_FIELD(config, name) \
- ((config & PERF_EVENT_##name##_MASK) >> PERF_EVENT_##name##_SHIFT)
-
-#define PERF_EVENT_RAW(config) __PERF_EVENT_FIELD(config, RAW)
-#define PERF_EVENT_CONFIG(config) __PERF_EVENT_FIELD(config, CONFIG)
-#define PERF_EVENT_TYPE(config) __PERF_EVENT_FIELD(config, TYPE)
-#define PERF_EVENT_ID(config) __PERF_EVENT_FIELD(config, EVENT)
-
const char *event_type(int type)
{
switch (type) {
--
2.17.1

2022-09-26 20:35:24

by Arnaldo Carvalho de Melo

[permalink] [raw]
Subject: Re: [PATCH -next 4/5] perf: Remove unused macros __PERF_EVENT_FIELD

Em Mon, Sep 26, 2022 at 11:14:39AM +0800, Chen Zhongjin escreveu:
> Unused macros reported by [-Wunused-macros].
>
> This macros were introduced as __PERF_COUNTER_FIELD and used for
> reading the bit in config.
>
> 'cdd6c482c9ff ("perf: Do the big rename: Performance Counters -> Performance Events")'
> Changes it to __PERF_EVENT_FIELD but at this commit there is already
> nowhere else using these macros, also no macros called
> PERF_EVENT_##name##_MASK/SHIFT.
>
> Now we are not reading type or id from config. These macros are
> useless and incomplete.
>
> So removing them for code cleaning.

Thanks, applied.

- Arnaldo


> Signed-off-by: Chen Zhongjin <[email protected]>
> ---
> tools/perf/util/parse-events.c | 8 --------
> 1 file changed, 8 deletions(-)
>
> diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
> index f05e15acd33f..3ed914882b96 100644
> --- a/tools/perf/util/parse-events.c
> +++ b/tools/perf/util/parse-events.c
> @@ -149,14 +149,6 @@ struct event_symbol event_symbols_sw[PERF_COUNT_SW_MAX] = {
> },
> };
>
> -#define __PERF_EVENT_FIELD(config, name) \
> - ((config & PERF_EVENT_##name##_MASK) >> PERF_EVENT_##name##_SHIFT)
> -
> -#define PERF_EVENT_RAW(config) __PERF_EVENT_FIELD(config, RAW)
> -#define PERF_EVENT_CONFIG(config) __PERF_EVENT_FIELD(config, CONFIG)
> -#define PERF_EVENT_TYPE(config) __PERF_EVENT_FIELD(config, TYPE)
> -#define PERF_EVENT_ID(config) __PERF_EVENT_FIELD(config, EVENT)
> -
> const char *event_type(int type)
> {
> switch (type) {
> --
> 2.17.1

--

- Arnaldo