Thread (78 messages) 78 messages, 3 authors, 2021-11-08

Re: [PATCH 30/59] libperf: Move in struct parse_events_state

From: Jiri Olsa <hidden>
Date: 2021-11-08 21:24:07

On Mon, Nov 08, 2021 at 10:21:14AM -0800, Ian Rogers wrote:
On Mon, Nov 8, 2021 at 5:40 AM Jiri Olsa [off-list ref] wrote:
quoted
Moving in struct parse_events_state to libperf
together with related structs.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 .../lib/perf/include/internal/parse-events.h  | 29 +++++++++++++++++++
 tools/perf/util/parse-events.h                | 28 ------------------
 2 files changed, 29 insertions(+), 28 deletions(-)
diff --git a/tools/lib/perf/include/internal/parse-events.h b/tools/lib/perf/include/internal/parse-events.h
index 46f632efd71b..aff13afa08e1 100644
--- a/tools/lib/perf/include/internal/parse-events.h
+++ b/tools/lib/perf/include/internal/parse-events.h
@@ -5,6 +5,7 @@
 #include <linux/types.h>
 #include <linux/list.h>
 #include <unistd.h>
+#include <linux/perf_event.h>

 struct event_symbol {
        const char      *symbol;
@@ -74,6 +75,34 @@ struct parse_events_term {
        bool weak;
 };

+struct parse_events_error {
+       int   num_errors;       /* number of errors encountered */
+       int   idx;      /* index in the parsed string */
+       char *str;      /* string to display at the index */
+       char *help;     /* optional help string */
+       int   first_idx;/* as above, but for the first encountered error */
+       char *first_str;
+       char *first_help;
+};
Just to note that this will conflict with the patches in:
https://lore.kernel.org/lkml/YYfyEcPfj5ct7w7Q@kernel.org/ (local)
Which may mean a bit larger change.
right, thanks for heads up.. I'm ok with rebasing this on top of that
and other changes.. I did that many times already ;-)

jirka
Thanks,
Ian
quoted
+struct parse_events_ops {
+       struct perf_evsel* (*perf_evsel__new)(struct perf_event_attr *attr, int idx);
+       struct perf_evsel* (*perf_evsel__new_tp)(const char *sys, const char *name, int idx);
+};
+
+struct parse_events_state {
+       struct list_head           list;
+       int                        idx;
+       int                        nr_groups;
+       struct parse_events_error *error;
+       struct perf_evlist        *evlist;
+       struct list_head          *terms;
+       int                        stoken;
+       struct perf_pmu           *fake_pmu;
+       char                      *hybrid_pmu_name;
+       struct parse_events_ops   *ops;
+};
+
 int parse_events_term__num(struct parse_events_term **term,
                           int type_term, char *config, u64 num,
                           bool novalue,
diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h
index 2f75e823124f..057b92778d17 100644
--- a/tools/perf/util/parse-events.h
+++ b/tools/perf/util/parse-events.h
@@ -61,34 +61,6 @@ struct perf_pmu_event_symbol {
        enum perf_pmu_event_symbol_type type;
 };

-struct parse_events_error {
-       int   num_errors;       /* number of errors encountered */
-       int   idx;      /* index in the parsed string */
-       char *str;      /* string to display at the index */
-       char *help;     /* optional help string */
-       int   first_idx;/* as above, but for the first encountered error */
-       char *first_str;
-       char *first_help;
-};
-
-struct parse_events_ops {
-       struct perf_evsel* (*perf_evsel__new)(struct perf_event_attr *attr, int idx);
-       struct perf_evsel* (*perf_evsel__new_tp)(const char *sys, const char *name, int idx);
-};
-
-struct parse_events_state {
-       struct list_head           list;
-       int                        idx;
-       int                        nr_groups;
-       struct parse_events_error *error;
-       struct perf_evlist        *evlist;
-       struct list_head          *terms;
-       int                        stoken;
-       struct perf_pmu           *fake_pmu;
-       char                      *hybrid_pmu_name;
-       struct parse_events_ops   *ops;
-};
-
 void parse_events__handle_error(struct parse_events_error *err, int idx,
                                char *str, char *help);
 void parse_events__shrink_config_terms(void);
--
2.31.1
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help