|
@@ -156,14 +156,14 @@ static int process_read_event(event_t *event, struct perf_session *session __use
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
-static int sample_type_check(struct perf_session *session)
|
|
|
|
|
|
+static int perf_session__setup_sample_type(struct perf_session *self)
|
|
{
|
|
{
|
|
- if (!(session->sample_type & PERF_SAMPLE_CALLCHAIN)) {
|
|
|
|
|
|
+ if (!(self->sample_type & PERF_SAMPLE_CALLCHAIN)) {
|
|
if (sort__has_parent) {
|
|
if (sort__has_parent) {
|
|
fprintf(stderr, "selected --sort parent, but no"
|
|
fprintf(stderr, "selected --sort parent, but no"
|
|
" callchain data. Did you call"
|
|
" callchain data. Did you call"
|
|
" perf record without -g?\n");
|
|
" perf record without -g?\n");
|
|
- return -1;
|
|
|
|
|
|
+ return -EINVAL;
|
|
}
|
|
}
|
|
if (symbol_conf.use_callchain) {
|
|
if (symbol_conf.use_callchain) {
|
|
fprintf(stderr, "selected -g but no callchain data."
|
|
fprintf(stderr, "selected -g but no callchain data."
|
|
@@ -176,7 +176,7 @@ static int sample_type_check(struct perf_session *session)
|
|
if (register_callchain_param(&callchain_param) < 0) {
|
|
if (register_callchain_param(&callchain_param) < 0) {
|
|
fprintf(stderr, "Can't register callchain"
|
|
fprintf(stderr, "Can't register callchain"
|
|
" params\n");
|
|
" params\n");
|
|
- return -1;
|
|
|
|
|
|
+ return -EINVAL;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -191,13 +191,11 @@ static struct perf_event_ops event_ops = {
|
|
.process_fork_event = event__process_task,
|
|
.process_fork_event = event__process_task,
|
|
.process_lost_event = event__process_lost,
|
|
.process_lost_event = event__process_lost,
|
|
.process_read_event = process_read_event,
|
|
.process_read_event = process_read_event,
|
|
- .sample_type_check = sample_type_check,
|
|
|
|
};
|
|
};
|
|
|
|
|
|
-
|
|
|
|
static int __cmd_report(void)
|
|
static int __cmd_report(void)
|
|
{
|
|
{
|
|
- int ret;
|
|
|
|
|
|
+ int ret = -EINVAL;
|
|
struct perf_session *session;
|
|
struct perf_session *session;
|
|
|
|
|
|
session = perf_session__new(input_name, O_RDONLY, force);
|
|
session = perf_session__new(input_name, O_RDONLY, force);
|
|
@@ -207,6 +205,10 @@ static int __cmd_report(void)
|
|
if (show_threads)
|
|
if (show_threads)
|
|
perf_read_values_init(&show_threads_values);
|
|
perf_read_values_init(&show_threads_values);
|
|
|
|
|
|
|
|
+ ret = perf_session__setup_sample_type(session);
|
|
|
|
+ if (ret)
|
|
|
|
+ goto out_delete;
|
|
|
|
+
|
|
ret = perf_session__process_events(session, &event_ops);
|
|
ret = perf_session__process_events(session, &event_ops);
|
|
if (ret)
|
|
if (ret)
|
|
goto out_delete;
|
|
goto out_delete;
|