|
@@ -128,7 +128,7 @@ int __perf_evsel__read(struct perf_evsel *evsel,
|
|
}
|
|
}
|
|
|
|
|
|
static int __perf_evsel__open(struct perf_evsel *evsel, struct cpu_map *cpus,
|
|
static int __perf_evsel__open(struct perf_evsel *evsel, struct cpu_map *cpus,
|
|
- struct thread_map *threads, bool group)
|
|
|
|
|
|
+ struct thread_map *threads, bool group, bool inherit)
|
|
{
|
|
{
|
|
int cpu, thread;
|
|
int cpu, thread;
|
|
|
|
|
|
@@ -139,6 +139,8 @@ static int __perf_evsel__open(struct perf_evsel *evsel, struct cpu_map *cpus,
|
|
for (cpu = 0; cpu < cpus->nr; cpu++) {
|
|
for (cpu = 0; cpu < cpus->nr; cpu++) {
|
|
int group_fd = -1;
|
|
int group_fd = -1;
|
|
|
|
|
|
|
|
+ evsel->attr.inherit = (cpus->map[cpu] < 0) && inherit;
|
|
|
|
+
|
|
for (thread = 0; thread < threads->nr; thread++) {
|
|
for (thread = 0; thread < threads->nr; thread++) {
|
|
FD(evsel, cpu, thread) = sys_perf_event_open(&evsel->attr,
|
|
FD(evsel, cpu, thread) = sys_perf_event_open(&evsel->attr,
|
|
threads->map[thread],
|
|
threads->map[thread],
|
|
@@ -182,7 +184,7 @@ static struct {
|
|
};
|
|
};
|
|
|
|
|
|
int perf_evsel__open(struct perf_evsel *evsel, struct cpu_map *cpus,
|
|
int perf_evsel__open(struct perf_evsel *evsel, struct cpu_map *cpus,
|
|
- struct thread_map *threads, bool group)
|
|
|
|
|
|
+ struct thread_map *threads, bool group, bool inherit)
|
|
{
|
|
{
|
|
if (cpus == NULL) {
|
|
if (cpus == NULL) {
|
|
/* Work around old compiler warnings about strict aliasing */
|
|
/* Work around old compiler warnings about strict aliasing */
|
|
@@ -192,17 +194,17 @@ int perf_evsel__open(struct perf_evsel *evsel, struct cpu_map *cpus,
|
|
if (threads == NULL)
|
|
if (threads == NULL)
|
|
threads = &empty_thread_map.map;
|
|
threads = &empty_thread_map.map;
|
|
|
|
|
|
- return __perf_evsel__open(evsel, cpus, threads, group);
|
|
|
|
|
|
+ return __perf_evsel__open(evsel, cpus, threads, group, inherit);
|
|
}
|
|
}
|
|
|
|
|
|
int perf_evsel__open_per_cpu(struct perf_evsel *evsel,
|
|
int perf_evsel__open_per_cpu(struct perf_evsel *evsel,
|
|
- struct cpu_map *cpus, bool group)
|
|
|
|
|
|
+ struct cpu_map *cpus, bool group, bool inherit)
|
|
{
|
|
{
|
|
- return __perf_evsel__open(evsel, cpus, &empty_thread_map.map, group);
|
|
|
|
|
|
+ return __perf_evsel__open(evsel, cpus, &empty_thread_map.map, group, inherit);
|
|
}
|
|
}
|
|
|
|
|
|
int perf_evsel__open_per_thread(struct perf_evsel *evsel,
|
|
int perf_evsel__open_per_thread(struct perf_evsel *evsel,
|
|
- struct thread_map *threads, bool group)
|
|
|
|
|
|
+ struct thread_map *threads, bool group, bool inherit)
|
|
{
|
|
{
|
|
- return __perf_evsel__open(evsel, &empty_cpu_map.map, threads, group);
|
|
|
|
|
|
+ return __perf_evsel__open(evsel, &empty_cpu_map.map, threads, group, inherit);
|
|
}
|
|
}
|