perf thread: Move comm_list check into function
authorDavid Ahern <dsahern@gmail.com>
Mon, 18 Nov 2013 20:32:47 +0000 (13:32 -0700)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 27 Nov 2013 17:58:37 +0000 (14:58 -0300)
Signed-off-by: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1384806771-2945-5-git-send-email-dsahern@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/event.c
tools/perf/util/thread.h

index bb788c109fe6efa4ecb2ae5784efa49cf33bca73..c77814bf01e1a7f89857ba8742ce7ec7cbcfaf5e 100644 (file)
@@ -732,8 +732,7 @@ int perf_event__preprocess_sample(const union perf_event *event,
        if (thread == NULL)
                return -1;
 
-       if (symbol_conf.comm_list &&
-           !strlist__has_entry(symbol_conf.comm_list, thread__comm_str(thread)))
+       if (thread__is_filtered(thread))
                goto out_filtered;
 
        dump_printf(" ... thread: %s:%d\n", thread__comm_str(thread), thread->tid);
index 897c1b2a750a278c8cecf000c892d5f6bba8f0af..5b856bf942e11fa9691c28551a88b53b4ac3d5f2 100644 (file)
@@ -6,6 +6,7 @@
 #include <unistd.h>
 #include <sys/types.h>
 #include "symbol.h"
+#include <strlist.h>
 
 struct thread {
        union {
@@ -66,4 +67,15 @@ static inline void thread__set_priv(struct thread *thread, void *p)
 {
        thread->priv = p;
 }
+
+static inline bool thread__is_filtered(struct thread *thread)
+{
+       if (symbol_conf.comm_list &&
+           !strlist__has_entry(symbol_conf.comm_list, thread__comm_str(thread))) {
+               return true;
+       }
+
+       return false;
+}
+
 #endif /* __PERF_THREAD_H */