提交 0fdc7e67 编写于 作者: M Mike Galbraith 提交者: Peter Zijlstra

perf_counter tools: Give perf top inherit option

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: NMike Galbraith <efault@gmx.de>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <1248165036.9795.10.camel@marge.simson.net>
上级 d20ff6bd
...@@ -58,6 +58,7 @@ static u64 count_filter = 5; ...@@ -58,6 +58,7 @@ static u64 count_filter = 5;
static int print_entries = 15; static int print_entries = 15;
static int target_pid = -1; static int target_pid = -1;
static int inherit = 0;
static int profile_cpu = -1; static int profile_cpu = -1;
static int nr_cpus = 0; static int nr_cpus = 0;
static unsigned int realtime_prio = 0; static unsigned int realtime_prio = 0;
...@@ -549,7 +550,7 @@ int group_fd; ...@@ -549,7 +550,7 @@ int group_fd;
static void start_counter(int i, int counter) static void start_counter(int i, int counter)
{ {
struct perf_counter_attr *attr; struct perf_counter_attr *attr;
unsigned int cpu; int cpu;
cpu = profile_cpu; cpu = profile_cpu;
if (target_pid == -1 && profile_cpu == -1) if (target_pid == -1 && profile_cpu == -1)
...@@ -559,6 +560,7 @@ static void start_counter(int i, int counter) ...@@ -559,6 +560,7 @@ static void start_counter(int i, int counter)
attr->sample_type = PERF_SAMPLE_IP | PERF_SAMPLE_TID; attr->sample_type = PERF_SAMPLE_IP | PERF_SAMPLE_TID;
attr->freq = freq; attr->freq = freq;
attr->inherit = (cpu < 0) && inherit;
try_again: try_again:
fd[i][counter] = sys_perf_counter_open(attr, target_pid, cpu, group_fd, 0); fd[i][counter] = sys_perf_counter_open(attr, target_pid, cpu, group_fd, 0);
...@@ -685,6 +687,8 @@ static const struct option options[] = { ...@@ -685,6 +687,8 @@ static const struct option options[] = {
"only display functions with more events than this"), "only display functions with more events than this"),
OPT_BOOLEAN('g', "group", &group, OPT_BOOLEAN('g', "group", &group,
"put the counters into a counter 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", OPT_STRING('s', "sym-filter", &sym_filter, "pattern",
"only display symbols matchig this pattern"), "only display symbols matchig this pattern"),
OPT_BOOLEAN('z', "zero", &zero, OPT_BOOLEAN('z', "zero", &zero,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册