perf: event: Remove deadcode
PATCH 1/1 perf: event: Remove deadcode
From: "Dr. David Alan Gilbert" <[email protected]>
event_format__print() last use was removed by 2017's commit 894f3f1732cb ("perf script: Use event_format__fprintf()")
evlist__find_tracepoint_by_id() last use was removed by 2012's commit e60fc847cefa ("perf evlist: Remove some unused methods")
evlist__set_tp_filter_pid() last use was removed by 2017's commit dd1a50377c92 ("perf trace: Introduce filter_loop_pids()")
Remove them.
--- tools/perf/util/evlist.c | 18 ------------------ tools/perf/util/evlist.h | 2 -- tools/perf/util/trace-event-parse.c | 6 ------ tools/perf/util/trace-event.h | 3 --- 4 files changed, 29 deletions(-)
tools/perf/util/evlist.c +0 -18
@@ -362,19 +362,6 @@ __weak int arch_evlist__add_default_attrs(struct evlist *evlist,return __evlist__add_default_attrs (evlist, attrs, nr_attrs); } -struct evsel *evlist__find_tracepoint_by_id (struct evlist *evlist,int id) -{ -struct evsel *evsel; - -evlist__for_each_entry (evlist, evsel) { -if (evsel->core.attr.type ==PERF_TYPE_TRACEPOINT && - (int )evsel->core.attr.config == id) -return evsel; - } - -return NULL ; -} -struct evsel *evlist__find_tracepoint_by_name (struct evlist *evlist,const char *name) {struct evsel *evsel;
@@ -1199,11 +1186,6 @@ int evlist__set_tp_filter_pids(struct evlist *evlist, size_t npids, pid_t *pids)return ret; } -int evlist__set_tp_filter_pid (struct evlist *evlist,pid_t pid) -{ -return evlist__set_tp_filter_pids (evlist,1 , &pid); -} -int evlist__append_tp_filter_pids (struct evlist *evlist,size_t npids,pid_t *pids) {char *filter =asprintf__tp_filter_pids (npids, pids);
tools/perf/util/evlist.h +0 -2
@@ -144,7 +144,6 @@ int __evlist__set_tracepoints_handlers(struct evlist *evlist, __evlist__set_tracepoints_handlers(evlist, array, ARRAY_SIZE(array))int evlist__set_tp_filter (struct evlist *evlist,const char *filter); -int evlist__set_tp_filter_pid (struct evlist *evlist,pid_t pid);int evlist__set_tp_filter_pids (struct evlist *evlist,size_t npids,pid_t *pids);int evlist__append_tp_filter (struct evlist *evlist,const char *filter);
@@ -152,7 +151,6 @@ int evlist__append_tp_filter(struct evlist *evlist, const char *filter);int evlist__append_tp_filter_pid (struct evlist *evlist,pid_t pid);int evlist__append_tp_filter_pids (struct evlist *evlist,size_t npids,pid_t *pids); -struct evsel *evlist__find_tracepoint_by_id (struct evlist *evlist,int id);struct evsel *evlist__find_tracepoint_by_name (struct evlist *evlist,const char *name);int evlist__add_pollfd (struct evlist *evlist,int fd);
tools/perf/util/trace-event-parse.c +0 -6
@@ -116,12 +116,6 @@ void event_format__fprintf(struct tep_event *event,trace_seq_destroy (&s); } -void event_format__print (struct tep_event *event, -int cpu,void *data,int size) -{ -return event_format__fprintf (event, cpu, data, size, stdout); -} -/* * prev_state is of size long, which is 32 bits on 32 bit architectures. * As it needs to have the same bits for both 32 bit and 64 bit architectures
tools/perf/util/trace-event.h +0 -3
@@ -42,9 +42,6 @@ struct tep_event *trace_event__tp_format_id(int id);void event_format__fprintf (struct tep_event *event,int cpu,void *data,int size,FILE *fp); -void event_format__print (struct tep_event *event, -int cpu,void *data,int size); -int parse_ftrace_file (struct tep_handle *pevent,char *buf,unsigned long size);int parse_event_file (struct tep_handle *pevent,char *buf,unsigned long size,char *sys);
Signature · 1 line
2.47.0
Quoted 9 lines · On Sun, Nov 3, 2024 at 6:23 AM <[email protected]> wrote:
From: "Dr. David Alan Gilbert" <[email protected]>
event_format__print()last use was removed by 2017's commit894f3f1732cb("perf script: Useevent_format__fprintf()")
evlist__find_tracepoint_by_id()last use was removed by 2012's commite60fc847cefa("perf evlist: Remove some unused methods")
Quoted 6 lines
evlist__set_tp_filter_pid()last use was removed by 2017's commitdd1a50377c92("perf trace: Introducefilter_loop_pids()")Remove them.
Signed-off-by Dr. David Alan Gilbert <[email protected]>
Thanks,
Ian
Quoted 97 lines
--- tools/perf/util/evlist.c | 18 ------------------ tools/perf/util/evlist.h | 2 -- tools/perf/util/trace-event-parse.c | 6 ------ tools/perf/util/trace-event.h | 3 --- 4 files changed, 29 deletions(-)tools/perf/util/evlist.c +0
-18@@ -362,19 +362,6 @@ __weak int arch_evlist__add_default_attrs(struct evlist *evlist,return __evlist__add_default_attrs (evlist, attrs, nr_attrs); } -struct evsel *evlist__find_tracepoint_by_id (struct evlist *evlist,int id) -{ -struct evsel *evsel; - -evlist__for_each_entry (evlist, evsel) { -if (evsel->core.attr.type ==PERF_TYPE_TRACEPOINT && - (int )evsel->core.attr.config == id) -return evsel; - } - -return NULL ; -} -struct evsel *evlist__find_tracepoint_by_name (struct evlist *evlist,const char *name) {struct evsel *evsel;@@ -1199,11 +1186,6 @@ int evlist__set_tp_filter_pids(struct evlist *evlist, size_t npids, pid_t *pids)return ret; } -int evlist__set_tp_filter_pid (struct evlist *evlist,pid_t pid) -{ -return evlist__set_tp_filter_pids (evlist,1 , &pid); -} -int evlist__append_tp_filter_pids (struct evlist *evlist,size_t npids,pid_t *pids) {char *filter =asprintf__tp_filter_pids (npids, pids);tools/perf/util/evlist.h +0
-2@@ -144,7 +144,6 @@ int __evlist__set_tracepoints_handlers(struct evlist *evlist, __evlist__set_tracepoints_handlers(evlist, array, ARRAY_SIZE(array))int evlist__set_tp_filter (struct evlist *evlist,const char *filter); -int evlist__set_tp_filter_pid (struct evlist *evlist,pid_t pid);int evlist__set_tp_filter_pids (struct evlist *evlist,size_t npids,pid_t *pids);int evlist__append_tp_filter (struct evlist *evlist,const char *filter);@@ -152,7 +151,6 @@ int evlist__append_tp_filter(struct evlist *evlist, const char *filter);int evlist__append_tp_filter_pid (struct evlist *evlist,pid_t pid);int evlist__append_tp_filter_pids (struct evlist *evlist,size_t npids,pid_t *pids); -struct evsel *evlist__find_tracepoint_by_id (struct evlist *evlist,int id);struct evsel *evlist__find_tracepoint_by_name (struct evlist *evlist,const char *name);int evlist__add_pollfd (struct evlist *evlist,int fd);tools/perf/util/trace-event-parse.c +0
-6@@ -116,12 +116,6 @@ void event_format__fprintf(struct tep_event *event,trace_seq_destroy (&s); } -void event_format__print (struct tep_event *event, -int cpu,void *data,int size) -{ -return event_format__fprintf (event, cpu, data, size, stdout); -} -/* * prev_state is of size long, which is 32 bits on 32 bit architectures. * As it needs to have the same bits for both 32 bit and 64 bit architectures tools/perf/util/trace-event.h +0
-4@@ -42,9 +42,6 @@ struct tep_event *trace_event__tp_format_id(int id);void event_format__fprintf (struct tep_event *event,int cpu,void *data,int size,FILE *fp); -void event_format__print (struct tep_event *event, -int cpu,void *data,int size); -int parse_ftrace_file (struct tep_handle *pevent,char *buf,unsigned long size);int parse_event_file (struct tep_handle *pevent,char *buf,unsigned long size,char *sys); --2.47.0
Namhyung Kim
maintainerHello,
Quoted 8 lines · On Sun, Nov 03, 2024 at 02:23:01PM +0000, [email protected] wrote:
From: "Dr. David Alan Gilbert" <[email protected]>
event_format__print()last use was removed by 2017's commit894f3f1732cb("perf script: Useevent_format__fprintf()")
evlist__find_tracepoint_by_id()last use was removed by 2012's commite60fc847cefa("perf evlist: Remove some unused methods")
Quoted 6 lines
evlist__set_tp_filter_pid()last use was removed by 2017's commitdd1a50377c92("perf trace: Introducefilter_loop_pids()")Remove them.
Signed-off-by Dr. David Alan Gilbert <[email protected]>
Unfortunately it doesn't apply to the current perf-tools-next cleanly. Can you please rebase?
Thanks,
Namhyung
Quoted 97 lines
--- tools/perf/util/evlist.c | 18 ------------------ tools/perf/util/evlist.h | 2 -- tools/perf/util/trace-event-parse.c | 6 ------ tools/perf/util/trace-event.h | 3 --- 4 files changed, 29 deletions(-)tools/perf/util/evlist.c +0
-18@@ -362,19 +362,6 @@ __weak int arch_evlist__add_default_attrs(struct evlist *evlist,return __evlist__add_default_attrs (evlist, attrs, nr_attrs); } -struct evsel *evlist__find_tracepoint_by_id (struct evlist *evlist,int id) -{ -struct evsel *evsel; - -evlist__for_each_entry (evlist, evsel) { -if (evsel->core.attr.type ==PERF_TYPE_TRACEPOINT && - (int )evsel->core.attr.config == id) -return evsel; - } - -return NULL ; -} -struct evsel *evlist__find_tracepoint_by_name (struct evlist *evlist,const char *name) {struct evsel *evsel;@@ -1199,11 +1186,6 @@ int evlist__set_tp_filter_pids(struct evlist *evlist, size_t npids, pid_t *pids)return ret; } -int evlist__set_tp_filter_pid (struct evlist *evlist,pid_t pid) -{ -return evlist__set_tp_filter_pids (evlist,1 , &pid); -} -int evlist__append_tp_filter_pids (struct evlist *evlist,size_t npids,pid_t *pids) {char *filter =asprintf__tp_filter_pids (npids, pids);tools/perf/util/evlist.h +0
-2@@ -144,7 +144,6 @@ int __evlist__set_tracepoints_handlers(struct evlist *evlist, __evlist__set_tracepoints_handlers(evlist, array, ARRAY_SIZE(array))int evlist__set_tp_filter (struct evlist *evlist,const char *filter); -int evlist__set_tp_filter_pid (struct evlist *evlist,pid_t pid);int evlist__set_tp_filter_pids (struct evlist *evlist,size_t npids,pid_t *pids);int evlist__append_tp_filter (struct evlist *evlist,const char *filter);@@ -152,7 +151,6 @@ int evlist__append_tp_filter(struct evlist *evlist, const char *filter);int evlist__append_tp_filter_pid (struct evlist *evlist,pid_t pid);int evlist__append_tp_filter_pids (struct evlist *evlist,size_t npids,pid_t *pids); -struct evsel *evlist__find_tracepoint_by_id (struct evlist *evlist,int id);struct evsel *evlist__find_tracepoint_by_name (struct evlist *evlist,const char *name);int evlist__add_pollfd (struct evlist *evlist,int fd);tools/perf/util/trace-event-parse.c +0
-6@@ -116,12 +116,6 @@ void event_format__fprintf(struct tep_event *event,trace_seq_destroy (&s); } -void event_format__print (struct tep_event *event, -int cpu,void *data,int size) -{ -return event_format__fprintf (event, cpu, data, size, stdout); -} -/* * prev_state is of size long, which is 32 bits on 32 bit architectures. * As it needs to have the same bits for both 32 bit and 64 bit architectures tools/perf/util/trace-event.h +0
-3@@ -42,9 +42,6 @@ struct tep_event *trace_event__tp_format_id(int id);void event_format__fprintf (struct tep_event *event,int cpu,void *data,int size,FILE *fp); -void event_format__print (struct tep_event *event, -int cpu,void *data,int size); -int parse_ftrace_file (struct tep_handle *pevent,char *buf,unsigned long size);int parse_event_file (struct tep_handle *pevent,char *buf,unsigned long size,char *sys);Signature · 1 line
2.47.0
PATCH v2 1/1 perf: event: Remove deadcode
From: "Dr. David Alan Gilbert" <[email protected]>
event_format__print() last use was removed by 2017's commit 894f3f1732cb ("perf script: Use event_format__fprintf()")
evlist__find_tracepoint_by_id() last use was removed by 2012's commit e60fc847cefa ("perf evlist: Remove some unused methods")
evlist__set_tp_filter_pid() last use was removed by 2017's commit dd1a50377c92 ("perf trace: Introduce filter_loop_pids()")
Remove them.
---
v2
Rebase on perf-tools-next 29bf07bc9ad2e
tools/perf/util/evlist.c | 18 ------------------ tools/perf/util/evlist.h | 2 -- tools/perf/util/trace-event-parse.c | 6 ------ tools/perf/util/trace-event.h | 3 --- 4 files changed, 29 deletions(-)
tools/perf/util/evlist.c +0 -18
@@ -320,19 +320,6 @@ struct evsel *evlist__add_sched_switch(struct evlist *evlist, bool system_wide) }#endif -struct evsel *evlist__find_tracepoint_by_id (struct evlist *evlist,int id) -{ -struct evsel *evsel; - -evlist__for_each_entry (evlist, evsel) { -if (evsel->core.attr.type ==PERF_TYPE_TRACEPOINT && - (int )evsel->core.attr.config == id) -return evsel; - } - -return NULL ; -} -struct evsel *evlist__find_tracepoint_by_name (struct evlist *evlist,const char *name) {struct evsel *evsel;
@@ -1157,11 +1144,6 @@ int evlist__set_tp_filter_pids(struct evlist *evlist, size_t npids, pid_t *pids)return ret; } -int evlist__set_tp_filter_pid (struct evlist *evlist,pid_t pid) -{ -return evlist__set_tp_filter_pids (evlist,1 , &pid); -} -int evlist__append_tp_filter_pids (struct evlist *evlist,size_t npids,pid_t *pids) {char *filter =asprintf__tp_filter_pids (npids, pids);
tools/perf/util/evlist.h +0 -2
@@ -132,7 +132,6 @@ int __evlist__set_tracepoints_handlers(struct evlist *evlist, __evlist__set_tracepoints_handlers(evlist, array, ARRAY_SIZE(array))int evlist__set_tp_filter (struct evlist *evlist,const char *filter); -int evlist__set_tp_filter_pid (struct evlist *evlist,pid_t pid);int evlist__set_tp_filter_pids (struct evlist *evlist,size_t npids,pid_t *pids);int evlist__append_tp_filter (struct evlist *evlist,const char *filter);
@@ -140,7 +139,6 @@ int evlist__append_tp_filter(struct evlist *evlist, const char *filter);int evlist__append_tp_filter_pid (struct evlist *evlist,pid_t pid);int evlist__append_tp_filter_pids (struct evlist *evlist,size_t npids,pid_t *pids); -struct evsel *evlist__find_tracepoint_by_id (struct evlist *evlist,int id);struct evsel *evlist__find_tracepoint_by_name (struct evlist *evlist,const char *name);int evlist__add_pollfd (struct evlist *evlist,int fd);
tools/perf/util/trace-event-parse.c +0 -6
@@ -116,12 +116,6 @@ void event_format__fprintf(struct tep_event *event,trace_seq_destroy (&s); } -void event_format__print (struct tep_event *event, -int cpu,void *data,int size) -{ -return event_format__fprintf (event, cpu, data, size, stdout); -} -/* * prev_state is of size long, which is 32 bits on 32 bit architectures. * As it needs to have the same bits for both 32 bit and 64 bit architectures
tools/perf/util/trace-event.h +0 -3
@@ -42,9 +42,6 @@ struct tep_event *trace_event__tp_format_id(int id);void event_format__fprintf (struct tep_event *event,int cpu,void *data,int size,FILE *fp); -void event_format__print (struct tep_event *event, -int cpu,void *data,int size); -int parse_ftrace_file (struct tep_handle *pevent,char *buf,unsigned long size);int parse_event_file (struct tep_handle *pevent,char *buf,unsigned long size,char *sys);
Signature · 1 line
2.47.0
Quoted 14 lines · * Namhyung Kim ([email protected]) wrote:
Hello,
Quoted 11 lines · On Sun, Nov 03, 2024 at 02:23:01PM +0000, [email protected] wrote:
From: "Dr. David Alan Gilbert" <[email protected]>
event_format__print()last use was removed by 2017's commit894f3f1732cb("perf script: Useevent_format__fprintf()")
evlist__find_tracepoint_by_id()last use was removed by 2012's commite60fc847cefa("perf evlist: Remove some unused methods")
evlist__set_tp_filter_pid()last use was removed by 2017's commitdd1a50377c92("perf trace: Introducefilter_loop_pids()")
Quoted 6 lines
Quoted 3 lines
Remove them.
Signed-off-by Dr. David Alan Gilbert <[email protected]>Unfortunately it doesn't apply to the current perf-tools-next cleanly. Can you please rebase?
Done, you should see the v2 as a reply to your message with id [email protected]
Dave
Quoted 100 lines
Thanks,
NamhyungQuoted 97 lines
--- tools/perf/util/evlist.c | 18 ------------------ tools/perf/util/evlist.h | 2 -- tools/perf/util/trace-event-parse.c | 6 ------ tools/perf/util/trace-event.h | 3 --- 4 files changed, 29 deletions(-)tools/perf/util/evlist.c +0
-18@@ -362,19 +362,6 @@ __weak int arch_evlist__add_default_attrs(struct evlist *evlist,return __evlist__add_default_attrs (evlist, attrs, nr_attrs); } -struct evsel *evlist__find_tracepoint_by_id (struct evlist *evlist,int id) -{ -struct evsel *evsel; - -evlist__for_each_entry (evlist, evsel) { -if (evsel->core.attr.type ==PERF_TYPE_TRACEPOINT && - (int )evsel->core.attr.config == id) -return evsel; - } - -return NULL ; -} -struct evsel *evlist__find_tracepoint_by_name (struct evlist *evlist,const char *name) {struct evsel *evsel;@@ -1199,11 +1186,6 @@ int evlist__set_tp_filter_pids(struct evlist *evlist, size_t npids, pid_t *pids)return ret; } -int evlist__set_tp_filter_pid (struct evlist *evlist,pid_t pid) -{ -return evlist__set_tp_filter_pids (evlist,1 , &pid); -} -int evlist__append_tp_filter_pids (struct evlist *evlist,size_t npids,pid_t *pids) {char *filter =asprintf__tp_filter_pids (npids, pids);tools/perf/util/evlist.h +0
-2@@ -144,7 +144,6 @@ int __evlist__set_tracepoints_handlers(struct evlist *evlist, __evlist__set_tracepoints_handlers(evlist, array, ARRAY_SIZE(array))int evlist__set_tp_filter (struct evlist *evlist,const char *filter); -int evlist__set_tp_filter_pid (struct evlist *evlist,pid_t pid);int evlist__set_tp_filter_pids (struct evlist *evlist,size_t npids,pid_t *pids);int evlist__append_tp_filter (struct evlist *evlist,const char *filter);@@ -152,7 +151,6 @@ int evlist__append_tp_filter(struct evlist *evlist, const char *filter);int evlist__append_tp_filter_pid (struct evlist *evlist,pid_t pid);int evlist__append_tp_filter_pids (struct evlist *evlist,size_t npids,pid_t *pids); -struct evsel *evlist__find_tracepoint_by_id (struct evlist *evlist,int id);struct evsel *evlist__find_tracepoint_by_name (struct evlist *evlist,const char *name);int evlist__add_pollfd (struct evlist *evlist,int fd);tools/perf/util/trace-event-parse.c +0
-6@@ -116,12 +116,6 @@ void event_format__fprintf(struct tep_event *event,trace_seq_destroy (&s); } -void event_format__print (struct tep_event *event, -int cpu,void *data,int size) -{ -return event_format__fprintf (event, cpu, data, size, stdout); -} -/* * prev_state is of size long, which is 32 bits on 32 bit architectures. * As it needs to have the same bits for both 32 bit and 64 bit architectures tools/perf/util/trace-event.h +0
-3@@ -42,9 +42,6 @@ struct tep_event *trace_event__tp_format_id(int id);void event_format__fprintf (struct tep_event *event,int cpu,void *data,int size,FILE *fp); -void event_format__print (struct tep_event *event, -int cpu,void *data,int size); -int parse_ftrace_file (struct tep_handle *pevent,char *buf,unsigned long size);int parse_event_file (struct tep_handle *pevent,char *buf,unsigned long size,char *sys);Signature · 1 line
2.47.0
Signature · 4 lines
-----Open up your eyes, open up your mind, open up your code ------- / Dr. David Alan Gilbert | Running GNU/Linux | Happy \ \ dave @ treblig.org | | In Hex / \ _________________________|_____ http://www.treblig.org |_______/
Quoted 10 lines · On Wed, 06 Nov 2024 14:48:26 +0000, [email protected] wrote:
event_format__print()last use was removed by 2017's commit894f3f1732cb("perf script: Useevent_format__fprintf()")
evlist__find_tracepoint_by_id()last use was removed by 2012's commite60fc847cefa("perf evlist: Remove some unused methods")
evlist__set_tp_filter_pid()last use was removed by 2017's commitdd1a50377c92("perf trace: Introducefilter_loop_pids()")[...]
Applied to perf-tools-next, thanks!
Best regards,
Namhyung