提交 63a22cd9 编写于 作者: A Adrian Hunter 提交者: Arnaldo Carvalho de Melo

perf intel-pt: Tidy messages into called function intel_pt_synth_event()

Tidy print messages into called function intel_pt_synth_event().
Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Link: http://lkml.kernel.org/r/1495786658-18063-31-git-send-email-adrian.hunter@intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
上级 85a564d2
...@@ -1910,16 +1910,25 @@ static int intel_pt_event_synth(struct perf_tool *tool, ...@@ -1910,16 +1910,25 @@ static int intel_pt_event_synth(struct perf_tool *tool,
NULL); NULL);
} }
static int intel_pt_synth_event(struct perf_session *session, static int intel_pt_synth_event(struct perf_session *session, const char *name,
struct perf_event_attr *attr, u64 id) struct perf_event_attr *attr, u64 id)
{ {
struct intel_pt_synth intel_pt_synth; struct intel_pt_synth intel_pt_synth;
int err;
pr_debug("Synthesizing '%s' event with id %" PRIu64 " sample type %#" PRIx64 "\n",
name, id, (u64)attr->sample_type);
memset(&intel_pt_synth, 0, sizeof(struct intel_pt_synth)); memset(&intel_pt_synth, 0, sizeof(struct intel_pt_synth));
intel_pt_synth.session = session; intel_pt_synth.session = session;
return perf_event__synthesize_attr(&intel_pt_synth.dummy_tool, attr, 1, err = perf_event__synthesize_attr(&intel_pt_synth.dummy_tool, attr, 1,
&id, intel_pt_event_synth); &id, intel_pt_event_synth);
if (err)
pr_err("%s: failed to synthesize '%s' event type\n",
__func__, name);
return err;
} }
static struct perf_evsel *intel_pt_evsel(struct intel_pt *pt, static struct perf_evsel *intel_pt_evsel(struct intel_pt *pt,
...@@ -1984,14 +1993,9 @@ static int intel_pt_synth_events(struct intel_pt *pt, ...@@ -1984,14 +1993,9 @@ static int intel_pt_synth_events(struct intel_pt *pt,
attr.sample_type |= PERF_SAMPLE_CALLCHAIN; attr.sample_type |= PERF_SAMPLE_CALLCHAIN;
if (pt->synth_opts.last_branch) if (pt->synth_opts.last_branch)
attr.sample_type |= PERF_SAMPLE_BRANCH_STACK; attr.sample_type |= PERF_SAMPLE_BRANCH_STACK;
pr_debug("Synthesizing 'instructions' event with id %" PRIu64 " sample type %#" PRIx64 "\n", err = intel_pt_synth_event(session, "instructions", &attr, id);
id, (u64)attr.sample_type); if (err)
err = intel_pt_synth_event(session, &attr, id);
if (err) {
pr_err("%s: failed to synthesize 'instructions' event type\n",
__func__);
return err; return err;
}
pt->sample_instructions = true; pt->sample_instructions = true;
pt->instructions_sample_type = attr.sample_type; pt->instructions_sample_type = attr.sample_type;
pt->instructions_id = id; pt->instructions_id = id;
...@@ -2005,14 +2009,9 @@ static int intel_pt_synth_events(struct intel_pt *pt, ...@@ -2005,14 +2009,9 @@ static int intel_pt_synth_events(struct intel_pt *pt,
attr.sample_type |= PERF_SAMPLE_CALLCHAIN; attr.sample_type |= PERF_SAMPLE_CALLCHAIN;
if (pt->synth_opts.last_branch) if (pt->synth_opts.last_branch)
attr.sample_type |= PERF_SAMPLE_BRANCH_STACK; attr.sample_type |= PERF_SAMPLE_BRANCH_STACK;
pr_debug("Synthesizing 'transactions' event with id %" PRIu64 " sample type %#" PRIx64 "\n", err = intel_pt_synth_event(session, "transactions", &attr, id);
id, (u64)attr.sample_type); if (err)
err = intel_pt_synth_event(session, &attr, id);
if (err) {
pr_err("%s: failed to synthesize 'transactions' event type\n",
__func__);
return err; return err;
}
pt->sample_transactions = true; pt->sample_transactions = true;
pt->transactions_sample_type = attr.sample_type; pt->transactions_sample_type = attr.sample_type;
pt->transactions_id = id; pt->transactions_id = id;
...@@ -2033,14 +2032,9 @@ static int intel_pt_synth_events(struct intel_pt *pt, ...@@ -2033,14 +2032,9 @@ static int intel_pt_synth_events(struct intel_pt *pt,
attr.sample_type |= PERF_SAMPLE_ADDR; attr.sample_type |= PERF_SAMPLE_ADDR;
attr.sample_type &= ~(u64)PERF_SAMPLE_CALLCHAIN; attr.sample_type &= ~(u64)PERF_SAMPLE_CALLCHAIN;
attr.sample_type &= ~(u64)PERF_SAMPLE_BRANCH_STACK; attr.sample_type &= ~(u64)PERF_SAMPLE_BRANCH_STACK;
pr_debug("Synthesizing 'branches' event with id %" PRIu64 " sample type %#" PRIx64 "\n", err = intel_pt_synth_event(session, "branches", &attr, id);
id, (u64)attr.sample_type); if (err)
err = intel_pt_synth_event(session, &attr, id);
if (err) {
pr_err("%s: failed to synthesize 'branches' event type\n",
__func__);
return err; return err;
}
pt->sample_branches = true; pt->sample_branches = true;
pt->branches_sample_type = attr.sample_type; pt->branches_sample_type = attr.sample_type;
pt->branches_id = id; pt->branches_id = id;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册