diff options
author | Adrian Hunter <adrian.hunter@intel.com> | 2013-08-27 04:23:03 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-08-29 10:51:31 -0400 |
commit | 314add6b1f045b59ca39683bd0cbc5310cd203f2 (patch) | |
tree | e0583a022963b6e02b6f587db07f8b52985b4532 /tools/perf/builtin-sched.c | |
parent | 00e4cb1ced1b17c35465defafe86d156cbd7544e (diff) |
perf tools: change machine__findnew_thread() to set thread pid
Add a new parameter for 'pid' to machine__findnew_thread().
Change callers to pass 'pid' when it is known.
Note that callers sometimes want to find the main thread
which has the memory maps. The main thread has tid == pid
so the usage in that case is:
machine__findnew_thread(machine, pid, pid)
whereas the usage to find the specific thread is:
machine__findnew_thread(machine, pid, tid)
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Acked-by: David Ahern <dsahern@gmail.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1377591794-30553-2-git-send-email-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-sched.c')
-rw-r--r-- | tools/perf/builtin-sched.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c index f809cc7fb7d9..d8c51b2f263f 100644 --- a/tools/perf/builtin-sched.c +++ b/tools/perf/builtin-sched.c | |||
@@ -724,8 +724,10 @@ static int replay_fork_event(struct perf_sched *sched, | |||
724 | { | 724 | { |
725 | struct thread *child, *parent; | 725 | struct thread *child, *parent; |
726 | 726 | ||
727 | child = machine__findnew_thread(machine, event->fork.tid); | 727 | child = machine__findnew_thread(machine, event->fork.pid, |
728 | parent = machine__findnew_thread(machine, event->fork.ptid); | 728 | event->fork.tid); |
729 | parent = machine__findnew_thread(machine, event->fork.ppid, | ||
730 | event->fork.ptid); | ||
729 | 731 | ||
730 | if (child == NULL || parent == NULL) { | 732 | if (child == NULL || parent == NULL) { |
731 | pr_debug("thread does not exist on fork event: child %p, parent %p\n", | 733 | pr_debug("thread does not exist on fork event: child %p, parent %p\n", |
@@ -934,8 +936,8 @@ static int latency_switch_event(struct perf_sched *sched, | |||
934 | return -1; | 936 | return -1; |
935 | } | 937 | } |
936 | 938 | ||
937 | sched_out = machine__findnew_thread(machine, prev_pid); | 939 | sched_out = machine__findnew_thread(machine, 0, prev_pid); |
938 | sched_in = machine__findnew_thread(machine, next_pid); | 940 | sched_in = machine__findnew_thread(machine, 0, next_pid); |
939 | 941 | ||
940 | out_events = thread_atoms_search(&sched->atom_root, sched_out, &sched->cmp_pid); | 942 | out_events = thread_atoms_search(&sched->atom_root, sched_out, &sched->cmp_pid); |
941 | if (!out_events) { | 943 | if (!out_events) { |
@@ -978,7 +980,7 @@ static int latency_runtime_event(struct perf_sched *sched, | |||
978 | { | 980 | { |
979 | const u32 pid = perf_evsel__intval(evsel, sample, "pid"); | 981 | const u32 pid = perf_evsel__intval(evsel, sample, "pid"); |
980 | const u64 runtime = perf_evsel__intval(evsel, sample, "runtime"); | 982 | const u64 runtime = perf_evsel__intval(evsel, sample, "runtime"); |
981 | struct thread *thread = machine__findnew_thread(machine, pid); | 983 | struct thread *thread = machine__findnew_thread(machine, 0, pid); |
982 | struct work_atoms *atoms = thread_atoms_search(&sched->atom_root, thread, &sched->cmp_pid); | 984 | struct work_atoms *atoms = thread_atoms_search(&sched->atom_root, thread, &sched->cmp_pid); |
983 | u64 timestamp = sample->time; | 985 | u64 timestamp = sample->time; |
984 | int cpu = sample->cpu; | 986 | int cpu = sample->cpu; |
@@ -1016,7 +1018,7 @@ static int latency_wakeup_event(struct perf_sched *sched, | |||
1016 | if (!success) | 1018 | if (!success) |
1017 | return 0; | 1019 | return 0; |
1018 | 1020 | ||
1019 | wakee = machine__findnew_thread(machine, pid); | 1021 | wakee = machine__findnew_thread(machine, 0, pid); |
1020 | atoms = thread_atoms_search(&sched->atom_root, wakee, &sched->cmp_pid); | 1022 | atoms = thread_atoms_search(&sched->atom_root, wakee, &sched->cmp_pid); |
1021 | if (!atoms) { | 1023 | if (!atoms) { |
1022 | if (thread_atoms_insert(sched, wakee)) | 1024 | if (thread_atoms_insert(sched, wakee)) |
@@ -1070,7 +1072,7 @@ static int latency_migrate_task_event(struct perf_sched *sched, | |||
1070 | if (sched->profile_cpu == -1) | 1072 | if (sched->profile_cpu == -1) |
1071 | return 0; | 1073 | return 0; |
1072 | 1074 | ||
1073 | migrant = machine__findnew_thread(machine, pid); | 1075 | migrant = machine__findnew_thread(machine, 0, pid); |
1074 | atoms = thread_atoms_search(&sched->atom_root, migrant, &sched->cmp_pid); | 1076 | atoms = thread_atoms_search(&sched->atom_root, migrant, &sched->cmp_pid); |
1075 | if (!atoms) { | 1077 | if (!atoms) { |
1076 | if (thread_atoms_insert(sched, migrant)) | 1078 | if (thread_atoms_insert(sched, migrant)) |
@@ -1289,8 +1291,8 @@ static int map_switch_event(struct perf_sched *sched, struct perf_evsel *evsel, | |||
1289 | return -1; | 1291 | return -1; |
1290 | } | 1292 | } |
1291 | 1293 | ||
1292 | sched_out = machine__findnew_thread(machine, prev_pid); | 1294 | sched_out = machine__findnew_thread(machine, 0, prev_pid); |
1293 | sched_in = machine__findnew_thread(machine, next_pid); | 1295 | sched_in = machine__findnew_thread(machine, 0, next_pid); |
1294 | 1296 | ||
1295 | sched->curr_thread[this_cpu] = sched_in; | 1297 | sched->curr_thread[this_cpu] = sched_in; |
1296 | 1298 | ||