mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-04 01:56:40 +07:00
perf probe: Split del_perf_probe_events()
The del_perf_probe_events() does 2 things: 1. find existing events which match to filter 2. delete such trace events from kernel But sometimes we need to do something with the trace events. So split the funtion into two, so that it can access intermediate trace events name using strlist if needed. Signed-off-by: Namhyung Kim <namhyung@kernel.org> Acked-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Wang Nan <wangnan0@huawei.com> Cc: pi3orama@163.com Link: http://lkml.kernel.org/r/1441368963-11565-4-git-send-email-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
b02137cc65
commit
e7895e422e
@ -275,7 +275,8 @@ static int __del_trace_probe_event(int fd, struct str_node *ent)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int probe_file__del_events(int fd, struct strfilter *filter)
|
||||
static int probe_file__get_events(int fd, struct strfilter *filter,
|
||||
struct strlist *plist)
|
||||
{
|
||||
struct strlist *namelist;
|
||||
struct str_node *ent;
|
||||
@ -290,12 +291,43 @@ int probe_file__del_events(int fd, struct strfilter *filter)
|
||||
p = strchr(ent->s, ':');
|
||||
if ((p && strfilter__compare(filter, p + 1)) ||
|
||||
strfilter__compare(filter, ent->s)) {
|
||||
ret = __del_trace_probe_event(fd, ent);
|
||||
if (ret < 0)
|
||||
break;
|
||||
strlist__add(plist, ent->s);
|
||||
ret = 0;
|
||||
}
|
||||
}
|
||||
strlist__delete(namelist);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int probe_file__del_strlist(int fd, struct strlist *namelist)
|
||||
{
|
||||
int ret = 0;
|
||||
struct str_node *ent;
|
||||
|
||||
strlist__for_each(ent, namelist) {
|
||||
ret = __del_trace_probe_event(fd, ent);
|
||||
if (ret < 0)
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int probe_file__del_events(int fd, struct strfilter *filter)
|
||||
{
|
||||
struct strlist *namelist;
|
||||
int ret;
|
||||
|
||||
namelist = strlist__new(NULL, NULL);
|
||||
if (!namelist)
|
||||
return -ENOMEM;
|
||||
|
||||
ret = probe_file__get_events(fd, filter, namelist);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ret = probe_file__del_strlist(fd, namelist);
|
||||
strlist__delete(namelist);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user