lkml.org 
[lkml]   [2023]   [Apr]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH 1/1] perf evsel: Introduce evsel__name_is() method to check if the evsel name is equal to a given string
Em Thu, Apr 20, 2023 at 03:57:55PM -0300, Arnaldo Carvalho de Melo escreveu:
> This makes the logic a bit clear by avoiding the !strcmp() pattern and
> also a way to intercept the pointer if we need to do extra validation on
> it or to do lazy setting of evsel->name via evsel__name(evsel).

+ this, looking if there are others...

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index d3cbee7460fcc48e..e95a545f2c600810 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -2169,10 +2169,8 @@ static void setup_system_wide(int forks)
struct evsel *counter;

evlist__for_each_entry(evsel_list, counter) {
- if (!counter->core.requires_cpu &&
- strcmp(counter->name, "duration_time")) {
+ if (!counter->core.requires_cpu && evsel__name_is(counter, "duration_time"))
return;
- }
}

if (evsel_list->core.nr_entries)
\
 
 \ /
  Last update: 2023-04-20 21:11    [W:0.048 / U:1.728 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site