diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-08-19 08:50:35 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-08-24 03:24:01 -0400 |
commit | 96d6e48bc6b38342a59ccd23e25907d12caaeaf8 (patch) | |
tree | b770d9e94545e198e120fac31f650600a855f689 | |
parent | 6e086437f35ad9fda448711732c4ce0f82aad569 (diff) | |
parent | 4464fcaa9cbfc9c551956b48af203e2f775ca892 (diff) |
Merge branch 'perfcounters/urgent' into perfcounters/core
Conflicts:
tools/perf/builtin-annotate.c
tools/perf/builtin-report.c
Merge reason: resolve these conflicts.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | kernel/perf_counter.c | 17 | ||||
-rw-r--r-- | tools/perf/Documentation/Makefile | 2 | ||||
-rw-r--r-- | tools/perf/Documentation/examples.txt (renamed from tools/perf/Documentation/perf-examples.txt) | 0 | ||||
-rw-r--r-- | tools/perf/builtin-annotate.c | 14 | ||||
-rw-r--r-- | tools/perf/builtin-report.c | 7 |
5 files changed, 38 insertions, 2 deletions
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c index 534e20d14d63..f274e1959885 100644 --- a/kernel/perf_counter.c +++ b/kernel/perf_counter.c | |||
@@ -1503,10 +1503,21 @@ static void perf_counter_enable_on_exec(struct task_struct *task) | |||
1503 | */ | 1503 | */ |
1504 | static void __perf_counter_read(void *info) | 1504 | static void __perf_counter_read(void *info) |
1505 | { | 1505 | { |
1506 | struct perf_cpu_context *cpuctx = &__get_cpu_var(perf_cpu_context); | ||
1506 | struct perf_counter *counter = info; | 1507 | struct perf_counter *counter = info; |
1507 | struct perf_counter_context *ctx = counter->ctx; | 1508 | struct perf_counter_context *ctx = counter->ctx; |
1508 | unsigned long flags; | 1509 | unsigned long flags; |
1509 | 1510 | ||
1511 | /* | ||
1512 | * If this is a task context, we need to check whether it is | ||
1513 | * the current task context of this cpu. If not it has been | ||
1514 | * scheduled out before the smp call arrived. In that case | ||
1515 | * counter->count would have been updated to a recent sample | ||
1516 | * when the counter was scheduled out. | ||
1517 | */ | ||
1518 | if (ctx->task && cpuctx->task_ctx != ctx) | ||
1519 | return; | ||
1520 | |||
1510 | local_irq_save(flags); | 1521 | local_irq_save(flags); |
1511 | if (ctx->is_active) | 1522 | if (ctx->is_active) |
1512 | update_context_time(ctx); | 1523 | update_context_time(ctx); |
@@ -1780,7 +1791,7 @@ static int perf_counter_read_group(struct perf_counter *counter, | |||
1780 | size += err; | 1791 | size += err; |
1781 | 1792 | ||
1782 | list_for_each_entry(sub, &leader->sibling_list, list_entry) { | 1793 | list_for_each_entry(sub, &leader->sibling_list, list_entry) { |
1783 | err = perf_counter_read_entry(counter, read_format, | 1794 | err = perf_counter_read_entry(sub, read_format, |
1784 | buf + size); | 1795 | buf + size); |
1785 | if (err < 0) | 1796 | if (err < 0) |
1786 | return err; | 1797 | return err; |
@@ -2008,6 +2019,10 @@ int perf_counter_task_disable(void) | |||
2008 | return 0; | 2019 | return 0; |
2009 | } | 2020 | } |
2010 | 2021 | ||
2022 | #ifndef PERF_COUNTER_INDEX_OFFSET | ||
2023 | # define PERF_COUNTER_INDEX_OFFSET 0 | ||
2024 | #endif | ||
2025 | |||
2011 | static int perf_counter_index(struct perf_counter *counter) | 2026 | static int perf_counter_index(struct perf_counter *counter) |
2012 | { | 2027 | { |
2013 | if (counter->state != PERF_COUNTER_STATE_ACTIVE) | 2028 | if (counter->state != PERF_COUNTER_STATE_ACTIVE) |
diff --git a/tools/perf/Documentation/Makefile b/tools/perf/Documentation/Makefile index 5457192e1b41..bdd3b7ecad0a 100644 --- a/tools/perf/Documentation/Makefile +++ b/tools/perf/Documentation/Makefile | |||
@@ -35,7 +35,7 @@ man7dir=$(mandir)/man7 | |||
35 | # DESTDIR= | 35 | # DESTDIR= |
36 | 36 | ||
37 | ASCIIDOC=asciidoc | 37 | ASCIIDOC=asciidoc |
38 | ASCIIDOC_EXTRA = | 38 | ASCIIDOC_EXTRA = --unsafe |
39 | MANPAGE_XSL = manpage-normal.xsl | 39 | MANPAGE_XSL = manpage-normal.xsl |
40 | XMLTO_EXTRA = | 40 | XMLTO_EXTRA = |
41 | INSTALL?=install | 41 | INSTALL?=install |
diff --git a/tools/perf/Documentation/perf-examples.txt b/tools/perf/Documentation/examples.txt index 8eb6c489fb15..8eb6c489fb15 100644 --- a/tools/perf/Documentation/perf-examples.txt +++ b/tools/perf/Documentation/examples.txt | |||
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c index 96d421f7161d..4ac618b34254 100644 --- a/tools/perf/builtin-annotate.c +++ b/tools/perf/builtin-annotate.c | |||
@@ -28,6 +28,7 @@ static char const *input_name = "perf.data"; | |||
28 | static char default_sort_order[] = "comm,symbol"; | 28 | static char default_sort_order[] = "comm,symbol"; |
29 | static char *sort_order = default_sort_order; | 29 | static char *sort_order = default_sort_order; |
30 | 30 | ||
31 | static int force; | ||
31 | static int input; | 32 | static int input; |
32 | static int show_mask = SHOW_KERNEL | SHOW_USER | SHOW_HV; | 33 | static int show_mask = SHOW_KERNEL | SHOW_USER | SHOW_HV; |
33 | 34 | ||
@@ -629,6 +630,13 @@ process_fork_event(event_t *event, unsigned long offset, unsigned long head) | |||
629 | (void *)(long)(event->header.size), | 630 | (void *)(long)(event->header.size), |
630 | event->fork.pid, event->fork.ppid); | 631 | event->fork.pid, event->fork.ppid); |
631 | 632 | ||
633 | /* | ||
634 | * A thread clone will have the same PID for both | ||
635 | * parent and child. | ||
636 | */ | ||
637 | if (thread == parent) | ||
638 | return 0; | ||
639 | |||
632 | if (!thread || !parent || thread__fork(thread, parent)) { | 640 | if (!thread || !parent || thread__fork(thread, parent)) { |
633 | dump_printf("problem processing PERF_EVENT_FORK, skipping event.\n"); | 641 | dump_printf("problem processing PERF_EVENT_FORK, skipping event.\n"); |
634 | return -1; | 642 | return -1; |
@@ -976,6 +984,11 @@ static int __cmd_annotate(void) | |||
976 | exit(-1); | 984 | exit(-1); |
977 | } | 985 | } |
978 | 986 | ||
987 | if (!force && (input_stat.st_uid != geteuid())) { | ||
988 | fprintf(stderr, "file: %s not owned by current user\n", input_name); | ||
989 | exit(-1); | ||
990 | } | ||
991 | |||
979 | if (!input_stat.st_size) { | 992 | if (!input_stat.st_size) { |
980 | fprintf(stderr, "zero-sized file, nothing to do!\n"); | 993 | fprintf(stderr, "zero-sized file, nothing to do!\n"); |
981 | exit(0); | 994 | exit(0); |
@@ -1081,6 +1094,7 @@ static const struct option options[] = { | |||
1081 | "input file name"), | 1094 | "input file name"), |
1082 | OPT_STRING('s', "symbol", &sym_hist_filter, "symbol", | 1095 | OPT_STRING('s', "symbol", &sym_hist_filter, "symbol", |
1083 | "symbol to annotate"), | 1096 | "symbol to annotate"), |
1097 | OPT_BOOLEAN('f', "force", &force, "don't complain, do it"), | ||
1084 | OPT_BOOLEAN('v', "verbose", &verbose, | 1098 | OPT_BOOLEAN('v', "verbose", &verbose, |
1085 | "be more verbose (show symbol address, etc)"), | 1099 | "be more verbose (show symbol address, etc)"), |
1086 | OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace, | 1100 | OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace, |
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index 3fc0d471b90b..d2e28820ee60 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c | |||
@@ -37,6 +37,7 @@ static char *dso_list_str, *comm_list_str, *sym_list_str, | |||
37 | static struct strlist *dso_list, *comm_list, *sym_list; | 37 | static struct strlist *dso_list, *comm_list, *sym_list; |
38 | static char *field_sep; | 38 | static char *field_sep; |
39 | 39 | ||
40 | static int force; | ||
40 | static int input; | 41 | static int input; |
41 | static int show_mask = SHOW_KERNEL | SHOW_USER | SHOW_HV; | 42 | static int show_mask = SHOW_KERNEL | SHOW_USER | SHOW_HV; |
42 | 43 | ||
@@ -1404,6 +1405,11 @@ static int __cmd_report(void) | |||
1404 | exit(-1); | 1405 | exit(-1); |
1405 | } | 1406 | } |
1406 | 1407 | ||
1408 | if (!force && (input_stat.st_uid != geteuid())) { | ||
1409 | fprintf(stderr, "file: %s not owned by current user\n", input_name); | ||
1410 | exit(-1); | ||
1411 | } | ||
1412 | |||
1407 | if (!input_stat.st_size) { | 1413 | if (!input_stat.st_size) { |
1408 | fprintf(stderr, "zero-sized file, nothing to do!\n"); | 1414 | fprintf(stderr, "zero-sized file, nothing to do!\n"); |
1409 | exit(0); | 1415 | exit(0); |
@@ -1615,6 +1621,7 @@ static const struct option options[] = { | |||
1615 | OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace, | 1621 | OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace, |
1616 | "dump raw trace in ASCII"), | 1622 | "dump raw trace in ASCII"), |
1617 | OPT_STRING('k', "vmlinux", &vmlinux_name, "file", "vmlinux pathname"), | 1623 | OPT_STRING('k', "vmlinux", &vmlinux_name, "file", "vmlinux pathname"), |
1624 | OPT_BOOLEAN('f', "force", &force, "don't complain, do it"), | ||
1618 | OPT_BOOLEAN('m', "modules", &modules, | 1625 | OPT_BOOLEAN('m', "modules", &modules, |
1619 | "load module symbols - WARNING: use only with -k and LIVE kernel"), | 1626 | "load module symbols - WARNING: use only with -k and LIVE kernel"), |
1620 | OPT_BOOLEAN('n', "show-nr-samples", &show_nr_samples, | 1627 | OPT_BOOLEAN('n', "show-nr-samples", &show_nr_samples, |