Commit 4e5484b4 authored by Ian Rogers's avatar Ian Rogers Committed by Arnaldo Carvalho de Melo

perf parse-events: Inline parse_events_update_lists

The helper function just wraps a splice and free. Making the free
inline removes a comment, so then it just wraps a splice which we can
make inline too.
Signed-off-by: default avatarIan Rogers <irogers@google.com>
Reviewed-by: default avatarKan Liang <kan.liang@linux.intel.com>
Tested-by: default avatarAtish Patra <atishp@rivosinc.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Beeman Strong <beeman@rivosinc.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Clark <james.clark@arm.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20240416061533.921723-11-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 617824a7
...@@ -1720,19 +1720,6 @@ void parse_events__set_leader(char *name, struct list_head *list) ...@@ -1720,19 +1720,6 @@ void parse_events__set_leader(char *name, struct list_head *list)
leader->group_name = name; leader->group_name = name;
} }
/* list_event is assumed to point to malloc'ed memory */
void parse_events_update_lists(struct list_head *list_event,
struct list_head *list_all)
{
/*
* Called for single event definition. Update the
* 'all event' list, and reinit the 'single event'
* list, for next event definition.
*/
list_splice_tail(list_event, list_all);
free(list_event);
}
struct event_modifier { struct event_modifier {
int eu; int eu;
int ek; int ek;
......
...@@ -226,8 +226,6 @@ int parse_events_multi_pmu_add_or_add_pmu(struct parse_events_state *parse_state ...@@ -226,8 +226,6 @@ int parse_events_multi_pmu_add_or_add_pmu(struct parse_events_state *parse_state
void *loc_); void *loc_);
void parse_events__set_leader(char *name, struct list_head *list); void parse_events__set_leader(char *name, struct list_head *list);
void parse_events_update_lists(struct list_head *list_event,
struct list_head *list_all);
void parse_events_evlist_error(struct parse_events_state *parse_state, void parse_events_evlist_error(struct parse_events_state *parse_state,
int idx, const char *str); int idx, const char *str);
......
...@@ -125,6 +125,10 @@ static void free_list_evsel(struct list_head* list_evsel) ...@@ -125,6 +125,10 @@ static void free_list_evsel(struct list_head* list_evsel)
} }
%% %%
/*
* Entry points. We are either parsing events or terminals. Just terminal
* parsing is used for parsing events in sysfs.
*/
start: start:
PE_START_EVENTS start_events PE_START_EVENTS start_events
| |
...@@ -132,31 +136,36 @@ PE_START_TERMS start_terms ...@@ -132,31 +136,36 @@ PE_START_TERMS start_terms
start_events: groups start_events: groups
{ {
/* Take the parsed events, groups.. and place into parse_state. */
struct list_head *groups = $1;
struct parse_events_state *parse_state = _parse_state; struct parse_events_state *parse_state = _parse_state;
/* frees $1 */ list_splice_tail(groups, &parse_state->list);
parse_events_update_lists($1, &parse_state->list); free(groups);
} }
groups: groups: /* A list of groups or events. */
groups ',' group groups ',' group
{ {
struct list_head *list = $1; /* Merge group into the list of events/groups. */
struct list_head *group = $3; struct list_head *groups = $1;
struct list_head *group = $3;
/* frees $3 */ list_splice_tail(group, groups);
parse_events_update_lists(group, list); free(group);
$$ = list; $$ = groups;
} }
| |
groups ',' event groups ',' event
{ {
struct list_head *list = $1; /* Merge event into the list of events/groups. */
struct list_head *groups = $1;
struct list_head *event = $3; struct list_head *event = $3;
/* frees $3 */
parse_events_update_lists(event, list); list_splice_tail(event, groups);
$$ = list; free(event);
$$ = groups;
} }
| |
group group
...@@ -206,12 +215,12 @@ PE_NAME '{' events '}' ...@@ -206,12 +215,12 @@ PE_NAME '{' events '}'
events: events:
events ',' event events ',' event
{ {
struct list_head *events = $1;
struct list_head *event = $3; struct list_head *event = $3;
struct list_head *list = $1;
/* frees $3 */ list_splice_tail(event, events);
parse_events_update_lists(event, list); free(event);
$$ = list; $$ = events;
} }
| |
event event
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment