lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150423221542.GI7881@kernel.org>
Date:	Thu, 23 Apr 2015 19:15:42 -0300
From:	Arnaldo Carvalho de Melo <acme@...nel.org>
To:	Namhyung Kim <namhyung@...nel.org>
Cc:	Jiri Olsa <jolsa@...nel.org>, lkml <linux-kernel@...r.kernel.org>,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	Paul Mackerras <paulus@...ba.org>,
	David Ahern <dsahern@...il.com>,
	Ingo Molnar <mingo@...nel.org>,
	Andi Kleen <andi@...stfloor.org>,
	William Cohen <wcohen@...hat.com>
Subject: Re: [PATCH 2/6] perf stat: Fix metrics calculation with event
 qualifiers

Em Wed, Apr 08, 2015 at 10:28:33PM +0900, Namhyung Kim escreveu:
> Hi Jiri and Andi,
> On Tue, Apr 07, 2015 at 11:25:15PM +0200, Jiri Olsa wrote:
> > From: Andi Kleen <ak@...ux.intel.com>
> > % perf stat -e cycles:k,cycles:u,instructions:k,instructions:u true
> > 
> >  Performance counter stats for 'true':
> > 
> >            531,718      cycles:k
> >            203,895      cycles:u
> >            338,151      instructions:k            #    0.64  insns per cycle
> >            105,961      instructions:u            #    0.52  insns per cycle
> > 
> >        0.002989739 seconds time elapsed
> > 
> > Previously it would misreport the ratios because they were matching
> > the wrong value.
> 
> This patch reminds me of following change:


Yeah, useful, but do we have one for the kernel, hypervisor, guest, etc?
Could we instead have a --cpumode u?k?g?H? combo, so that we could filter by
that?

Applying this series, with your Ack, thanks!

- Arnaldo
 
> >From a8ae843bf7cff7b68dc39b6f088c43669d140d00 Mon Sep 17 00:00:00 2001
> From: Namhyung Kim <namhyung@...nel.org>
> Date: Wed, 8 Apr 2015 21:56:12 +0900
> Subject: [RFC] perf stat: Add -U/--user option
> 
> The -U/--user option is to control event modifier for all events easily.
> It has same effect as if adding 'u' modifier to every events.
> 
> An example follows:
> 
>   $ perf stat -U true
> 
>    Performance counter stats for 'true':
> 
>             0.722461      task-clock:uH (msec)      #    0.520 CPUs utilized
>                    0      context-switches:uH       #    0.000 K/sec
>                    0      cpu-migrations:uH         #    0.000 K/sec
>                   41      page-faults:uH            #    0.057 M/sec
>              145,341      cycles:uH                 #    0.201 GHz
>              517,317      stalled-cycles-frontend:uH #  355.93% frontend cycles idle
>              497,570      stalled-cycles-backend:uH #  342.35% backend  cycles idle
>               98,846      instructions:uH           #    0.68  insns per cycle
>                                                     #    5.23  stalled cycles per insn
>               19,552      branches:uH               #   27.063 M/sec
>        <not counted>      branch-misses:uH
> 
>          0.001389613 seconds time elapsed
> 
> Cc: Andi Kleen <ak@...ux.intel.com>
> Signed-off-by: Namhyung Kim <namhyung@...nel.org>
> ---
>  tools/perf/Documentation/perf-stat.txt |  5 ++++-
>  tools/perf/builtin-stat.c              | 11 +++++++++++
>  2 files changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/perf/Documentation/perf-stat.txt b/tools/perf/Documentation/perf-stat.txt
> index 04e150d83e7d..54b0734028a6 100644
> --- a/tools/perf/Documentation/perf-stat.txt
> +++ b/tools/perf/Documentation/perf-stat.txt
> @@ -151,9 +151,12 @@ filter out the startup phase of the program, which is often very different.
>  
>  -T::
>  --transaction::
> -
>  Print statistics of transactional execution if supported.
>  
> +-U::
> +--user::
> +Collect events only in user mode execution
> +
>  EXAMPLES
>  --------
>  
> diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
> index fec089f1c364..d191af942cb4 100644
> --- a/tools/perf/builtin-stat.c
> +++ b/tools/perf/builtin-stat.c
> @@ -141,6 +141,7 @@ static unsigned int		interval			= 0;
>  static unsigned int		initial_delay			= 0;
>  static unsigned int		unit_width			= 4; /* strlen("unit") */
>  static bool			forever				= false;
> +static bool			mod_user			= false;
>  static struct timespec		ref_time;
>  static struct cpu_map		*aggr_map;
>  static int			(*aggr_get_id)(struct cpu_map *m, int cpu);
> @@ -1809,6 +1810,7 @@ int cmd_stat(int argc, const char **argv, const char *prefix __maybe_unused)
>  		     "aggregate counts per physical processor core", AGGR_CORE),
>  	OPT_UINTEGER('D', "delay", &initial_delay,
>  		     "ms to wait before starting measurement after program start"),
> +	OPT_BOOLEAN('U', "user", &mod_user, "Count event only in user mode"),
>  	OPT_END()
>  	};
>  	const char * const stat_usage[] = {
> @@ -1913,6 +1915,15 @@ int cmd_stat(int argc, const char **argv, const char *prefix __maybe_unused)
>  	if (add_default_attributes())
>  		goto out;
>  
> +	if (mod_user) {
> +		struct perf_evsel *evsel;
> +
> +		evlist__for_each(evsel_list, evsel) {
> +			evsel->attr.exclude_kernel = 1;
> +			evsel->attr.exclude_hv = 1;
> +		}
> +	}
> +
>  	target__validate(&target);
>  
>  	if (perf_evlist__create_maps(evsel_list, &target) < 0) {
> -- 
> 2.3.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ