perf trace: Remember if the vfs_getname tracepoint/kprobe is in place

So that we can later decide if we will store where to expand the
pathname once we are handling vfs_getname or if we should instead
just go on and straight away print the pointer.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Milian Wolff <mail@milianw.de>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-ytxk5s5jpc50wahffmlxgxuw@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 2e5e5f87
...@@ -1312,6 +1312,7 @@ struct trace { ...@@ -1312,6 +1312,7 @@ struct trace {
bool show_tool_stats; bool show_tool_stats;
bool trace_syscalls; bool trace_syscalls;
bool force; bool force;
bool vfs_getname;
int trace_pgfaults; int trace_pgfaults;
}; };
...@@ -2188,19 +2189,20 @@ static int trace__record(struct trace *trace, int argc, const char **argv) ...@@ -2188,19 +2189,20 @@ static int trace__record(struct trace *trace, int argc, const char **argv)
static size_t trace__fprintf_thread_summary(struct trace *trace, FILE *fp); static size_t trace__fprintf_thread_summary(struct trace *trace, FILE *fp);
static void perf_evlist__add_vfs_getname(struct perf_evlist *evlist) static bool perf_evlist__add_vfs_getname(struct perf_evlist *evlist)
{ {
struct perf_evsel *evsel = perf_evsel__newtp("probe", "vfs_getname"); struct perf_evsel *evsel = perf_evsel__newtp("probe", "vfs_getname");
if (evsel == NULL) if (evsel == NULL)
return; return false;
if (perf_evsel__field(evsel, "pathname") == NULL) { if (perf_evsel__field(evsel, "pathname") == NULL) {
perf_evsel__delete(evsel); perf_evsel__delete(evsel);
return; return false;
} }
evsel->handler = trace__vfs_getname; evsel->handler = trace__vfs_getname;
perf_evlist__add(evlist, evsel); perf_evlist__add(evlist, evsel);
return true;
} }
static int perf_evlist__add_pgfault(struct perf_evlist *evlist, static int perf_evlist__add_pgfault(struct perf_evlist *evlist,
...@@ -2330,7 +2332,7 @@ static int trace__run(struct trace *trace, int argc, const char **argv) ...@@ -2330,7 +2332,7 @@ static int trace__run(struct trace *trace, int argc, const char **argv)
goto out_error_raw_syscalls; goto out_error_raw_syscalls;
if (trace->trace_syscalls) if (trace->trace_syscalls)
perf_evlist__add_vfs_getname(evlist); trace->vfs_getname = perf_evlist__add_vfs_getname(evlist);
if ((trace->trace_pgfaults & TRACE_PFMAJ) && if ((trace->trace_pgfaults & TRACE_PFMAJ) &&
perf_evlist__add_pgfault(evlist, PERF_COUNT_SW_PAGE_FAULTS_MAJ)) { perf_evlist__add_pgfault(evlist, PERF_COUNT_SW_PAGE_FAULTS_MAJ)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment