perf tools: Use tid for finding thread
[cascardo/linux.git] / tools / perf / tests / code-reading.c
index 653a8fe..67f2d63 100644 (file)
@@ -1,8 +1,7 @@
-#include <sys/types.h>
+#include <linux/types.h>
 #include <stdlib.h>
 #include <unistd.h>
 #include <stdio.h>
-#include <inttypes.h>
 #include <ctype.h>
 #include <string.h>
 
@@ -257,7 +256,7 @@ static int process_sample_event(struct machine *machine,
                return -1;
        }
 
-       thread = machine__findnew_thread(machine, sample.pid, sample.pid);
+       thread = machine__findnew_thread(machine, sample.pid, sample.tid);
        if (!thread) {
                pr_debug("machine__findnew_thread failed\n");
                return -1;
@@ -504,6 +503,7 @@ static int do_test_code_reading(bool try_kcore)
                if (ret < 0) {
                        if (!excl_kernel) {
                                excl_kernel = true;
+                               perf_evlist__set_maps(evlist, NULL, NULL);
                                perf_evlist__delete(evlist);
                                evlist = NULL;
                                continue;