Skip to content

Commit

Permalink
Merge branch 'perf/core' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/git/acme/linux-2.6 into perf/core
  • Loading branch information
Ingo Molnar committed Feb 12, 2011
2 parents 3e86858 + 0849327 commit 40262a7
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 15 deletions.
10 changes: 8 additions & 2 deletions kernel/watchdog.c
Original file line number Diff line number Diff line change
Expand Up @@ -363,8 +363,14 @@ static int watchdog_nmi_enable(int cpu)
goto out_save;
}

printk(KERN_ERR "NMI watchdog disabled for cpu%i: unable to create perf event: %ld\n",
cpu, PTR_ERR(event));

/* vary the KERN level based on the returned errno */
if (PTR_ERR(event) == -EOPNOTSUPP)
printk(KERN_INFO "NMI watchdog disabled (cpu%i): not supported (no LAPIC?)\n", cpu);
else if (PTR_ERR(event) == -ENOENT)
printk(KERN_WARNING "NMI watchdog disabled (cpu%i): hardware events not enabled\n", cpu);
else
printk(KERN_ERR "NMI watchdog disabled (cpu%i): unable to create perf event: %ld\n", cpu, PTR_ERR(event));
return PTR_ERR(event);

/* success path */
Expand Down
6 changes: 3 additions & 3 deletions tools/perf/builtin-record.c
Original file line number Diff line number Diff line change
Expand Up @@ -680,9 +680,9 @@ static int __cmd_record(int argc, const char **argv)
perf_event__synthesize_guest_os);

if (!system_wide)
perf_event__synthesize_thread(target_tid,
process_synthesized_event,
session);
perf_event__synthesize_thread_map(evsel_list->threads,
process_synthesized_event,
session);
else
perf_event__synthesize_threads(process_synthesized_event,
session);
Expand Down
4 changes: 3 additions & 1 deletion tools/perf/builtin-report.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ static const char default_pretty_printing_style[] = "normal";
static const char *pretty_printing_style = default_pretty_printing_style;

static char callchain_default_opt[] = "fractal,0.5";
static symbol_filter_t annotate_init;

static struct hists *perf_session__hists_findnew(struct perf_session *self,
u64 event_stream, u32 type,
Expand Down Expand Up @@ -167,7 +168,7 @@ static int process_sample_event(union perf_event *event,
struct perf_event_attr *attr;

if (perf_event__preprocess_sample(event, session, &al, sample,
symbol__annotate_init) < 0) {
annotate_init) < 0) {
fprintf(stderr, "problem processing %d event, skipping it.\n",
event->header.type);
return -1;
Expand Down Expand Up @@ -520,6 +521,7 @@ int cmd_report(int argc, const char **argv, const char *prefix __used)
*/
if (use_browser > 0) {
symbol_conf.priv_size = sizeof(struct annotation);
annotate_init = symbol__annotate_init;
/*
* For searching by name on the "Browse map details".
* providing it only in verbose mode not to bloat too
Expand Down
4 changes: 2 additions & 2 deletions tools/perf/builtin-top.c
Original file line number Diff line number Diff line change
Expand Up @@ -876,8 +876,8 @@ static int __cmd_top(void)
return -ENOMEM;

if (top.target_tid != -1)
perf_event__synthesize_thread(top.target_tid, perf_event__process,
session);
perf_event__synthesize_thread_map(top.evlist->threads,
perf_event__process, session);
else
perf_event__synthesize_threads(perf_event__process, session);

Expand Down
19 changes: 14 additions & 5 deletions tools/perf/util/event.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "string.h"
#include "strlist.h"
#include "thread.h"
#include "thread_map.h"

static const char *perf_event__names[] = {
[0] = "TOTAL",
Expand Down Expand Up @@ -265,11 +266,12 @@ static int __event__synthesize_thread(union perf_event *comm_event,
process, session);
}

int perf_event__synthesize_thread(pid_t pid, perf_event__handler_t process,
struct perf_session *session)
int perf_event__synthesize_thread_map(struct thread_map *threads,
perf_event__handler_t process,
struct perf_session *session)
{
union perf_event *comm_event, *mmap_event;
int err = -1;
int err = -1, thread;

comm_event = malloc(sizeof(comm_event->comm) + session->id_hdr_size);
if (comm_event == NULL)
Expand All @@ -279,8 +281,15 @@ int perf_event__synthesize_thread(pid_t pid, perf_event__handler_t process,
if (mmap_event == NULL)
goto out_free_comm;

err = __event__synthesize_thread(comm_event, mmap_event, pid,
process, session);
err = 0;
for (thread = 0; thread < threads->nr; ++thread) {
if (__event__synthesize_thread(comm_event, mmap_event,
threads->map[thread],
process, session)) {
err = -1;
break;
}
}
free(mmap_event);
out_free_comm:
free(comm_event);
Expand Down
6 changes: 4 additions & 2 deletions tools/perf/util/event.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,15 +135,17 @@ union perf_event {
void perf_event__print_totals(void);

struct perf_session;
struct thread_map;

typedef int (*perf_event__handler_synth_t)(union perf_event *event,
struct perf_session *session);
typedef int (*perf_event__handler_t)(union perf_event *event,
struct perf_sample *sample,
struct perf_session *session);

int perf_event__synthesize_thread(pid_t pid, perf_event__handler_t process,
struct perf_session *session);
int perf_event__synthesize_thread_map(struct thread_map *threads,
perf_event__handler_t process,
struct perf_session *session);
int perf_event__synthesize_threads(perf_event__handler_t process,
struct perf_session *session);
int perf_event__synthesize_kernel_mmap(perf_event__handler_t process,
Expand Down

0 comments on commit 40262a7

Please sign in to comment.