Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 323903
b: refs/heads/master
c: 82fe1c2
h: refs/heads/master
i:
  323901: 9dac280
  323899: 658bfb2
  323895: ec6c3f9
  323887: 8938869
  323871: b53a797
  323839: 8d2378f
v: v3
  • Loading branch information
Arnaldo Carvalho de Melo committed Sep 26, 2012
1 parent ea9c827 commit 3e3cd6c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 31 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: e48ffe2bd49936314d367a8c6b5eaaa17d581d13
refs/heads/master: 82fe1c290cd26a3d092beb1e9755647d284a4134
46 changes: 16 additions & 30 deletions trunk/tools/perf/util/parse-events.c
Original file line number Diff line number Diff line change
Expand Up @@ -356,42 +356,28 @@ int parse_events_add_cache(struct list_head **list, int *idx,
return add_event(list, idx, &attr, name);
}

static int add_tracepoint(struct list_head **list, int *idx,
static int add_tracepoint(struct list_head **listp, int *idx,
char *sys_name, char *evt_name)
{
struct perf_event_attr attr;
char name[MAX_NAME_LEN];
char evt_path[MAXPATHLEN];
char id_buf[4];
u64 id;
int fd;

snprintf(evt_path, MAXPATHLEN, "%s/%s/%s/id", tracing_events_path,
sys_name, evt_name);

fd = open(evt_path, O_RDONLY);
if (fd < 0)
return -1;
struct perf_evsel *evsel;
struct list_head *list = *listp;

if (read(fd, id_buf, sizeof(id_buf)) < 0) {
close(fd);
return -1;
if (!list) {
list = malloc(sizeof(*list));
if (!list)
return -ENOMEM;
INIT_LIST_HEAD(list);
}

close(fd);
id = atoll(id_buf);

memset(&attr, 0, sizeof(attr));
attr.config = id;
attr.type = PERF_TYPE_TRACEPOINT;
attr.sample_type |= PERF_SAMPLE_RAW;
attr.sample_type |= PERF_SAMPLE_TIME;
attr.sample_type |= PERF_SAMPLE_CPU;
attr.sample_type |= PERF_SAMPLE_PERIOD;
attr.sample_period = 1;
evsel = perf_evsel__newtp(sys_name, evt_name, (*idx)++);
if (!evsel) {
free(list);
return -ENOMEM;
}

snprintf(name, MAX_NAME_LEN, "%s:%s", sys_name, evt_name);
return add_event(list, idx, &attr, name);
list_add_tail(&evsel->node, list);
*listp = list;
return 0;
}

static int add_tracepoint_multi(struct list_head **list, int *idx,
Expand Down

0 comments on commit 3e3cd6c

Please sign in to comment.