Messages in this thread Patch in this message | | | Date | Thu, 20 Apr 2023 16:10:30 -0300 | From | Arnaldo Carvalho de Melo <> | Subject | Re: [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)
| |