aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf
diff options
context:
space:
mode:
authorDavid Ahern <dsahern@gmail.com>2013-05-26 00:47:10 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2013-05-28 09:24:05 -0400
commit70c57efb6118bff7426a6086026a4a8f3bd3c9e3 (patch)
treeb108d219494ff498bf4da7ac9544696692751b04 /tools/perf
parent45528f7c699a71d2f3096173980aadd43dff6eaa (diff)
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/perf')
-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 632e40e5ceca..40399cbcca77 100644
--- a/tools/perf/util/thread.c
+++ b/tools/perf/util/thread.c
@@ -14,6 +14,7 @@ struct thread *thread__new(pid_t pid)
14 if (self != NULL) { 14 if (self != NULL) {
15 map_groups__init(&self->mg); 15 map_groups__init(&self->mg);
16 self->pid = pid; 16 self->pid = pid;
17 self->ppid = -1;
17 self->comm = malloc(32); 18 self->comm = malloc(32);
18 if (self->comm) 19 if (self->comm)
19 snprintf(self->comm, 32, ":%d", self->pid); 20 snprintf(self->comm, 32, ":%d", self->pid);
@@ -82,5 +83,8 @@ int thread__fork(struct thread *self, struct thread *parent)
82 for (i = 0; i < MAP__NR_TYPES; ++i) 83 for (i = 0; i < MAP__NR_TYPES; ++i)
83 if (map_groups__clone(&self->mg, &parent->mg, i) < 0) 84 if (map_groups__clone(&self->mg, &parent->mg, i) < 0)
84 return -ENOMEM; 85 return -ENOMEM;
86
87 self->ppid = parent->pid;
88
85 return 0; 89 return 0;
86} 90}
diff --git a/tools/perf/util/thread.h b/tools/perf/util/thread.h
index 5ad266403098..eeb7ac62b9e3 100644
--- a/tools/perf/util/thread.h
+++ b/tools/perf/util/thread.h
@@ -13,6 +13,7 @@ struct thread {
13 }; 13 };
14 struct map_groups mg; 14 struct map_groups mg;
15 pid_t pid; 15 pid_t pid;
16 pid_t ppid;
16 char shortname[3]; 17 char shortname[3];
17 bool comm_set; 18 bool comm_set;
18 char *comm; 19 char *comm;