[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160324155758.GA32162@kernel.org>
Date: Thu, 24 Mar 2016 12:57:58 -0300
From: Arnaldo Carvalho de Melo <acme@...nel.org>
To: Jiri Olsa <jolsa@...nel.org>
Cc: lkml <linux-kernel@...r.kernel.org>,
David Ahern <dsahern@...il.com>,
Ingo Molnar <mingo@...nel.org>,
Namhyung Kim <namhyung@...nel.org>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Stephane Eranian <eranian@...gle.com>,
Andi Kleen <ak@...ux.intel.com>
Subject: Re: [PATCH 1/6] perf mem: Add --ldlat option
Em Thu, Mar 24, 2016 at 01:52:15PM +0100, Jiri Olsa escreveu:
> Adding --ldlat option to specify desired latency
> for loads event.
>
> Specify 50 as loads event latency:
>
> $ perf mem record -e ldlat-loads -v --ldlat 50 true
> calling: record -W -d -e cpu/mem-loads,ldlat=50/P true
We have all this infrastructure to set per-event settings, on the
command line, and here we end up adding a separate command line option
to do that? Why not something like:
perf mem record -e ldlat-loads/lat=50/ true
?
- Arnaldo
> Link: http://lkml.kernel.org/n/tip-ec2m0cvivkfs8uhtiv411hfc@git.kernel.org
> Signed-off-by: Jiri Olsa <jolsa@...nel.org>
> ---
> tools/perf/Documentation/perf-mem.txt | 3 +++
> tools/perf/builtin-mem.c | 1 +
> tools/perf/util/mem-events.c | 17 ++++++++++++++++-
> tools/perf/util/mem-events.h | 1 +
> 4 files changed, 21 insertions(+), 1 deletion(-)
>
> diff --git a/tools/perf/Documentation/perf-mem.txt b/tools/perf/Documentation/perf-mem.txt
> index 43310d8661fe..6676d2784733 100644
> --- a/tools/perf/Documentation/perf-mem.txt
> +++ b/tools/perf/Documentation/perf-mem.txt
> @@ -48,6 +48,9 @@ OPTIONS
> option can be passed in record mode. It will be interpreted the same way as perf
> record.
>
> +--ldload::
> + Specify desired latency for loads event.
> +
> SEE ALSO
> --------
> linkperf:perf-record[1], linkperf:perf-report[1]
> diff --git a/tools/perf/builtin-mem.c b/tools/perf/builtin-mem.c
> index 914f6fe192e3..bf0bfca5be20 100644
> --- a/tools/perf/builtin-mem.c
> +++ b/tools/perf/builtin-mem.c
> @@ -66,6 +66,7 @@ static int __cmd_record(int argc, const char **argv, struct perf_mem *mem)
> OPT_CALLBACK('e', "event", &mem, "event",
> "event selector. use 'perf mem record -e list' to list available events",
> parse_record_events),
> + OPT_UINTEGER(0, "ldlat", &perf_mem_events__loads_ldlat, "mem-loads latency"),
> OPT_INCR('v', "verbose", &verbose,
> "be more verbose (show counter open errors, etc)"),
> OPT_END()
> diff --git a/tools/perf/util/mem-events.c b/tools/perf/util/mem-events.c
> index e6b01e6f70a0..3ff60f08a778 100644
> --- a/tools/perf/util/mem-events.c
> +++ b/tools/perf/util/mem-events.c
> @@ -10,10 +10,12 @@
> #include "debug.h"
> #include "symbol.h"
>
> +unsigned int perf_mem_events__loads_ldlat = 30;
> +
> #define E(t, n, s) { .tag = t, .name = n, .sysfs_name = s }
>
> struct perf_mem_event perf_mem_events[PERF_MEM_EVENTS__MAX] = {
> - E("ldlat-loads", "cpu/mem-loads,ldlat=30/P", "mem-loads"),
> + E("ldlat-loads", "cpu/mem-loads,ldlat=%u/P", "mem-loads"),
> E("ldlat-stores", "cpu/mem-stores/P", "mem-stores"),
> E("stlb-miss-loads", "cpu/mem-stlb-miss-loads/P", "mem-stlb-miss-loads"),
> E("stlb-miss-stores", "cpu/mem-stlb-miss-stores/P", "mem-stlb-miss-stores"),
> @@ -39,8 +41,21 @@ struct perf_mem_event perf_mem_events[PERF_MEM_EVENTS__MAX] = {
>
> #undef E
>
> +static char mem_loads_name[100];
> +static bool mem_loads_name__init;
> +
> char *perf_mem_events__name(int i)
> {
> + if (i == PERF_MEM_EVENTS__LOAD) {
> + if (!mem_loads_name__init) {
> + mem_loads_name__init = true;
> + scnprintf(mem_loads_name, sizeof(mem_loads_name),
> + perf_mem_events[i].name,
> + perf_mem_events__loads_ldlat);
> + }
> + return mem_loads_name;
> + }
> +
> return (char *)perf_mem_events[i].name;
> }
>
> diff --git a/tools/perf/util/mem-events.h b/tools/perf/util/mem-events.h
> index de88f4267cd1..939786ffab2a 100644
> --- a/tools/perf/util/mem-events.h
> +++ b/tools/perf/util/mem-events.h
> @@ -37,6 +37,7 @@ enum {
> };
>
> extern struct perf_mem_event perf_mem_events[PERF_MEM_EVENTS__MAX];
> +extern unsigned int perf_mem_events__loads_ldlat;
>
> int perf_mem_events__parse(const char *str);
> int perf_mem_events__init(void);
> --
> 2.4.3
Powered by blists - more mailing lists