Commit 649c48a9 authored by Peter Zijlstra's avatar Peter Zijlstra Committed by Ingo Molnar

perf-report: Add modes for inherited stats and no-samples

Now that we can collect per task statistics, add modes that
make use of that facility.
Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent e6e18ec7
...@@ -41,6 +41,8 @@ static int force = 0; ...@@ -41,6 +41,8 @@ static int force = 0;
static int append_file = 0; static int append_file = 0;
static int call_graph = 0; static int call_graph = 0;
static int verbose = 0; static int verbose = 0;
static int inherit_stat = 0;
static int no_samples = 0;
static long samples; static long samples;
static struct timeval last_read; static struct timeval last_read;
...@@ -393,6 +395,12 @@ static void create_counter(int counter, int cpu, pid_t pid) ...@@ -393,6 +395,12 @@ static void create_counter(int counter, int cpu, pid_t pid)
attr->sample_freq = freq; attr->sample_freq = freq;
} }
if (no_samples)
attr->sample_freq = 0;
if (inherit_stat)
attr->inherit_stat = 1;
if (call_graph) if (call_graph)
attr->sample_type |= PERF_SAMPLE_CALLCHAIN; attr->sample_type |= PERF_SAMPLE_CALLCHAIN;
...@@ -571,7 +579,7 @@ static int __cmd_record(int argc, const char **argv) ...@@ -571,7 +579,7 @@ static int __cmd_record(int argc, const char **argv)
} }
} }
while (!done) { for (;;) {
int hits = samples; int hits = samples;
for (i = 0; i < nr_cpu; i++) { for (i = 0; i < nr_cpu; i++) {
...@@ -579,9 +587,12 @@ static int __cmd_record(int argc, const char **argv) ...@@ -579,9 +587,12 @@ static int __cmd_record(int argc, const char **argv)
mmap_read(&mmap_array[i][counter]); mmap_read(&mmap_array[i][counter]);
} }
if (hits == samples) if (hits == samples) {
if (done)
break;
ret = poll(event_array, nr_poll, 100); ret = poll(event_array, nr_poll, 100);
} }
}
/* /*
* Approximate RIP event size: 24 bytes. * Approximate RIP event size: 24 bytes.
...@@ -629,6 +640,10 @@ static const struct option options[] = { ...@@ -629,6 +640,10 @@ static const struct option options[] = {
"do call-graph (stack chain/backtrace) recording"), "do call-graph (stack chain/backtrace) recording"),
OPT_BOOLEAN('v', "verbose", &verbose, OPT_BOOLEAN('v', "verbose", &verbose,
"be more verbose (show counter open errors, etc)"), "be more verbose (show counter open errors, etc)"),
OPT_BOOLEAN('s', "stat", &inherit_stat,
"per thread counts"),
OPT_BOOLEAN('n', "no-samples", &no_samples,
"don't sample"),
OPT_END() OPT_END()
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment