Skip to content

Commit

Permalink
perf_counter tools: Give perf top inherit option
Browse files Browse the repository at this point in the history
Currently, perf top -p only tracks the pid provided, which isn't very useful
for watching forky loads, so give it an inherit option.

Signed-off-by: Mike Galbraith <[email protected]>
Cc: Ingo Molnar <[email protected]>
Signed-off-by: Peter Zijlstra <[email protected]>
LKML-Reference: <[email protected]>
  • Loading branch information
Mike Galbraith authored and Peter Zijlstra committed Jul 22, 2009
1 parent d20ff6b commit 0fdc7e6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tools/perf/builtin-top.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ static u64 count_filter = 5;
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;
Expand Down Expand Up @@ -549,7 +550,7 @@ int group_fd;
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)
Expand All @@ -559,6 +560,7 @@ static void start_counter(int i, int counter)

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);
Expand Down Expand Up @@ -685,6 +687,8 @@ static const struct option options[] = {
"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,
Expand Down

0 comments on commit 0fdc7e6

Please sign in to comment.