Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 191090
b: refs/heads/master
c: bedbfde
h: refs/heads/master
v: v3
  • Loading branch information
Eric B Munson authored and Ingo Molnar committed Mar 15, 2010
1 parent f6846d5 commit 80a8890
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e4495262826d1eabca3529fa6ac22394eb348132
refs/heads/master: bedbfdea31daf3880745001d56450c683959ee7e
13 changes: 8 additions & 5 deletions trunk/tools/perf/builtin-record.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ static struct perf_header_attr *get_header_attr(struct perf_event_attr *a, int n
return h_attr;
}

static void create_counter(int counter, int cpu, pid_t pid)
static void create_counter(int counter, int cpu, pid_t pid, bool forks)
{
char *filter = filters[counter];
struct perf_event_attr *attr = attrs + counter;
Expand Down Expand Up @@ -277,6 +277,9 @@ static void create_counter(int counter, int cpu, pid_t pid)
attr->inherit = inherit;
attr->disabled = 1;

if (forks)
attr->enable_on_exec = 1;

try_again:
fd[nr_cpu][counter] = sys_perf_event_open(attr, pid, cpu, group_fd, 0);

Expand Down Expand Up @@ -381,13 +384,13 @@ static void create_counter(int counter, int cpu, pid_t pid)
ioctl(fd[nr_cpu][counter], PERF_EVENT_IOC_ENABLE);
}

static void open_counters(int cpu, pid_t pid)
static void open_counters(int cpu, pid_t pid, bool forks)
{
int counter;

group_fd = -1;
for (counter = 0; counter < nr_counters; counter++)
create_counter(counter, cpu, pid);
create_counter(counter, cpu, pid, forks);

nr_cpu++;
}
Expand Down Expand Up @@ -547,11 +550,11 @@ static int __cmd_record(int argc, const char **argv)


if ((!system_wide && !inherit) || profile_cpu != -1) {
open_counters(profile_cpu, target_pid);
open_counters(profile_cpu, target_pid, forks);
} else {
nr_cpus = read_cpu_map();
for (i = 0; i < nr_cpus; i++)
open_counters(cpumap[i], target_pid);
open_counters(cpumap[i], target_pid, forks);
}

if (file_new) {
Expand Down

0 comments on commit 80a8890

Please sign in to comment.