Just like was done for parse_events__set_leader.
Also we need to have the list_entry set_leader method in evlist.c so that we
don't grow another dep in the python binding:
# ~acme/git/linux/tools/perf/python/twatch.py
Traceback (most recent call last):
File "/home/acme/git/linux/tools/perf/python/twatch.py", line 16, in <module>
import perf
ImportError: /home/acme/git/build/perf/python/perf.so: undefined symbol: parse_events__set_leader
And also remove a pr_debug from evsel.c so that we avoid this one too:
# ~acme/git/linux/tools/perf/python/twatch.py
Traceback (most recent call last):
File "/home/acme/git/linux/tools/perf/python/twatch.py", line 16, in <module>
import perf
ImportError: /home/acme/git/build/perf/python/perf.so: undefined symbol: eprintf
Acked-by: Jiri Olsa <jolsa@redhat.com>
Acked-by: Namhyung Kim <namhyung@gmail.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-0hk9dazg9pora9jylkqngovm@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
perf_evlist__config_attrs(evlist, opts);
if (opts->group)
- perf_evlist__group(evlist);
+ perf_evlist__set_leader(evlist);
list_for_each_entry(pos, &evlist->entries, node) {
struct perf_event_attr *attr = &pos->attr;
}
if (group)
- perf_evlist__group(evsel_list);
+ perf_evlist__set_leader(evsel_list);
first = list_entry(evsel_list->entries.next, struct perf_evsel, node);
struct perf_evlist *evlist = top->evlist;
if (top->group)
- perf_evlist__group(evlist);
+ perf_evlist__set_leader(evlist);
list_for_each_entry(counter, &evlist->entries, node) {
struct perf_event_attr *attr = &counter->attr;
evlist->nr_entries += nr_entries;
}
-void perf_evlist__group(struct perf_evlist *evlist)
+void __perf_evlist__set_leader(struct list_head *list)
+{
+ struct perf_evsel *evsel, *leader;
+
+ leader = list_entry(list->next, struct perf_evsel, node);
+ leader->leader = NULL;
+
+ list_for_each_entry(evsel, list, node) {
+ if (evsel != leader)
+ evsel->leader = leader;
+ }
+}
+
+void perf_evlist__set_leader(struct perf_evlist *evlist)
{
if (evlist->nr_entries)
- parse_events__set_leader(&evlist->entries);
+ __perf_evlist__set_leader(&evlist->entries);
}
int perf_evlist__add_default(struct perf_evlist *evlist)
void perf_evlist__delete_maps(struct perf_evlist *evlist);
int perf_evlist__set_filters(struct perf_evlist *evlist);
+void __perf_evlist__set_leader(struct list_head *list);
+void perf_evlist__set_leader(struct perf_evlist *evlist);
+
u64 perf_evlist__sample_type(const struct perf_evlist *evlist);
bool perf_evlist__sample_id_all(const const struct perf_evlist *evlist);
u16 perf_evlist__id_hdr_size(const struct perf_evlist *evlist);
void perf_evlist__splice_list_tail(struct perf_evlist *evlist,
struct list_head *list,
int nr_entries);
-
-void perf_evlist__group(struct perf_evlist *evlist);
#endif /* __PERF_EVLIST_H */
err = -errno;
goto out_close;
}
-
- pr_debug("event cpu %d, thread %d, fd %d, group %d\n",
- cpu, pid, FD(evsel, cpu, thread),
- group_fd);
}
}
pmu_event_name(head_config));
}
-struct perf_evsel *parse_events__set_leader(struct list_head *list)
-{
- struct perf_evsel *evsel, *leader;
-
- leader = list_entry(list->next, struct perf_evsel, node);
- leader->leader = NULL;
-
- list_for_each_entry(evsel, list, node)
- if (evsel != leader)
- evsel->leader = leader;
-
- return leader;
-}
-
int parse_events__modifier_group(struct list_head *list,
char *event_mod)
{
return parse_events__modifier_event(list, event_mod, true);
}
-void parse_events__group(char *name, struct list_head *list)
+void parse_events__set_leader(char *name, struct list_head *list)
{
struct perf_evsel *leader;
- leader = parse_events__set_leader(list);
+ __perf_evlist__set_leader(list);
+ leader = list_entry(list->next, struct perf_evsel, node);
leader->group_name = name ? strdup(name) : NULL;
}
void *ptr, char *type);
int parse_events_add_pmu(struct list_head **list, int *idx,
char *pmu , struct list_head *head_config);
-struct perf_evsel *parse_events__set_leader(struct list_head *list);
-void parse_events__group(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_error(void *data, void *scanner, char const *msg);
{
struct list_head *list = $3;
- parse_events__group($1, list);
+ parse_events__set_leader($1, list);
$$ = list;
}
|
{
struct list_head *list = $2;
- parse_events__group(NULL, list);
+ parse_events__set_leader(NULL, list);
$$ = list;
}
return NULL;
if (group)
- perf_evlist__group(evlist);
+ perf_evlist__set_leader(evlist);
if (perf_evlist__open(evlist) < 0) {
PyErr_SetFromErrno(PyExc_OSError);