aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/builtin-top.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 95d5c0ae375a..c0a423004e15 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -58,6 +58,7 @@ static u64 count_filter = 5;
58static int print_entries = 15; 58static int print_entries = 15;
59 59
60static int target_pid = -1; 60static int target_pid = -1;
61static int inherit = 0;
61static int profile_cpu = -1; 62static int profile_cpu = -1;
62static int nr_cpus = 0; 63static int nr_cpus = 0;
63static unsigned int realtime_prio = 0; 64static unsigned int realtime_prio = 0;
@@ -549,7 +550,7 @@ int group_fd;
549static void start_counter(int i, int counter) 550static void start_counter(int i, int counter)
550{ 551{
551 struct perf_counter_attr *attr; 552 struct perf_counter_attr *attr;
552 unsigned int cpu; 553 int cpu;
553 554
554 cpu = profile_cpu; 555 cpu = profile_cpu;
555 if (target_pid == -1 && profile_cpu == -1) 556 if (target_pid == -1 && profile_cpu == -1)
@@ -559,6 +560,7 @@ static void start_counter(int i, int counter)
559 560
560 attr->sample_type = PERF_SAMPLE_IP | PERF_SAMPLE_TID; 561 attr->sample_type = PERF_SAMPLE_IP | PERF_SAMPLE_TID;
561 attr->freq = freq; 562 attr->freq = freq;
563 attr->inherit = (cpu < 0) && inherit;
562 564
563try_again: 565try_again:
564 fd[i][counter] = sys_perf_counter_open(attr, target_pid, cpu, group_fd, 0); 566 fd[i][counter] = sys_perf_counter_open(attr, target_pid, cpu, group_fd, 0);
@@ -685,6 +687,8 @@ static const struct option options[] = {
685 "only display functions with more events than this"), 687 "only display functions with more events than this"),
686 OPT_BOOLEAN('g', "group", &group, 688 OPT_BOOLEAN('g', "group", &group,
687 "put the counters into a counter group"), 689 "put the counters into a counter group"),
690 OPT_BOOLEAN('i', "inherit", &inherit,
691 "child tasks inherit counters"),
688 OPT_STRING('s', "sym-filter", &sym_filter, "pattern", 692 OPT_STRING('s', "sym-filter", &sym_filter, "pattern",
689 "only display symbols matchig this pattern"), 693 "only display symbols matchig this pattern"),
690 OPT_BOOLEAN('z', "zero", &zero, 694 OPT_BOOLEAN('z', "zero", &zero,