From: Namhyung Kim <namhyung@kernel.org>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: "Ingo Molnar" <mingo@kernel.org>,
"Clark Williams" <williams@redhat.com>,
linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
"Arnaldo Carvalho de Melo" <acme@redhat.com>,
"Adrian Hunter" <adrian.hunter@intel.com>,
"Jiri Olsa" <jolsa@kernel.org>,
"Luis Cláudio Gonçalves" <lclaudio@redhat.com>,
"Wang Nan" <wangnan0@huawei.com>,
kernel-team@lge.com
Subject: Re: [PATCH 35/63] perf trace: Allow specifying a set of events to add in perfconfig
Date: Wed, 19 Dec 2018 17:40:24 +0900 [thread overview]
Message-ID: <20181219084024.GA18068@danjae.aot.lge.com> (raw)
In-Reply-To: <20181218220733.15839-36-acme@kernel.org>
Hi Arnaldo,
On Tue, Dec 18, 2018 at 07:07:05PM -0300, Arnaldo Carvalho de Melo wrote:
> From: Arnaldo Carvalho de Melo <acme@redhat.com>
>
> To add augmented_raw_syscalls to the events speficied by the user, or be
> the only one if no events were specified by the user, one can add this
> to perfconfig:
>
> # cat ~/.perfconfig
> [trace]
> add_events = /home/acme/git/perf/tools/perf/examples/bpf/augmented_raw_syscalls.o
> #
>
> I.e. pre-compile the augmented_raw_syscalls.c BPF program and make it
> always load, this way:
>
> # perf trace -e open* cat /etc/passwd > /dev/null
> 0.000 ( 0.013 ms): cat/31557 openat(dfd: CWD, filename: /etc/ld.so.cache, flags: CLOEXEC) = 3
> 0.035 ( 0.007 ms): cat/31557 openat(dfd: CWD, filename: /lib64/libc.so.6, flags: CLOEXEC) = 3
> 0.353 ( 0.009 ms): cat/31557 openat(dfd: CWD, filename: /usr/lib/locale/locale-archive, flags: CLOEXEC) = 3
> 0.424 ( 0.006 ms): cat/31557 openat(dfd: CWD, filename: /etc/passwd) = 3
> #
>
> Cc: Adrian Hunter <adrian.hunter@intel.com>
> Cc: Jiri Olsa <jolsa@kernel.org>
> Cc: Luis Cláudio Gonçalves <lclaudio@redhat.com>
> Cc: Namhyung Kim <namhyung@kernel.org>
> Cc: Wang Nan <wangnan0@huawei.com>
> Link: https://lkml.kernel.org/n/tip-0lgj7vh64hg3ce44gsmvj7ud@git.kernel.org
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> ---
> tools/perf/Documentation/perf-config.txt | 8 ++++++++
> tools/perf/builtin-trace.c | 20 ++++++++++++++++++++
> 2 files changed, 28 insertions(+)
>
> diff --git a/tools/perf/Documentation/perf-config.txt b/tools/perf/Documentation/perf-config.txt
> index 661b1fb3f8ba..423cb41f6e3f 100644
> --- a/tools/perf/Documentation/perf-config.txt
> +++ b/tools/perf/Documentation/perf-config.txt
> @@ -521,6 +521,14 @@ diff.*::
> Possible values are 'delta', 'delta-abs', 'ratio' and
> 'wdiff'. Default is 'delta'.
>
> +trace.*::
> + trace.add_events::
> + Allows adding a set of events to add to the ones specified
> + by the user, or use as a default one if none was specified.
> + The initial use case is to add augmented_raw_syscalls.o to
> + activate the 'perf trace' logic that looks for syscall
> + pointer contents after the normal tracepoint payload.
> +
> SEE ALSO
> --------
> linkperf:perf[1]
> diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
> index 096380e8c213..d754a74aef46 100644
> --- a/tools/perf/builtin-trace.c
> +++ b/tools/perf/builtin-trace.c
> @@ -22,6 +22,7 @@
> #include "builtin.h"
> #include "util/cgroup.h"
> #include "util/color.h"
> +#include "util/config.h"
> #include "util/debug.h"
> #include "util/env.h"
> #include "util/event.h"
> @@ -3523,6 +3524,21 @@ static void trace__set_bpf_map_syscalls(struct trace *trace)
> trace->syscalls.map = bpf__find_map_by_name("syscalls");
> }
>
> +static int trace__config(const char *var, const char *value, void *arg)
> +{
> + int err = 0;
> +
> + if (!strcmp(var, "trace.add_events")) {
> + struct trace *trace = arg;
> + struct option o = OPT_CALLBACK('e', "event", &trace->evlist, "event",
> + "event selector. use 'perf list' to list available events",
> + parse_events_option);
> + err = parse_events_option(&o, value, 0);
It's a bit strange to use parse_events_option() here IMHO. Why not
using parse_events() instead?
Thanks,
Namhyung
> + }
> +
> + return err;
> +}
> +
> int cmd_trace(int argc, const char **argv)
> {
> const char *trace_usage[] = {
> @@ -3645,6 +3661,10 @@ int cmd_trace(int argc, const char **argv)
> goto out;
> }
>
> + err = perf_config(trace__config, &trace);
> + if (err)
> + goto out;
> +
> argc = parse_options_subcommand(argc, argv, trace_options, trace_subcommands,
> trace_usage, PARSE_OPT_STOP_AT_NON_OPTION);
>
> --
> 2.19.2
>
next prev parent reply other threads:[~2018-12-19 8:40 UTC|newest]
Thread overview: 69+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-18 22:06 [GIT PULL 00/63] perf/core improvements and fixes Arnaldo Carvalho de Melo
2018-12-18 22:06 ` [PATCH 01/63] perf dso: Export data_file_size() method there are no symbols Arnaldo Carvalho de Melo
2018-12-18 22:06 ` [PATCH 02/63] perf auxtrace: Alter addr_filter__entire_dso() to work if " Arnaldo Carvalho de Melo
2018-12-18 22:06 ` [PATCH 03/63] perf tests: Use shebangs in the shell scripts Arnaldo Carvalho de Melo
2018-12-18 22:06 ` [PATCH 04/63] perf stat: Avoid segfaults caused by negated options Arnaldo Carvalho de Melo
2018-12-18 22:06 ` [PATCH 05/63] tools lib traceevent: Fix processing of dereferenced args in bprintk events Arnaldo Carvalho de Melo
2018-12-18 22:06 ` [PATCH 06/63] perf trace: Rename delivery functions to ease making ordered_events selectable Arnaldo Carvalho de Melo
2018-12-18 22:06 ` [PATCH 07/63] perf trace: Allow selecting use the use of the ordered_events code Arnaldo Carvalho de Melo
2018-12-18 22:06 ` [PATCH 08/63] perf trace beauty: Beautify renameat2's fd arg wrt AT_FDCWD Arnaldo Carvalho de Melo
2018-12-18 22:06 ` [PATCH 09/63] perf beauty: Add a string table generator for renameat2's flags constants Arnaldo Carvalho de Melo
2018-12-18 22:06 ` [PATCH 10/63] perf beauty: Wire up the renameat flags table generator to the Makefile Arnaldo Carvalho de Melo
2018-12-18 22:06 ` [PATCH 11/63] perf trace: Beautify renameat2's flags argument Arnaldo Carvalho de Melo
2018-12-18 22:06 ` [PATCH 12/63] perf trace beauty: renameat's newdirfd may also be AT_FDCWD Arnaldo Carvalho de Melo
2018-12-18 22:06 ` [PATCH 13/63] tools lib subcmd: Don't add the kernel sources to the include path Arnaldo Carvalho de Melo
2018-12-18 22:06 ` [PATCH 14/63] perf tools: Add missing sigqueue() prototype for systems lacking it Arnaldo Carvalho de Melo
2018-12-18 22:06 ` [PATCH 15/63] perf header: Fix up argument to ctime() Arnaldo Carvalho de Melo
2018-12-18 22:06 ` [PATCH 16/63] perf tools: Add missing open_memstream() prototype for systems lacking it Arnaldo Carvalho de Melo
2018-12-18 22:06 ` [PATCH 17/63] perf tools: Cast off_t to s64 to avoid warning on bionic libc Arnaldo Carvalho de Melo
2018-12-18 22:06 ` [PATCH 18/63] tools lib traceevent: Use LDFLAGS in the build commands Arnaldo Carvalho de Melo
2018-12-18 22:06 ` [PATCH 19/63] perf tools: Link libperf-jvmti.so with LDFLAGS variable Arnaldo Carvalho de Melo
2018-12-18 22:06 ` [PATCH 20/63] perf trace: Rename set_ev_qualifier_filter to clarify its a tracepoint filter Arnaldo Carvalho de Melo
2018-12-18 22:06 ` [PATCH 21/63] perf trace: Avoid using raw_syscalls in duplicity with eBPF augmentation Arnaldo Carvalho de Melo
2018-12-18 22:06 ` [PATCH 22/63] perf trace: Implement syscall filtering in augmented_syscalls Arnaldo Carvalho de Melo
2018-12-18 22:06 ` [PATCH 23/63] perf bpf: Move perf_event_output() from stdio.h to bpf.h Arnaldo Carvalho de Melo
2018-12-18 22:06 ` [PATCH 24/63] perf augmented_syscalls: Switch to using a struct for the syscalls map values Arnaldo Carvalho de Melo
2018-12-18 22:06 ` [PATCH 25/63] perf trace: Switch to using a struct for the aumented_raw_syscalls " Arnaldo Carvalho de Melo
2018-12-18 22:06 ` [PATCH 26/63] perf cs-etm: Correct packets swapping in cs_etm__flush() Arnaldo Carvalho de Melo
2018-12-18 22:06 ` [PATCH 27/63] perf cs-etm: Avoid stale branch samples when flush packet Arnaldo Carvalho de Melo
2018-12-18 22:06 ` [PATCH 28/63] perf cs-etm: Remove unused 'trace_on' in cs_etm_decoder Arnaldo Carvalho de Melo
2018-12-18 22:06 ` [PATCH 29/63] perf cs-etm: Refactor enumeration cs_etm_sample_type Arnaldo Carvalho de Melo
2018-12-18 22:07 ` [PATCH 30/63] perf cs-etm: Rename CS_ETM_TRACE_ON to CS_ETM_DISCONTINUITY Arnaldo Carvalho de Melo
2018-12-18 22:07 ` [PATCH 31/63] perf cs-etm: Treat NO_SYNC element as trace discontinuity Arnaldo Carvalho de Melo
2018-12-18 22:07 ` [PATCH 32/63] perf cs-etm: Treat EO_TRACE " Arnaldo Carvalho de Melo
2018-12-18 22:07 ` [PATCH 33/63] perf cs-etm: Generate branch sample for exception packet Arnaldo Carvalho de Melo
2018-12-18 22:07 ` [PATCH 34/63] perf augmented_raw_syscalls: Do not include stdio.h Arnaldo Carvalho de Melo
2018-12-18 22:07 ` [PATCH 35/63] perf trace: Allow specifying a set of events to add in perfconfig Arnaldo Carvalho de Melo
2018-12-19 8:40 ` Namhyung Kim [this message]
2018-12-19 12:50 ` Arnaldo Carvalho de Melo
2018-12-18 22:07 ` [PATCH 36/63] perf trace: Allow configuring if zeroed syscall args should be printed Arnaldo Carvalho de Melo
2018-12-18 22:07 ` [PATCH 37/63] perf trace: Allow configuring if the syscall duration " Arnaldo Carvalho de Melo
2018-12-18 22:07 ` [PATCH 38/63] perf config: Show the configuration when no arguments are provided Arnaldo Carvalho de Melo
2018-12-18 22:07 ` [PATCH 39/63] perf trace: Allow configuring default for perf_event_attr.inherit Arnaldo Carvalho de Melo
2018-12-18 22:07 ` [PATCH 40/63] perf trace: Allow configuring if the syscall start timestamp should be printed Arnaldo Carvalho de Melo
2018-12-18 22:07 ` [PATCH 41/63] perf trace: Allow suppressing the syscall argument names Arnaldo Carvalho de Melo
2018-12-18 22:07 ` [PATCH 42/63] perf trace: Make the alignment of the syscall args be configurable Arnaldo Carvalho de Melo
2018-12-18 22:07 ` [PATCH 43/63] perf trace: Enclose strings with double quotes Arnaldo Carvalho de Melo
2018-12-18 22:07 ` [PATCH 44/63] perf trace: Add a prefix member to the strarray class Arnaldo Carvalho de Melo
2018-12-18 22:07 ` [PATCH 45/63] perf trace: Allow asking for not suppressing common string prefixes Arnaldo Carvalho de Melo
2018-12-18 22:07 ` [PATCH 46/63] perf trace beauty: Print O_RDONLY when (flags & O_ACCMODE) == 0 Arnaldo Carvalho de Melo
2018-12-18 22:07 ` [PATCH 47/63] perf trace: Add alignment spaces after the closing parens Arnaldo Carvalho de Melo
2018-12-18 22:07 ` [PATCH 48/63] perf augmented_raw_syscalls: Copy 'access' arg as well Arnaldo Carvalho de Melo
2018-12-18 22:07 ` [PATCH 49/63] perf trace: Enclose the errno strings with () Arnaldo Carvalho de Melo
2018-12-18 22:07 ` [PATCH 50/63] perf trace: Show NULL when syscall pointer args are 0 Arnaldo Carvalho de Melo
2018-12-18 22:07 ` [PATCH 51/63] tools include arch: Grab a copy of x86's prctl.h Arnaldo Carvalho de Melo
2018-12-18 22:07 ` [PATCH 52/63] perf beauty: Add a string table generator for x86's 'arch_prctl' codes Arnaldo Carvalho de Melo
2018-12-18 22:07 ` [PATCH 53/63] perf beauty: Wire up the x86_arch prctl code table generator Arnaldo Carvalho de Melo
2018-12-18 22:07 ` [PATCH 54/63] perf trace: Move strarrays to beauty.h for further reuse Arnaldo Carvalho de Melo
2018-12-18 22:07 ` [PATCH 55/63] perf trace: When showing string prefixes show prefix + ??? for unknown entries Arnaldo Carvalho de Melo
2018-12-18 22:07 ` [PATCH 56/63] perf trace beauty: Beautify arch_prctl()'s arguments Arnaldo Carvalho de Melo
2018-12-18 22:07 ` [PATCH 57/63] perf beauty mmap: Print PROT_READ before PROT_EXEC to match strace output Arnaldo Carvalho de Melo
2018-12-19 9:15 ` Namhyung Kim
2018-12-19 13:10 ` Arnaldo Carvalho de Melo
2018-12-18 22:07 ` [PATCH 58/63] perf beauty mmap: Print mmap's 'offset' arg in hexadecimal Arnaldo Carvalho de Melo
2018-12-18 22:07 ` [PATCH 59/63] tools headers uapi: Grab a copy of fadvise.h Arnaldo Carvalho de Melo
2018-12-18 22:07 ` [PATCH 60/63] perf beauty: Add generator for fadvise64's 'advice' arg constants Arnaldo Carvalho de Melo
2018-12-18 22:07 ` [PATCH 61/63] perf trace: Wire up the fadvise 'advice' table generator Arnaldo Carvalho de Melo
2018-12-18 22:07 ` [PATCH 62/63] perf symbols: Relax checks on perf-PID.map ownership Arnaldo Carvalho de Melo
2018-12-18 22:07 ` [PATCH 63/63] tools uapi asm: Update asm-generic/unistd.h copy Arnaldo Carvalho de Melo
2018-12-20 17:53 ` [GIT PULL 00/63] perf/core improvements and fixes Ingo Molnar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181219084024.GA18068@danjae.aot.lge.com \
--to=namhyung@kernel.org \
--cc=acme@kernel.org \
--cc=acme@redhat.com \
--cc=adrian.hunter@intel.com \
--cc=jolsa@kernel.org \
--cc=kernel-team@lge.com \
--cc=lclaudio@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=wangnan0@huawei.com \
--cc=williams@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).