diff options
Diffstat (limited to 'tools/perf/builtin-sched.c')
-rw-r--r-- | tools/perf/builtin-sched.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c index c38d06c04775..f83c08c0dd87 100644 --- a/tools/perf/builtin-sched.c +++ b/tools/perf/builtin-sched.c | |||
@@ -10,6 +10,7 @@ | |||
10 | #include "util/header.h" | 10 | #include "util/header.h" |
11 | #include "util/session.h" | 11 | #include "util/session.h" |
12 | #include "util/tool.h" | 12 | #include "util/tool.h" |
13 | #include "util/cloexec.h" | ||
13 | 14 | ||
14 | #include "util/parse-options.h" | 15 | #include "util/parse-options.h" |
15 | #include "util/trace-event.h" | 16 | #include "util/trace-event.h" |
@@ -434,7 +435,8 @@ static int self_open_counters(void) | |||
434 | attr.type = PERF_TYPE_SOFTWARE; | 435 | attr.type = PERF_TYPE_SOFTWARE; |
435 | attr.config = PERF_COUNT_SW_TASK_CLOCK; | 436 | attr.config = PERF_COUNT_SW_TASK_CLOCK; |
436 | 437 | ||
437 | fd = sys_perf_event_open(&attr, 0, -1, -1, 0); | 438 | fd = sys_perf_event_open(&attr, 0, -1, -1, |
439 | perf_event_open_cloexec_flag()); | ||
438 | 440 | ||
439 | if (fd < 0) | 441 | if (fd < 0) |
440 | pr_err("Error: sys_perf_event_open() syscall returned " | 442 | pr_err("Error: sys_perf_event_open() syscall returned " |
@@ -935,8 +937,8 @@ static int latency_switch_event(struct perf_sched *sched, | |||
935 | return -1; | 937 | return -1; |
936 | } | 938 | } |
937 | 939 | ||
938 | sched_out = machine__findnew_thread(machine, 0, prev_pid); | 940 | sched_out = machine__findnew_thread(machine, -1, prev_pid); |
939 | sched_in = machine__findnew_thread(machine, 0, next_pid); | 941 | sched_in = machine__findnew_thread(machine, -1, next_pid); |
940 | 942 | ||
941 | out_events = thread_atoms_search(&sched->atom_root, sched_out, &sched->cmp_pid); | 943 | out_events = thread_atoms_search(&sched->atom_root, sched_out, &sched->cmp_pid); |
942 | if (!out_events) { | 944 | if (!out_events) { |
@@ -979,7 +981,7 @@ static int latency_runtime_event(struct perf_sched *sched, | |||
979 | { | 981 | { |
980 | const u32 pid = perf_evsel__intval(evsel, sample, "pid"); | 982 | const u32 pid = perf_evsel__intval(evsel, sample, "pid"); |
981 | const u64 runtime = perf_evsel__intval(evsel, sample, "runtime"); | 983 | const u64 runtime = perf_evsel__intval(evsel, sample, "runtime"); |
982 | struct thread *thread = machine__findnew_thread(machine, 0, pid); | 984 | struct thread *thread = machine__findnew_thread(machine, -1, pid); |
983 | struct work_atoms *atoms = thread_atoms_search(&sched->atom_root, thread, &sched->cmp_pid); | 985 | struct work_atoms *atoms = thread_atoms_search(&sched->atom_root, thread, &sched->cmp_pid); |
984 | u64 timestamp = sample->time; | 986 | u64 timestamp = sample->time; |
985 | int cpu = sample->cpu; | 987 | int cpu = sample->cpu; |
@@ -1012,7 +1014,7 @@ static int latency_wakeup_event(struct perf_sched *sched, | |||
1012 | struct thread *wakee; | 1014 | struct thread *wakee; |
1013 | u64 timestamp = sample->time; | 1015 | u64 timestamp = sample->time; |
1014 | 1016 | ||
1015 | wakee = machine__findnew_thread(machine, 0, pid); | 1017 | wakee = machine__findnew_thread(machine, -1, pid); |
1016 | atoms = thread_atoms_search(&sched->atom_root, wakee, &sched->cmp_pid); | 1018 | atoms = thread_atoms_search(&sched->atom_root, wakee, &sched->cmp_pid); |
1017 | if (!atoms) { | 1019 | if (!atoms) { |
1018 | if (thread_atoms_insert(sched, wakee)) | 1020 | if (thread_atoms_insert(sched, wakee)) |
@@ -1072,7 +1074,7 @@ static int latency_migrate_task_event(struct perf_sched *sched, | |||
1072 | if (sched->profile_cpu == -1) | 1074 | if (sched->profile_cpu == -1) |
1073 | return 0; | 1075 | return 0; |
1074 | 1076 | ||
1075 | migrant = machine__findnew_thread(machine, 0, pid); | 1077 | migrant = machine__findnew_thread(machine, -1, pid); |
1076 | atoms = thread_atoms_search(&sched->atom_root, migrant, &sched->cmp_pid); | 1078 | atoms = thread_atoms_search(&sched->atom_root, migrant, &sched->cmp_pid); |
1077 | if (!atoms) { | 1079 | if (!atoms) { |
1078 | if (thread_atoms_insert(sched, migrant)) | 1080 | if (thread_atoms_insert(sched, migrant)) |
@@ -1290,7 +1292,7 @@ static int map_switch_event(struct perf_sched *sched, struct perf_evsel *evsel, | |||
1290 | return -1; | 1292 | return -1; |
1291 | } | 1293 | } |
1292 | 1294 | ||
1293 | sched_in = machine__findnew_thread(machine, 0, next_pid); | 1295 | sched_in = machine__findnew_thread(machine, -1, next_pid); |
1294 | 1296 | ||
1295 | sched->curr_thread[this_cpu] = sched_in; | 1297 | sched->curr_thread[this_cpu] = sched_in; |
1296 | 1298 | ||