All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Jiri Olsa <jolsa@kernel.org>
Cc: lkml <linux-kernel@vger.kernel.org>,
	David Ahern <dsahern@gmail.com>, Ingo Molnar <mingo@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Stephane Eranian <eranian@google.com>,
	Andi Kleen <ak@linux.intel.com>
Subject: Re: [PATCH 01/23] perf record: Add --all-user/--all-kernel options
Date: Tue, 16 Feb 2016 13:56:01 -0300	[thread overview]
Message-ID: <20160216165601.GF17690@kernel.org> (raw)
In-Reply-To: <1455525293-8671-2-git-send-email-jolsa@kernel.org>

Em Mon, Feb 15, 2016 at 09:34:31AM +0100, Jiri Olsa escreveu:
> Allow user to easily switch all events to user or
> kernel space with simple --all-user or --all-kernel
> options.
> 
> This will be handy within perf mem/c2c wrappers to
> switch easily monitoring modes.

Humm, some oddities:

  # perf record --all-user -e cycles -a
  # perf report --tui       # And then notice there are some kernel samples, zoom into kernel DSO
  Samples: 7  of event 'cycles', Event count (approx.): 3158810, DSO: [kernel.vmlinux]
  Overhead  Comman  Symbol
    84.05%  chrome  [k] page_fault
    15.73%  chrome  [k] entry_SYSCALL_64
     0.22%  chrome  [k] apic_timer_interrupt

Ditto when using --all-kernel, some userspace samples are there, also perhaps we
should show "cycles:u" or "cycles:k" when this --all-user or --all-kernel features
are used.

Need to investigate why there are kernel samples when --all-user is used and
the other way around as well.

Also if I use both it quietly accepts and shows just one of them, I guess we
should bail out in case someone tries both.

- Arnaldo 

> Link: http://lkml.kernel.org/n/tip-hdd2u0y1o8cwfpplrpzc1iqd@git.kernel.org
> Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> ---
>  tools/perf/Documentation/perf-record.txt |  6 ++++++
>  tools/perf/builtin-record.c              |  4 ++++
>  tools/perf/perf.h                        |  2 ++
>  tools/perf/util/evsel.c                  | 10 ++++++++++
>  4 files changed, 22 insertions(+)
> 
> diff --git a/tools/perf/Documentation/perf-record.txt b/tools/perf/Documentation/perf-record.txt
> index fbceb631387c..19aa17532a16 100644
> --- a/tools/perf/Documentation/perf-record.txt
> +++ b/tools/perf/Documentation/perf-record.txt
> @@ -341,6 +341,12 @@ Specify vmlinux path which has debuginfo.
>  --buildid-all::
>  Record build-id of all DSOs regardless whether it's actually hit or not.
>  
> +--all-kernel::
> +Configure all used events to run in kernel space.
> +
> +--all-user::
> +Configure all used events to run in user space.
> +
>  SEE ALSO
>  --------
>  linkperf:perf-stat[1], linkperf:perf-list[1]
> diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
> index caa8235ed027..b64f31a4c993 100644
> --- a/tools/perf/builtin-record.c
> +++ b/tools/perf/builtin-record.c
> @@ -1151,6 +1151,10 @@ struct option __record_options[] = {
>  			"per thread proc mmap processing timeout in ms"),
>  	OPT_BOOLEAN(0, "switch-events", &record.opts.record_switch_events,
>  		    "Record context switch events"),
> +	OPT_BOOLEAN(0, "all-kernel", &record.opts.all_kernel,
> +		    "Configure all used events to run in kernel space."),
> +	OPT_BOOLEAN(0, "all-user", &record.opts.all_user,
> +		    "Configure all used events to run in user space."),
>  	OPT_STRING(0, "clang-path", &llvm_param.clang_path, "clang path",
>  		   "clang binary to use for compiling BPF scriptlets"),
>  	OPT_STRING(0, "clang-opt", &llvm_param.clang_opt, "clang options",
> diff --git a/tools/perf/perf.h b/tools/perf/perf.h
> index 90129accffbe..5381a01c0610 100644
> --- a/tools/perf/perf.h
> +++ b/tools/perf/perf.h
> @@ -58,6 +58,8 @@ struct record_opts {
>  	bool	     full_auxtrace;
>  	bool	     auxtrace_snapshot_mode;
>  	bool	     record_switch_events;
> +	bool	     all_kernel;
> +	bool	     all_user;
>  	unsigned int freq;
>  	unsigned int mmap_pages;
>  	unsigned int auxtrace_mmap_pages;
> diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
> index 467808680ee4..6ae20d0056de 100644
> --- a/tools/perf/util/evsel.c
> +++ b/tools/perf/util/evsel.c
> @@ -898,6 +898,16 @@ void perf_evsel__config(struct perf_evsel *evsel, struct record_opts *opts)
>  	if (evsel->precise_max)
>  		perf_event_attr__set_max_precise_ip(attr);
>  
> +	if (opts->all_user) {
> +		attr->exclude_kernel = 1;
> +		attr->exclude_user   = 0;
> +	}
> +
> +	if (opts->all_kernel) {
> +		attr->exclude_kernel = 0;
> +		attr->exclude_user   = 1;
> +	}
> +
>  	/*
>  	 * Apply event specific term settings,
>  	 * it overloads any global configuration.
> -- 
> 2.4.3

  reply	other threads:[~2016-02-16 16:56 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-15  8:34 [PATCH 00/23] perf tools: Several memory events updates Jiri Olsa
2016-02-15  8:34 ` [PATCH 01/23] perf record: Add --all-user/--all-kernel options Jiri Olsa
2016-02-16 16:56   ` Arnaldo Carvalho de Melo [this message]
2016-02-17  3:10     ` Andi Kleen
2016-02-17 14:26       ` Arnaldo Carvalho de Melo
2016-02-17 15:31         ` Andi Kleen
2016-02-17 14:39     ` Jiri Olsa
2016-02-17 14:55       ` Arnaldo Carvalho de Melo
2016-02-20 11:34   ` [tip:perf/core] " tip-bot for Jiri Olsa
2016-02-15  8:34 ` [PATCH 02/23] perf tools: Make cl_address global Jiri Olsa
2016-02-25  5:42   ` [tip:perf/core] " tip-bot for Jiri Olsa
2016-02-15  8:34 ` [PATCH 03/23] perf tools: Introduce cl_offset function Jiri Olsa
2016-02-25  5:42   ` [tip:perf/core] " tip-bot for Jiri Olsa
2016-02-15  8:34 ` [PATCH 04/23] perf tools: Add monitored events array Jiri Olsa
2016-02-23 15:10   ` Arnaldo Carvalho de Melo
2016-02-23 15:18     ` Jiri Olsa
2016-02-25  5:42   ` [tip:perf/core] " tip-bot for Jiri Olsa
2016-02-15  8:34 ` [PATCH 05/23] perf mem: Add -e record option Jiri Olsa
2016-02-25  5:43   ` [tip:perf/core] " tip-bot for Jiri Olsa
2016-02-15  8:34 ` [PATCH 06/23] perf mem: Check for memory events support Jiri Olsa
2016-02-23 15:18   ` Arnaldo Carvalho de Melo
2016-02-23 15:24     ` Arnaldo Carvalho de Melo
2016-02-23 15:42       ` Jiri Olsa
2016-02-23 15:29     ` Jiri Olsa
2016-02-23 15:34       ` Arnaldo Carvalho de Melo
2016-02-15  8:34 ` [PATCH 07/23] perf mem: Introduce perf_mem_events__name function Jiri Olsa
2016-02-15  8:34 ` [PATCH 08/23] perf mem: Add -l/--ldlat option Jiri Olsa
2016-02-15  8:34 ` [PATCH 09/23] perf mem: Add -u/-k options Jiri Olsa
2016-02-15  8:34 ` [PATCH 10/23] perf x86 intel: Add DATALA events into sysfs Jiri Olsa
2016-02-15  8:34 ` [PATCH 11/23] perf mem: Add Intel DATALA memory events Jiri Olsa
2016-02-15  8:34 ` [PATCH 12/23] perf tools: Use ARRAY_SIZE in mem sort display functions Jiri Olsa
2016-02-25  5:43   ` [tip:perf/core] " tip-bot for Jiri Olsa
2016-02-15  8:34 ` [PATCH 13/23] perf tools: Introduce perf_mem__tlb_scnprintf function Jiri Olsa
2016-02-15  8:34 ` [PATCH 14/23] perf tools: Introduce perf_mem__lvl_scnprintf function Jiri Olsa
2016-02-15  8:34 ` [PATCH 15/23] perf tools: Introduce perf_mem__snp_scnprintf function Jiri Olsa
2016-02-15  8:34 ` [PATCH 16/23] perf tools: Introduce perf_mem__lck_scnprintf function Jiri Olsa
2016-02-15  8:34 ` [PATCH 17/23] perf tools: Change perf_mem__tlb_scnprintf to return nb of displayed bytes Jiri Olsa
2016-02-15  8:34 ` [PATCH 18/23] perf tools: Change perf_mem__lvl_scnprintf " Jiri Olsa
2016-02-15  8:34 ` [PATCH 19/23] perf tools: Change perf_mem__snp_scnprintf " Jiri Olsa
2016-02-15  8:34 ` [PATCH 20/23] perf tools: Change perf_mem__lck_scnprintf " Jiri Olsa
2016-02-15  8:34 ` [PATCH 21/23] perf script: Add data_src and weight column definitions Jiri Olsa
2016-02-25  5:43   ` [tip:perf/core] " tip-bot for Jiri Olsa
2016-02-15  8:34 ` [PATCH 22/23] perf script: Display addr/data_src/weight columns for raw events Jiri Olsa
2016-02-25  5:43   ` [tip:perf/core] " tip-bot for Jiri Olsa
2016-02-15  8:34 ` [PATCH 23/23] perf script: Display data_src values Jiri Olsa

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=20160216165601.GF17690@kernel.org \
    --to=acme@kernel.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=ak@linux.intel.com \
    --cc=dsahern@gmail.com \
    --cc=eranian@google.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.