]> git.baikalelectronics.ru Git - kernel.git/commitdiff
libperf: Move 'nr_groups' from tools/perf to evlist::nr_groups
authorJiri Olsa <jolsa@redhat.com>
Tue, 6 Jul 2021 15:17:01 +0000 (17:17 +0200)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Fri, 9 Jul 2021 17:04:32 +0000 (14:04 -0300)
Move evsel::nr_groups to perf_evsel::nr_groups, so we can move the group
interface to libperf.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Requested-by: Shunsuke Nakamura <nakamura.shun@fujitsu.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Michael Petlan <mpetlan@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lore.kernel.org/lkml/20210706151704.73662-5-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/lib/perf/include/internal/evlist.h
tools/perf/builtin-record.c
tools/perf/builtin-report.c
tools/perf/tests/bpf.c
tools/perf/tests/parse-events.c
tools/perf/tests/pfm.c
tools/perf/util/evlist.c
tools/perf/util/evlist.h
tools/perf/util/header.c
tools/perf/util/parse-events.c
tools/perf/util/pfm.c

index 212c29063ad42ccc7891e5e17446ef6ab1827ef9..f16fa9877d27d382bae08136471f9c7eaa86d6a0 100644 (file)
@@ -16,6 +16,7 @@ struct perf_mmap_param;
 struct perf_evlist {
        struct list_head         entries;
        int                      nr_entries;
+       int                      nr_groups;
        bool                     has_user_cpus;
        struct perf_cpu_map     *cpus;
        struct perf_cpu_map     *all_cpus;
index 6a8cc191849fba2bf4d3197f69f9d61df25d271a..ee2a5cacbdfc81c5b7026b4f5d01b28afaf1cd8b 100644 (file)
@@ -1776,7 +1776,7 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
                rec->tool.ordered_events = false;
        }
 
-       if (!rec->evlist->nr_groups)
+       if (!rec->evlist->core.nr_groups)
                perf_header__clear_feat(&session->header, HEADER_GROUP_DESC);
 
        if (data->is_pipe) {
index d3a1a665a3d4c38e5e25670368535c55de63617a..6386af6a2612367c424f89bf3488e16b876f5e3e 100644 (file)
@@ -1432,7 +1432,7 @@ repeat:
 
        setup_forced_leader(&report, session->evlist);
 
-       if (symbol_conf.group_sort_idx && !session->evlist->nr_groups) {
+       if (symbol_conf.group_sort_idx && !session->evlist->core.nr_groups) {
                parse_options_usage(NULL, options, "group-sort-idx", 0);
                ret = -EINVAL;
                goto error;
index c72adbd67386e9df2daa410cc4c3b87fdc2bcdb6..33bda9c2654235473fa9a60e2c713542898c19e7 100644 (file)
@@ -151,7 +151,7 @@ static int do_test(struct bpf_object *obj, int (*func)(void),
        }
 
        evlist__splice_list_tail(evlist, &parse_state.list);
-       evlist->nr_groups = parse_state.nr_groups;
+       evlist->core.nr_groups = parse_state.nr_groups;
 
        evlist__config(evlist, &opts, NULL);
 
index a28688b054f5393e8977d9d4a249b26659431a08..56a7b6a14195af4c27ff1207d92df18255e2813f 100644 (file)
@@ -49,7 +49,7 @@ static int test__checkevent_tracepoint(struct evlist *evlist)
        struct evsel *evsel = evlist__first(evlist);
 
        TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries);
-       TEST_ASSERT_VAL("wrong number of groups", 0 == evlist->nr_groups);
+       TEST_ASSERT_VAL("wrong number of groups", 0 == evlist->core.nr_groups);
        TEST_ASSERT_VAL("wrong type", PERF_TYPE_TRACEPOINT == evsel->core.attr.type);
        TEST_ASSERT_VAL("wrong sample_type",
                PERF_TP_SAMPLE_TYPE == evsel->core.attr.sample_type);
@@ -62,7 +62,7 @@ static int test__checkevent_tracepoint_multi(struct evlist *evlist)
        struct evsel *evsel;
 
        TEST_ASSERT_VAL("wrong number of entries", evlist->core.nr_entries > 1);
-       TEST_ASSERT_VAL("wrong number of groups", 0 == evlist->nr_groups);
+       TEST_ASSERT_VAL("wrong number of groups", 0 == evlist->core.nr_groups);
 
        evlist__for_each_entry(evlist, evsel) {
                TEST_ASSERT_VAL("wrong type",
@@ -668,7 +668,7 @@ static int test__group1(struct evlist *evlist)
        struct evsel *evsel, *leader;
 
        TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->core.nr_entries);
-       TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->nr_groups);
+       TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->core.nr_groups);
 
        /* instructions:k */
        evsel = leader = evlist__first(evlist);
@@ -710,7 +710,7 @@ static int test__group2(struct evlist *evlist)
        struct evsel *evsel, *leader;
 
        TEST_ASSERT_VAL("wrong number of entries", 3 == evlist->core.nr_entries);
-       TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->nr_groups);
+       TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->core.nr_groups);
 
        /* faults + :ku modifier */
        evsel = leader = evlist__first(evlist);
@@ -765,7 +765,7 @@ static int test__group3(struct evlist *evlist __maybe_unused)
        struct evsel *evsel, *leader;
 
        TEST_ASSERT_VAL("wrong number of entries", 5 == evlist->core.nr_entries);
-       TEST_ASSERT_VAL("wrong number of groups", 2 == evlist->nr_groups);
+       TEST_ASSERT_VAL("wrong number of groups", 2 == evlist->core.nr_groups);
 
        /* group1 syscalls:sys_enter_openat:H */
        evsel = leader = evlist__first(evlist);
@@ -857,7 +857,7 @@ static int test__group4(struct evlist *evlist __maybe_unused)
        struct evsel *evsel, *leader;
 
        TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->core.nr_entries);
-       TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->nr_groups);
+       TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->core.nr_groups);
 
        /* cycles:u + p */
        evsel = leader = evlist__first(evlist);
@@ -901,7 +901,7 @@ static int test__group5(struct evlist *evlist __maybe_unused)
        struct evsel *evsel, *leader;
 
        TEST_ASSERT_VAL("wrong number of entries", 5 == evlist->core.nr_entries);
-       TEST_ASSERT_VAL("wrong number of groups", 2 == evlist->nr_groups);
+       TEST_ASSERT_VAL("wrong number of groups", 2 == evlist->core.nr_groups);
 
        /* cycles + G */
        evsel = leader = evlist__first(evlist);
@@ -987,7 +987,7 @@ static int test__group_gh1(struct evlist *evlist)
        struct evsel *evsel, *leader;
 
        TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->core.nr_entries);
-       TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->nr_groups);
+       TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->core.nr_groups);
 
        /* cycles + :H group modifier */
        evsel = leader = evlist__first(evlist);
@@ -1027,7 +1027,7 @@ static int test__group_gh2(struct evlist *evlist)
        struct evsel *evsel, *leader;
 
        TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->core.nr_entries);
-       TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->nr_groups);
+       TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->core.nr_groups);
 
        /* cycles + :G group modifier */
        evsel = leader = evlist__first(evlist);
@@ -1067,7 +1067,7 @@ static int test__group_gh3(struct evlist *evlist)
        struct evsel *evsel, *leader;
 
        TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->core.nr_entries);
-       TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->nr_groups);
+       TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->core.nr_groups);
 
        /* cycles:G + :u group modifier */
        evsel = leader = evlist__first(evlist);
@@ -1107,7 +1107,7 @@ static int test__group_gh4(struct evlist *evlist)
        struct evsel *evsel, *leader;
 
        TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->core.nr_entries);
-       TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->nr_groups);
+       TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->core.nr_groups);
 
        /* cycles:G + :uG group modifier */
        evsel = leader = evlist__first(evlist);
index acd50944f6af6ca544bda370de4bcd843c158416..e8fd0da0762b8105a3bac775f80979f97edd1993 100644 (file)
@@ -96,7 +96,7 @@ static int test__pfm_events(void)
                                count_pfm_events(&evlist->core),
                                table[i].nr_events);
                TEST_ASSERT_EQUAL(table[i].events,
-                               evlist->nr_groups,
+                               evlist->core.nr_groups,
                                0);
 
                evlist__delete(evlist);
@@ -180,7 +180,7 @@ static int test__pfm_group(void)
                                count_pfm_events(&evlist->core),
                                table[i].nr_events);
                TEST_ASSERT_EQUAL(table[i].events,
-                               evlist->nr_groups,
+                               evlist->core.nr_groups,
                                table[i].nr_groups);
 
                evlist__delete(evlist);
index 9cb6638822731c8156d54db82fc593db2fbdd1d9..752f64afd6224924cad30f9a62ac5005e14729ff 100644 (file)
@@ -240,7 +240,7 @@ void __evlist__set_leader(struct list_head *list)
 void evlist__set_leader(struct evlist *evlist)
 {
        if (evlist->core.nr_entries) {
-               evlist->nr_groups = evlist->core.nr_entries > 1 ? 1 : 0;
+               evlist->core.nr_groups = evlist->core.nr_entries > 1 ? 1 : 0;
                __evlist__set_leader(&evlist->core.entries);
        }
 }
@@ -1748,7 +1748,7 @@ bool evlist__exclude_kernel(struct evlist *evlist)
  */
 void evlist__force_leader(struct evlist *evlist)
 {
-       if (!evlist->nr_groups) {
+       if (!evlist->core.nr_groups) {
                struct evsel *leader = evlist__first(evlist);
 
                evlist__set_leader(evlist);
index 2073cfa79f798da71e4cbe37f7d023a999181eec..cb2bf5f4866a54190173e5a967994039a07bf0e7 100644 (file)
@@ -50,7 +50,6 @@ enum bkw_mmap_state {
 
 struct evlist {
        struct perf_evlist core;
-       int              nr_groups;
        bool             enabled;
        int              id_pos;
        int              is_pos;
index a1056540c13bbd9d1b56cc3580422495f8c0ac00..44249027507a5c95a9e3a5c101ccb2f0ce93b7f4 100644 (file)
@@ -778,7 +778,7 @@ static int write_pmu_mappings(struct feat_fd *ff,
 static int write_group_desc(struct feat_fd *ff,
                            struct evlist *evlist)
 {
-       u32 nr_groups = evlist->nr_groups;
+       u32 nr_groups = evlist->core.nr_groups;
        struct evsel *evsel;
        int ret;
 
@@ -2735,7 +2735,7 @@ static int process_group_desc(struct feat_fd *ff, void *data __maybe_unused)
         * Rebuild group relationship based on the group_desc
         */
        session = container_of(ff->ph, struct perf_session, header);
-       session->evlist->nr_groups = nr_groups;
+       session->evlist->core.nr_groups = nr_groups;
 
        i = nr = 0;
        evlist__for_each_entry(session->evlist, evsel) {
index 6fb1830097cb939b415daebd4e1b6d1c9c1ddc15..f6d77cb44007c4de1703581d52c888c20bcf6f70 100644 (file)
@@ -2285,7 +2285,7 @@ int __parse_events(struct evlist *evlist, const char *str,
        if (!ret) {
                struct evsel *last;
 
-               evlist->nr_groups += parse_state.nr_groups;
+               evlist->core.nr_groups += parse_state.nr_groups;
                last = evlist__last(evlist);
                last->cmdline_group_boundary = true;
 
index 6eef6dfeaa574a74b76617e6df29153fbe7cdadb..dd9ed56e0504e7a3e23dfea663c85135c0ed9eba 100644 (file)
@@ -110,7 +110,7 @@ int parse_libpfm_events_option(const struct option *opt, const char *str,
                                   "cannot close a non-existing event group\n");
                                goto error;
                        }
-                       evlist->nr_groups++;
+                       evlist->core.nr_groups++;
                        grp_leader = NULL;
                        grp_evt = -1;
                }