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

perf auxtrace: Add support for dumping AUX area samples

Add support for dumping AUX area samples i.e. via the perf script/report
 -D (--dump-raw-trace) option.

Committer notes:

Add __maybe_unused to the two args for auxtrace__dump_auxtrace_sample()
for when we don't HAVE_AUXTRACE_SUPPORT.
Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: http://lore.kernel.org/lkml/20191115124225.5247-10-adrian.hunter@intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
上级 ba2675bf
...@@ -2417,6 +2417,16 @@ int auxtrace__process_event(struct perf_session *session, union perf_event *even ...@@ -2417,6 +2417,16 @@ int auxtrace__process_event(struct perf_session *session, union perf_event *even
return session->auxtrace->process_event(session, event, sample, tool); return session->auxtrace->process_event(session, event, sample, tool);
} }
void auxtrace__dump_auxtrace_sample(struct perf_session *session,
struct perf_sample *sample)
{
if (!session->auxtrace || !session->auxtrace->dump_auxtrace_sample ||
auxtrace__dont_decode(session))
return;
session->auxtrace->dump_auxtrace_sample(session, sample);
}
int auxtrace__flush_events(struct perf_session *session, struct perf_tool *tool) int auxtrace__flush_events(struct perf_session *session, struct perf_tool *tool)
{ {
if (!session->auxtrace) if (!session->auxtrace)
......
...@@ -141,6 +141,7 @@ struct auxtrace_index { ...@@ -141,6 +141,7 @@ struct auxtrace_index {
* struct auxtrace - session callbacks to allow AUX area data decoding. * struct auxtrace - session callbacks to allow AUX area data decoding.
* @process_event: lets the decoder see all session events * @process_event: lets the decoder see all session events
* @process_auxtrace_event: process a PERF_RECORD_AUXTRACE event * @process_auxtrace_event: process a PERF_RECORD_AUXTRACE event
* @dump_auxtrace_sample: dump AUX area sample data
* @flush_events: process any remaining data * @flush_events: process any remaining data
* @free_events: free resources associated with event processing * @free_events: free resources associated with event processing
* @free: free resources associated with the session * @free: free resources associated with the session
...@@ -153,6 +154,8 @@ struct auxtrace { ...@@ -153,6 +154,8 @@ struct auxtrace {
int (*process_auxtrace_event)(struct perf_session *session, int (*process_auxtrace_event)(struct perf_session *session,
union perf_event *event, union perf_event *event,
struct perf_tool *tool); struct perf_tool *tool);
void (*dump_auxtrace_sample)(struct perf_session *session,
struct perf_sample *sample);
int (*flush_events)(struct perf_session *session, int (*flush_events)(struct perf_session *session,
struct perf_tool *tool); struct perf_tool *tool);
void (*free_events)(struct perf_session *session); void (*free_events)(struct perf_session *session);
...@@ -555,6 +558,8 @@ int auxtrace_parse_filters(struct evlist *evlist); ...@@ -555,6 +558,8 @@ int auxtrace_parse_filters(struct evlist *evlist);
int auxtrace__process_event(struct perf_session *session, union perf_event *event, int auxtrace__process_event(struct perf_session *session, union perf_event *event,
struct perf_sample *sample, struct perf_tool *tool); struct perf_sample *sample, struct perf_tool *tool);
void auxtrace__dump_auxtrace_sample(struct perf_session *session,
struct perf_sample *sample);
int auxtrace__flush_events(struct perf_session *session, struct perf_tool *tool); int auxtrace__flush_events(struct perf_session *session, struct perf_tool *tool);
void auxtrace__free_events(struct perf_session *session); void auxtrace__free_events(struct perf_session *session);
void auxtrace__free(struct perf_session *session); void auxtrace__free(struct perf_session *session);
...@@ -674,6 +679,12 @@ int auxtrace__process_event(struct perf_session *session __maybe_unused, ...@@ -674,6 +679,12 @@ int auxtrace__process_event(struct perf_session *session __maybe_unused,
return 0; return 0;
} }
static inline
void auxtrace__dump_auxtrace_sample(struct perf_session *session __maybe_unused,
struct perf_sample *sample __maybe_unused)
{
}
static inline static inline
int auxtrace__flush_events(struct perf_session *session __maybe_unused, int auxtrace__flush_events(struct perf_session *session __maybe_unused,
struct perf_tool *tool __maybe_unused) struct perf_tool *tool __maybe_unused)
......
...@@ -1496,8 +1496,13 @@ static int perf_session__deliver_event(struct perf_session *session, ...@@ -1496,8 +1496,13 @@ static int perf_session__deliver_event(struct perf_session *session,
if (ret > 0) if (ret > 0)
return 0; return 0;
return machines__deliver_event(&session->machines, session->evlist, ret = machines__deliver_event(&session->machines, session->evlist,
event, &sample, tool, file_offset); event, &sample, tool, file_offset);
if (dump_trace && sample.aux_sample.size)
auxtrace__dump_auxtrace_sample(session, &sample);
return ret;
} }
static s64 perf_session__process_user_event(struct perf_session *session, static s64 perf_session__process_user_event(struct perf_session *session,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册