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>
This commit is contained in:
Ingo Molnar 2009-08-19 14:50:35 +02:00
commit 96d6e48bc6
5 changed files with 38 additions and 2 deletions

View file

@ -1503,10 +1503,21 @@ static void perf_counter_enable_on_exec(struct task_struct *task)
*/ */
static void __perf_counter_read(void *info) static void __perf_counter_read(void *info)
{ {
struct perf_cpu_context *cpuctx = &__get_cpu_var(perf_cpu_context);
struct perf_counter *counter = info; struct perf_counter *counter = info;
struct perf_counter_context *ctx = counter->ctx; struct perf_counter_context *ctx = counter->ctx;
unsigned long flags; unsigned long flags;
/*
* If this is a task context, we need to check whether it is
* the current task context of this cpu. If not it has been
* scheduled out before the smp call arrived. In that case
* counter->count would have been updated to a recent sample
* when the counter was scheduled out.
*/
if (ctx->task && cpuctx->task_ctx != ctx)
return;
local_irq_save(flags); local_irq_save(flags);
if (ctx->is_active) if (ctx->is_active)
update_context_time(ctx); update_context_time(ctx);
@ -1780,7 +1791,7 @@ static int perf_counter_read_group(struct perf_counter *counter,
size += err; size += err;
list_for_each_entry(sub, &leader->sibling_list, list_entry) { list_for_each_entry(sub, &leader->sibling_list, list_entry) {
err = perf_counter_read_entry(counter, read_format, err = perf_counter_read_entry(sub, read_format,
buf + size); buf + size);
if (err < 0) if (err < 0)
return err; return err;
@ -2008,6 +2019,10 @@ int perf_counter_task_disable(void)
return 0; return 0;
} }
#ifndef PERF_COUNTER_INDEX_OFFSET
# define PERF_COUNTER_INDEX_OFFSET 0
#endif
static int perf_counter_index(struct perf_counter *counter) static int perf_counter_index(struct perf_counter *counter)
{ {
if (counter->state != PERF_COUNTER_STATE_ACTIVE) if (counter->state != PERF_COUNTER_STATE_ACTIVE)

View file

@ -35,7 +35,7 @@ man7dir=$(mandir)/man7
# DESTDIR= # DESTDIR=
ASCIIDOC=asciidoc ASCIIDOC=asciidoc
ASCIIDOC_EXTRA = ASCIIDOC_EXTRA = --unsafe
MANPAGE_XSL = manpage-normal.xsl MANPAGE_XSL = manpage-normal.xsl
XMLTO_EXTRA = XMLTO_EXTRA =
INSTALL?=install INSTALL?=install

View file

@ -28,6 +28,7 @@ static char const *input_name = "perf.data";
static char default_sort_order[] = "comm,symbol"; static char default_sort_order[] = "comm,symbol";
static char *sort_order = default_sort_order; static char *sort_order = default_sort_order;
static int force;
static int input; static int input;
static int show_mask = SHOW_KERNEL | SHOW_USER | SHOW_HV; static int show_mask = SHOW_KERNEL | SHOW_USER | SHOW_HV;
@ -629,6 +630,13 @@ process_fork_event(event_t *event, unsigned long offset, unsigned long head)
(void *)(long)(event->header.size), (void *)(long)(event->header.size),
event->fork.pid, event->fork.ppid); event->fork.pid, event->fork.ppid);
/*
* A thread clone will have the same PID for both
* parent and child.
*/
if (thread == parent)
return 0;
if (!thread || !parent || thread__fork(thread, parent)) { if (!thread || !parent || thread__fork(thread, parent)) {
dump_printf("problem processing PERF_EVENT_FORK, skipping event.\n"); dump_printf("problem processing PERF_EVENT_FORK, skipping event.\n");
return -1; return -1;
@ -976,6 +984,11 @@ static int __cmd_annotate(void)
exit(-1); exit(-1);
} }
if (!force && (input_stat.st_uid != geteuid())) {
fprintf(stderr, "file: %s not owned by current user\n", input_name);
exit(-1);
}
if (!input_stat.st_size) { if (!input_stat.st_size) {
fprintf(stderr, "zero-sized file, nothing to do!\n"); fprintf(stderr, "zero-sized file, nothing to do!\n");
exit(0); exit(0);
@ -1081,6 +1094,7 @@ static const struct option options[] = {
"input file name"), "input file name"),
OPT_STRING('s', "symbol", &sym_hist_filter, "symbol", OPT_STRING('s', "symbol", &sym_hist_filter, "symbol",
"symbol to annotate"), "symbol to annotate"),
OPT_BOOLEAN('f', "force", &force, "don't complain, do it"),
OPT_BOOLEAN('v', "verbose", &verbose, OPT_BOOLEAN('v', "verbose", &verbose,
"be more verbose (show symbol address, etc)"), "be more verbose (show symbol address, etc)"),
OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace, OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace,

View file

@ -37,6 +37,7 @@ static char *dso_list_str, *comm_list_str, *sym_list_str,
static struct strlist *dso_list, *comm_list, *sym_list; static struct strlist *dso_list, *comm_list, *sym_list;
static char *field_sep; static char *field_sep;
static int force;
static int input; static int input;
static int show_mask = SHOW_KERNEL | SHOW_USER | SHOW_HV; static int show_mask = SHOW_KERNEL | SHOW_USER | SHOW_HV;
@ -1404,6 +1405,11 @@ static int __cmd_report(void)
exit(-1); exit(-1);
} }
if (!force && (input_stat.st_uid != geteuid())) {
fprintf(stderr, "file: %s not owned by current user\n", input_name);
exit(-1);
}
if (!input_stat.st_size) { if (!input_stat.st_size) {
fprintf(stderr, "zero-sized file, nothing to do!\n"); fprintf(stderr, "zero-sized file, nothing to do!\n");
exit(0); exit(0);
@ -1615,6 +1621,7 @@ static const struct option options[] = {
OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace, OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace,
"dump raw trace in ASCII"), "dump raw trace in ASCII"),
OPT_STRING('k', "vmlinux", &vmlinux_name, "file", "vmlinux pathname"), OPT_STRING('k', "vmlinux", &vmlinux_name, "file", "vmlinux pathname"),
OPT_BOOLEAN('f', "force", &force, "don't complain, do it"),
OPT_BOOLEAN('m', "modules", &modules, OPT_BOOLEAN('m', "modules", &modules,
"load module symbols - WARNING: use only with -k and LIVE kernel"), "load module symbols - WARNING: use only with -k and LIVE kernel"),
OPT_BOOLEAN('n', "show-nr-samples", &show_nr_samples, OPT_BOOLEAN('n', "show-nr-samples", &show_nr_samples,