Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 323749
b: refs/heads/master
c: 1e6d532
h: refs/heads/master
i:
  323747: 759bc93
v: v3
  • Loading branch information
David Ahern authored and Arnaldo Carvalho de Melo committed Sep 5, 2012
1 parent 355c71a commit d602415
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 10 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: d25380cd3be38baff4ab31935b9d19b7f58ba7ac
refs/heads/master: 1e6d53223884225f0c3f9f1a3ac54a224d97ab24
35 changes: 26 additions & 9 deletions trunk/tools/perf/util/event.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,9 @@ static pid_t perf_event__synthesize_comm(struct perf_tool *tool,
if (!full) {
event->comm.tid = pid;

process(tool, event, &synth_sample, machine);
if (process(tool, event, &synth_sample, machine) != 0)
return -1;

goto out;
}

Expand Down Expand Up @@ -151,7 +153,10 @@ static pid_t perf_event__synthesize_comm(struct perf_tool *tool,

event->comm.tid = pid;

process(tool, event, &synth_sample, machine);
if (process(tool, event, &synth_sample, machine) != 0) {
tgid = -1;
break;
}
}

closedir(tasks);
Expand All @@ -167,6 +172,7 @@ static int perf_event__synthesize_mmap_events(struct perf_tool *tool,
{
char filename[PATH_MAX];
FILE *fp;
int rc = 0;

snprintf(filename, sizeof(filename), "/proc/%d/maps", pid);

Expand Down Expand Up @@ -231,18 +237,22 @@ static int perf_event__synthesize_mmap_events(struct perf_tool *tool,
event->mmap.pid = tgid;
event->mmap.tid = pid;

process(tool, event, &synth_sample, machine);
if (process(tool, event, &synth_sample, machine) != 0) {
rc = -1;
break;
}
}
}

fclose(fp);
return 0;
return rc;
}

int perf_event__synthesize_modules(struct perf_tool *tool,
perf_event__handler_t process,
struct machine *machine)
{
int rc = 0;
struct rb_node *nd;
struct map_groups *kmaps = &machine->kmaps;
union perf_event *event = zalloc((sizeof(event->mmap) +
Expand Down Expand Up @@ -284,11 +294,14 @@ int perf_event__synthesize_modules(struct perf_tool *tool,

memcpy(event->mmap.filename, pos->dso->long_name,
pos->dso->long_name_len + 1);
process(tool, event, &synth_sample, machine);
if (process(tool, event, &synth_sample, machine) != 0) {
rc = -1;
break;
}
}

free(event);
return 0;
return rc;
}

static int __event__synthesize_thread(union perf_event *comm_event,
Expand Down Expand Up @@ -392,12 +405,16 @@ int perf_event__synthesize_threads(struct perf_tool *tool,
if (*end) /* only interested in proper numerical dirents */
continue;

__event__synthesize_thread(comm_event, mmap_event, pid, 1,
process, tool, machine);
if (__event__synthesize_thread(comm_event, mmap_event, pid, 1,
process, tool, machine) != 0) {
err = -1;
goto out_closedir;
}
}

closedir(proc);
err = 0;
out_closedir:
closedir(proc);
out_free_mmap:
free(mmap_event);
out_free_comm:
Expand Down

0 comments on commit d602415

Please sign in to comment.