perf stat: remove redundant variable in arch_get_topdown_pmu_name
PATCH 1/1 perf stat: remove redundant variable in arch_get_topdown_pmu_name
From: zhang songyi <[email protected]>
Return value from arch_get_topdown_pmu_name directly instead of taking this in another redundant variable.
Signed-off-by zhang songyi <[email protected]>
--- tools/perf/arch/x86/util/topdown.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
tools/perf/arch/x86/util/topdown.c +1 -5
@@ -84,8 +84,6 @@ bool arch_topdown_sample_read(struct evsel *leader)const char *arch_get_topdown_pmu_name (struct evlist *evlist,bool warn) { -const char *pmu_name; -if (!perf_pmu__has_hybrid ())return "cpu" ;
@@ -95,9 +93,7 @@ const char *arch_get_topdown_pmu_name(struct evlist *evlist, bool warn) evlist->hybrid_pmu_name =perf_pmu__hybrid_type_to_pmu ("core" ); } - pmu_name = evlist->hybrid_pmu_name; - -return pmu_name; +return evlist->hybrid_pmu_name; }int topdown_parse_events (struct evlist *evlist)
--
2.15.2
Quoted 7 lines · On Wed, Nov 23, 2022 at 1:01 AM <[email protected]> wrote:
From: zhang songyi <[email protected]>
Return value from
arch_get_topdown_pmu_namedirectly instead of taking this in another redundant variable.Signed-off-by zhang songyi <[email protected]>
Acked-by Ian Rogers <[email protected]>
Thanks,
Ian
Quoted 30 lines
--- tools/perf/arch/x86/util/topdown.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)tools/perf/arch/x86/util/topdown.c +1
-6@@ -84,8 +84,6 @@ bool arch_topdown_sample_read(struct evsel *leader)const char *arch_get_topdown_pmu_name (struct evlist *evlist,bool warn) { -const char *pmu_name; -if (!perf_pmu__has_hybrid ())return "cpu" ;@@ -95,9 +93,7 @@ const char *arch_get_topdown_pmu_name(struct evlist *evlist, bool warn) evlist->hybrid_pmu_name =perf_pmu__hybrid_type_to_pmu ("core" ); } - pmu_name = evlist->hybrid_pmu_name; - -return pmu_name; +return evlist->hybrid_pmu_name; }int topdown_parse_events (struct evlist *evlist) --2.15.2