Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 234413
b: refs/heads/master
c: 7c940c1
h: refs/heads/master
i:
  234411: 1200df4
v: v3
  • Loading branch information
Arnaldo Carvalho de Melo committed Feb 11, 2011
1 parent 58d4b7b commit 06c1fdc
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 15 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3e86858133c632060b290985837a11dbe2e0cc0e
refs/heads/master: 7c940c18c57e45910f7dd9a4011c4658cacba4b6
10 changes: 8 additions & 2 deletions trunk/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 trunk/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: 2 additions & 2 deletions trunk/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 trunk/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 trunk/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 06c1fdc

Please sign in to comment.