summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorDavid Ahern <dsahern@gmail.com>2013-05-25 22:47:10 -0600
committerChanho Park <chanho61.park@samsung.com>2014-08-08 14:35:36 +0900
commit11260b3afeb1918e82b3a13e43e1e7a30b60fd8b (patch)
treeeab2e3827625d6bc1d46caae9ab23054c281b350 /tools
parent77d3c08ce51f4ad31425eceb78c6838bf87176a4 (diff)
downloadlinux-3.10-11260b3afeb1918e82b3a13e43e1e7a30b60fd8b.tar.gz
linux-3.10-11260b3afeb1918e82b3a13e43e1e7a30b60fd8b.tar.bz2
linux-3.10-11260b3afeb1918e82b3a13e43e1e7a30b60fd8b.zip
perf tools: Save parent pid in thread struct
Information is available, so why not save it in case some command wants to use it. 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/1369543631-5106-1-git-send-email-dsahern@gmail.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/util/thread.c4
-rw-r--r--tools/perf/util/thread.h1
2 files changed, 5 insertions, 0 deletions
diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c
index 632e40e5cec..40399cbcca7 100644
--- a/tools/perf/util/thread.c
+++ b/tools/perf/util/thread.c
@@ -14,6 +14,7 @@ struct thread *thread__new(pid_t pid)
if (self != NULL) {
map_groups__init(&self->mg);
self->pid = pid;
+ self->ppid = -1;
self->comm = malloc(32);
if (self->comm)
snprintf(self->comm, 32, ":%d", self->pid);
@@ -82,5 +83,8 @@ int thread__fork(struct thread *self, struct thread *parent)
for (i = 0; i < MAP__NR_TYPES; ++i)
if (map_groups__clone(&self->mg, &parent->mg, i) < 0)
return -ENOMEM;
+
+ self->ppid = parent->pid;
+
return 0;
}
diff --git a/tools/perf/util/thread.h b/tools/perf/util/thread.h
index 5ad26640309..eeb7ac62b9e 100644
--- a/tools/perf/util/thread.h
+++ b/tools/perf/util/thread.h
@@ -13,6 +13,7 @@ struct thread {
};
struct map_groups mg;
pid_t pid;
+ pid_t ppid;
char shortname[3];
bool comm_set;
char *comm;