diff options
Diffstat (limited to 'tools/perf/builtin-record.c')
-rw-r--r-- | tools/perf/builtin-record.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index d18546f37d7c..90c98082af10 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c | |||
@@ -43,6 +43,7 @@ static int call_graph = 0; | |||
43 | static int verbose = 0; | 43 | static int verbose = 0; |
44 | static int inherit_stat = 0; | 44 | static int inherit_stat = 0; |
45 | static int no_samples = 0; | 45 | static int no_samples = 0; |
46 | static int sample_address = 0; | ||
46 | 47 | ||
47 | static long samples; | 48 | static long samples; |
48 | static struct timeval last_read; | 49 | static struct timeval last_read; |
@@ -294,7 +295,7 @@ static void pid_synthesize_mmap_samples(pid_t pid) | |||
294 | while (1) { | 295 | while (1) { |
295 | char bf[BUFSIZ], *pbf = bf; | 296 | char bf[BUFSIZ], *pbf = bf; |
296 | struct mmap_event mmap_ev = { | 297 | struct mmap_event mmap_ev = { |
297 | .header.type = PERF_EVENT_MMAP, | 298 | .header = { .type = PERF_EVENT_MMAP }, |
298 | }; | 299 | }; |
299 | int n; | 300 | int n; |
300 | size_t size; | 301 | size_t size; |
@@ -313,6 +314,10 @@ static void pid_synthesize_mmap_samples(pid_t pid) | |||
313 | if (*pbf == 'x') { /* vm_exec */ | 314 | if (*pbf == 'x') { /* vm_exec */ |
314 | char *execname = strchr(bf, '/'); | 315 | char *execname = strchr(bf, '/'); |
315 | 316 | ||
317 | /* Catch VDSO */ | ||
318 | if (execname == NULL) | ||
319 | execname = strstr(bf, "[vdso]"); | ||
320 | |||
316 | if (execname == NULL) | 321 | if (execname == NULL) |
317 | continue; | 322 | continue; |
318 | 323 | ||
@@ -401,9 +406,13 @@ static void create_counter(int counter, int cpu, pid_t pid) | |||
401 | if (inherit_stat) | 406 | if (inherit_stat) |
402 | attr->inherit_stat = 1; | 407 | attr->inherit_stat = 1; |
403 | 408 | ||
409 | if (sample_address) | ||
410 | attr->sample_type |= PERF_SAMPLE_ADDR; | ||
411 | |||
404 | if (call_graph) | 412 | if (call_graph) |
405 | attr->sample_type |= PERF_SAMPLE_CALLCHAIN; | 413 | attr->sample_type |= PERF_SAMPLE_CALLCHAIN; |
406 | 414 | ||
415 | |||
407 | attr->mmap = track; | 416 | attr->mmap = track; |
408 | attr->comm = track; | 417 | attr->comm = track; |
409 | attr->inherit = (cpu < 0) && inherit; | 418 | attr->inherit = (cpu < 0) && inherit; |
@@ -645,16 +654,19 @@ static const struct option options[] = { | |||
645 | "be more verbose (show counter open errors, etc)"), | 654 | "be more verbose (show counter open errors, etc)"), |
646 | OPT_BOOLEAN('s', "stat", &inherit_stat, | 655 | OPT_BOOLEAN('s', "stat", &inherit_stat, |
647 | "per thread counts"), | 656 | "per thread counts"), |
657 | OPT_BOOLEAN('d', "data", &sample_address, | ||
658 | "Sample addresses"), | ||
648 | OPT_BOOLEAN('n', "no-samples", &no_samples, | 659 | OPT_BOOLEAN('n', "no-samples", &no_samples, |
649 | "don't sample"), | 660 | "don't sample"), |
650 | OPT_END() | 661 | OPT_END() |
651 | }; | 662 | }; |
652 | 663 | ||
653 | int cmd_record(int argc, const char **argv, const char *prefix) | 664 | int cmd_record(int argc, const char **argv, const char *prefix __used) |
654 | { | 665 | { |
655 | int counter; | 666 | int counter; |
656 | 667 | ||
657 | argc = parse_options(argc, argv, options, record_usage, 0); | 668 | argc = parse_options(argc, argv, options, record_usage, |
669 | PARSE_OPT_STOP_AT_NON_OPTION); | ||
658 | if (!argc && target_pid == -1 && !system_wide) | 670 | if (!argc && target_pid == -1 && !system_wide) |
659 | usage_with_options(record_usage, options); | 671 | usage_with_options(record_usage, options); |
660 | 672 | ||