From 3d032a251605740b75decd3381dc9d496a245ca0 Mon Sep 17 00:00:00 2001 From: Adrian Hunter <adrian.hunter@intel.com> Date: Sun, 27 Jun 2021 16:18:12 +0300 Subject: perf script: Add option to pass arguments to dlfilters Add option --dlarg to pass arguments to dlfilters. The --dlarg option can be repeated to pass more than 1 argument. Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Kan Liang <kan.liang@linux.intel.com> Cc: Leo Yan <leo.yan@linaro.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Link: https://lore.kernel.org/r/20210627131818.810-5-adrian.hunter@intel.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> --- tools/perf/Documentation/perf-dlfilter.txt | 10 +++++++--- tools/perf/Documentation/perf-script.txt | 4 ++++ 2 files changed, 11 insertions(+), 3 deletions(-) (limited to 'tools/perf/Documentation') diff --git a/tools/perf/Documentation/perf-dlfilter.txt b/tools/perf/Documentation/perf-dlfilter.txt index 8bc219f3eb83..5795ab3ca23b 100644 --- a/tools/perf/Documentation/perf-dlfilter.txt +++ b/tools/perf/Documentation/perf-dlfilter.txt @@ -9,13 +9,14 @@ object file SYNOPSIS -------- [verse] -'perf script' [--dlfilter file.so ] +'perf script' [--dlfilter file.so ] [ --dlarg arg ]... DESCRIPTION ----------- This option is used to process data through a custom filter provided by a -dynamically loaded shared object file. +dynamically loaded shared object file. Arguments can be passed using --dlarg +and retrieved using perf_dlfilter_fns.args(). If 'file.so' does not contain "/", then it will be found either in the current directory, or perf tools exec path which is ~/libexec/perf-core/dlfilters for @@ -121,7 +122,8 @@ file is loaded. The functions can be called by 'filter_event' or struct perf_dlfilter_fns { const struct perf_dlfilter_al *(*resolve_ip)(void *ctx); const struct perf_dlfilter_al *(*resolve_addr)(void *ctx); - void *(*reserved[126])(void *); + char **(*args)(void *ctx, int *dlargc); + void *(*reserved[125])(void *); }; ---- @@ -129,6 +131,8 @@ struct perf_dlfilter_fns { 'resolve_addr' returns information about addr (if addr_correlates_sym). +'args' returns arguments from --dlarg options. + The perf_dlfilter_al structure ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/tools/perf/Documentation/perf-script.txt b/tools/perf/Documentation/perf-script.txt index d2705d6b9874..aa3a0b2c29a2 100644 --- a/tools/perf/Documentation/perf-script.txt +++ b/tools/perf/Documentation/perf-script.txt @@ -102,6 +102,10 @@ OPTIONS Filter sample events using the given shared object file. Refer linkperf:perf-dlfilter[1] +--dlarg=<arg>:: + Pass 'arg' as an argument to the dlfilter. --dlarg may be repeated + to add more arguments. + --list-dlfilters=:: Display a list of available dlfilters. Use with option -v (must come before option --list-dlfilters) to show long descriptions. -- cgit