mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
perf machine: Fix the value used for unknown pids
The value used for unknown pids cannot be zero because that is used by the "idle" task. Use -1 instead. Also handle the unknown pid case when creating map groups. Note that, threads with an unknown pid should not occur because fork (or synthesized) events precede the thread's existence. Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Jiri Olsa <jolsa@redhat.com> 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/1405332185-4050-2-git-send-email-adrian.hunter@intel.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
57608cfd88
commit
1fcb876863
4 changed files with 13 additions and 12 deletions
|
@ -935,8 +935,8 @@ static int latency_switch_event(struct perf_sched *sched,
|
|||
return -1;
|
||||
}
|
||||
|
||||
sched_out = machine__findnew_thread(machine, 0, prev_pid);
|
||||
sched_in = machine__findnew_thread(machine, 0, next_pid);
|
||||
sched_out = machine__findnew_thread(machine, -1, prev_pid);
|
||||
sched_in = machine__findnew_thread(machine, -1, next_pid);
|
||||
|
||||
out_events = thread_atoms_search(&sched->atom_root, sched_out, &sched->cmp_pid);
|
||||
if (!out_events) {
|
||||
|
@ -979,7 +979,7 @@ static int latency_runtime_event(struct perf_sched *sched,
|
|||
{
|
||||
const u32 pid = perf_evsel__intval(evsel, sample, "pid");
|
||||
const u64 runtime = perf_evsel__intval(evsel, sample, "runtime");
|
||||
struct thread *thread = machine__findnew_thread(machine, 0, pid);
|
||||
struct thread *thread = machine__findnew_thread(machine, -1, pid);
|
||||
struct work_atoms *atoms = thread_atoms_search(&sched->atom_root, thread, &sched->cmp_pid);
|
||||
u64 timestamp = sample->time;
|
||||
int cpu = sample->cpu;
|
||||
|
@ -1012,7 +1012,7 @@ static int latency_wakeup_event(struct perf_sched *sched,
|
|||
struct thread *wakee;
|
||||
u64 timestamp = sample->time;
|
||||
|
||||
wakee = machine__findnew_thread(machine, 0, pid);
|
||||
wakee = machine__findnew_thread(machine, -1, pid);
|
||||
atoms = thread_atoms_search(&sched->atom_root, wakee, &sched->cmp_pid);
|
||||
if (!atoms) {
|
||||
if (thread_atoms_insert(sched, wakee))
|
||||
|
@ -1072,7 +1072,7 @@ static int latency_migrate_task_event(struct perf_sched *sched,
|
|||
if (sched->profile_cpu == -1)
|
||||
return 0;
|
||||
|
||||
migrant = machine__findnew_thread(machine, 0, pid);
|
||||
migrant = machine__findnew_thread(machine, -1, pid);
|
||||
atoms = thread_atoms_search(&sched->atom_root, migrant, &sched->cmp_pid);
|
||||
if (!atoms) {
|
||||
if (thread_atoms_insert(sched, migrant))
|
||||
|
@ -1290,7 +1290,7 @@ static int map_switch_event(struct perf_sched *sched, struct perf_evsel *evsel,
|
|||
return -1;
|
||||
}
|
||||
|
||||
sched_in = machine__findnew_thread(machine, 0, next_pid);
|
||||
sched_in = machine__findnew_thread(machine, -1, next_pid);
|
||||
|
||||
sched->curr_thread[this_cpu] = sched_in;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue