perf tools: Add pid/tid filtering to report and script commands
[deliverable/linux.git] / tools / perf / util / thread.h
index 160fd066a7d1efe7a45a9bcfb8012bf0bccfc777..9b8a54dc34a81963d8026e226bcd3334713b1606 100644 (file)
@@ -7,6 +7,7 @@
 #include <sys/types.h>
 #include "symbol.h"
 #include <strlist.h>
+#include <intlist.h>
 
 struct thread_stack;
 
@@ -20,6 +21,7 @@ struct thread {
        pid_t                   tid;
        pid_t                   ppid;
        int                     cpu;
+       int                     refcnt;
        char                    shortname[3];
        bool                    comm_set;
        bool                    dead; /* if set thread has exited */
@@ -37,6 +39,18 @@ struct comm;
 struct thread *thread__new(pid_t pid, pid_t tid);
 int thread__init_map_groups(struct thread *thread, struct machine *machine);
 void thread__delete(struct thread *thread);
+
+struct thread *thread__get(struct thread *thread);
+void thread__put(struct thread *thread);
+
+static inline void __thread__zput(struct thread **thread)
+{
+       thread__put(*thread);
+       *thread = NULL;
+}
+
+#define thread__zput(thread) __thread__zput(&thread)
+
 static inline void thread__exited(struct thread *thread)
 {
        thread->dead = true;
@@ -87,6 +101,16 @@ static inline bool thread__is_filtered(struct thread *thread)
                return true;
        }
 
+       if (symbol_conf.pid_list &&
+           !intlist__has_entry(symbol_conf.pid_list, thread->pid_)) {
+               return true;
+       }
+
+       if (symbol_conf.tid_list &&
+           !intlist__has_entry(symbol_conf.tid_list, thread->tid)) {
+               return true;
+       }
+
        return false;
 }
 
This page took 0.030385 seconds and 5 git commands to generate.