Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 311194
b: refs/heads/master
c: cb9dd49
h: refs/heads/master
v: v3
  • Loading branch information
Arnaldo Carvalho de Melo committed Jun 12, 2012
1 parent 2b1e7ec commit 75cfba1
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: fc3e4d077d5c7a7bc1ad5bc143895b4e070e5a8b
refs/heads/master: cb9dd49e11f83d548c822d7022ac180b0518b25c
32 changes: 32 additions & 0 deletions trunk/tools/perf/util/header.c
Original file line number Diff line number Diff line change
Expand Up @@ -2093,6 +2093,35 @@ static int read_attr(int fd, struct perf_header *ph,
return ret <= 0 ? -1 : 0;
}

static int perf_evsel__set_tracepoint_name(struct perf_evsel *evsel)
{
struct event_format *event = trace_find_event(evsel->attr.config);
char bf[128];

if (event == NULL)
return -1;

snprintf(bf, sizeof(bf), "%s:%s", event->system, event->name);
evsel->name = strdup(bf);
if (event->name == NULL)
return -1;

return 0;
}

static int perf_evlist__set_tracepoint_names(struct perf_evlist *evlist)
{
struct perf_evsel *pos;

list_for_each_entry(pos, &evlist->entries, node) {
if (pos->attr.type == PERF_TYPE_TRACEPOINT &&
perf_evsel__set_tracepoint_name(pos))
return -1;
}

return 0;
}

int perf_session__read_header(struct perf_session *session, int fd)
{
struct perf_header *header = &session->header;
Expand Down Expand Up @@ -2174,6 +2203,9 @@ int perf_session__read_header(struct perf_session *session, int fd)

lseek(fd, header->data_offset, SEEK_SET);

if (perf_evlist__set_tracepoint_names(session->evlist))
goto out_delete_evlist;

header->frozen = 1;
return 0;
out_errno:
Expand Down

0 comments on commit 75cfba1

Please sign in to comment.