perf machine: Add machine__thread_exec_comm()
Add machine__thread_exec_comm() to return the comm that matches the last exec, if the comm_exec flag is present, or the last comm otherwise. Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Namhyung Kim <namhyung@gmail.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/r/1406786474-9306-3-git-send-email-adrian.hunter@intel.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:

committed by
Arnaldo Carvalho de Melo

parent
65de51f93e
commit
cfe1c41405
@@ -67,6 +67,25 @@ static void perf_session__destroy_kernel_maps(struct perf_session *session)
|
||||
machines__destroy_kernel_maps(&session->machines);
|
||||
}
|
||||
|
||||
static bool perf_session__has_comm_exec(struct perf_session *session)
|
||||
{
|
||||
struct perf_evsel *evsel;
|
||||
|
||||
evlist__for_each(session->evlist, evsel) {
|
||||
if (evsel->attr.comm_exec)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static void perf_session__set_comm_exec(struct perf_session *session)
|
||||
{
|
||||
bool comm_exec = perf_session__has_comm_exec(session);
|
||||
|
||||
machines__set_comm_exec(&session->machines, comm_exec);
|
||||
}
|
||||
|
||||
struct perf_session *perf_session__new(struct perf_data_file *file,
|
||||
bool repipe, struct perf_tool *tool)
|
||||
{
|
||||
@@ -90,6 +109,7 @@ struct perf_session *perf_session__new(struct perf_data_file *file,
|
||||
goto out_close;
|
||||
|
||||
perf_session__set_id_hdr_size(session);
|
||||
perf_session__set_comm_exec(session);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -866,8 +886,10 @@ static s64 perf_session__process_user_event(struct perf_session *session,
|
||||
switch (event->header.type) {
|
||||
case PERF_RECORD_HEADER_ATTR:
|
||||
err = tool->attr(tool, event, &session->evlist);
|
||||
if (err == 0)
|
||||
if (err == 0) {
|
||||
perf_session__set_id_hdr_size(session);
|
||||
perf_session__set_comm_exec(session);
|
||||
}
|
||||
return err;
|
||||
case PERF_RECORD_HEADER_EVENT_TYPE:
|
||||
/*
|
||||
|
Reference in New Issue
Block a user