static int                     print_entries                   = 15;
 
 static int                     target_pid                      = -1;
+static int                     inherit                         =  0;
 static int                     profile_cpu                     = -1;
 static int                     nr_cpus                         =  0;
 static unsigned int            realtime_prio                   =  0;
 static void start_counter(int i, int counter)
 {
        struct perf_counter_attr *attr;
-       unsigned int cpu;
+       int cpu;
 
        cpu = profile_cpu;
        if (target_pid == -1 && profile_cpu == -1)
 
        attr->sample_type       = PERF_SAMPLE_IP | PERF_SAMPLE_TID;
        attr->freq              = freq;
+       attr->inherit           = (cpu < 0) && inherit;
 
 try_again:
        fd[i][counter] = sys_perf_counter_open(attr, target_pid, cpu, group_fd, 0);
                    "only display functions with more events than this"),
        OPT_BOOLEAN('g', "group", &group,
                            "put the counters into a counter group"),
+       OPT_BOOLEAN('i', "inherit", &inherit,
+                   "child tasks inherit counters"),
        OPT_STRING('s', "sym-filter", &sym_filter, "pattern",
                    "only display symbols matchig this pattern"),
        OPT_BOOLEAN('z', "zero", &zero,