Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 248591
b: refs/heads/master
c: 5538bec
h: refs/heads/master
i:
  248589: b73a9ba
  248587: 21346cf
  248583: b884e84
  248575: 691766d
v: v3
  • Loading branch information
Frederic Weisbecker committed May 22, 2011
1 parent 09bc9ca commit c390b4e
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 12 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: 98e1da905cbe64bb023a165c7c01eef5e800609e
refs/heads/master: 5538becaec9ca2ff21e7826372941dc46f498487
9 changes: 7 additions & 2 deletions trunk/tools/perf/builtin-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -559,8 +559,13 @@ static int test__basic_mmap(void)
goto out_munmap;
}

perf_event__parse_sample(event, attr.sample_type, sample_size,
false, &sample);
err = perf_event__parse_sample(event, attr.sample_type, sample_size,
false, &sample);
if (err) {
pr_err("Can't parse sample, err = %d\n", err);
goto out_munmap;
}

evsel = perf_evlist__id2evsel(evlist, sample.id);
if (evsel == NULL) {
pr_debug("event with id %" PRIu64
Expand Down
7 changes: 6 additions & 1 deletion trunk/tools/perf/builtin-top.c
Original file line number Diff line number Diff line change
Expand Up @@ -805,9 +805,14 @@ static void perf_session__mmap_read_cpu(struct perf_session *self, int cpu)
{
struct perf_sample sample;
union perf_event *event;
int ret;

while ((event = perf_evlist__read_on_cpu(top.evlist, cpu)) != NULL) {
perf_session__parse_sample(self, event, &sample);
ret = perf_session__parse_sample(self, event, &sample);
if (ret) {
pr_err("Can't parse sample, err = %d\n", ret);
continue;
}

if (event->header.type == PERF_RECORD_SAMPLE)
perf_event__process_sample(event, &sample, self);
Expand Down
14 changes: 10 additions & 4 deletions trunk/tools/perf/util/python.c
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,7 @@ static PyObject *pyrf_evlist__read_on_cpu(struct pyrf_evlist *pevlist,
union perf_event *event;
int sample_id_all = 1, cpu;
static char *kwlist[] = {"sample_id_all", NULL, NULL};
int err;

if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i|i", kwlist,
&cpu, &sample_id_all))
Expand All @@ -690,12 +691,17 @@ static PyObject *pyrf_evlist__read_on_cpu(struct pyrf_evlist *pevlist,
return PyErr_NoMemory();

first = list_entry(evlist->entries.next, struct perf_evsel, node);
perf_event__parse_sample(event, first->attr.sample_type,
perf_sample_size(first->attr.sample_type),
sample_id_all, &pevent->sample);
err = perf_event__parse_sample(event, first->attr.sample_type,
perf_sample_size(first->attr.sample_type),
sample_id_all, &pevent->sample);
if (err) {
pr_err("Can't parse sample, err = %d\n", err);
goto end;
}

return pyevent;
}

end:
Py_INCREF(Py_None);
return Py_None;
}
Expand Down
14 changes: 10 additions & 4 deletions trunk/tools/perf/util/session.c
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,7 @@ static void flush_sample_queue(struct perf_session *s,
struct perf_sample sample;
u64 limit = os->next_flush;
u64 last_ts = os->last_sample ? os->last_sample->timestamp : 0ULL;
int ret;

if (!ops->ordered_samples || !limit)
return;
Expand All @@ -488,9 +489,12 @@ static void flush_sample_queue(struct perf_session *s,
if (iter->timestamp > limit)
break;

perf_session__parse_sample(s, iter->event, &sample);
perf_session_deliver_event(s, iter->event, &sample, ops,
iter->file_offset);
ret = perf_session__parse_sample(s, iter->event, &sample);
if (ret)
pr_err("Can't parse sample, err = %d\n", ret);
else
perf_session_deliver_event(s, iter->event, &sample, ops,
iter->file_offset);

os->last_flush = iter->timestamp;
list_del(&iter->list);
Expand Down Expand Up @@ -806,7 +810,9 @@ static int perf_session__process_event(struct perf_session *session,
/*
* For all kernel events we get the sample data
*/
perf_session__parse_sample(session, event, &sample);
ret = perf_session__parse_sample(session, event, &sample);
if (ret)
return ret;

/* Preprocess sample records - precheck callchains */
if (perf_session__preprocess_sample(session, event, &sample))
Expand Down

0 comments on commit c390b4e

Please sign in to comment.