Re: [GIT PULL] Re: [PATCH 04/27] perf list: Add support for listing only json events

2016-10-17 Thread Ingo Molnar

* Arnaldo Carvalho de Melo  wrote:

> Em Mon, Oct 17, 2016 at 06:57:56AM -0700, Andi Kleen escreveu:
> > > What we do know about the CPU vendor event names is that they are vendor 
> > > specific, 
> > > and that's a pretty stable property. So my suggestion would be to simply 
> > > make it:
> > > 
> > >   perf list vendor
> > > 
> > > with perhaps add aliases as well:
> > > 
> > >   perf list model
> > >   perf list cpu-model
> > > 
> > > ... and 'perf list hardware' should probably also list all the vendor 
> > > specific 
> > > hardware events as well.
> > 
> > Sure can change it.
> > 
> > > 
> > > Could we please work a bit more on making vendor specific hardware event 
> > > handling 
> > > more usable to people who don't care about internals?
> > 
> > Do you prefer fully new patches, or are incremential patches ok? 
> 
> I would like for you to base of my perf/urgent branch as of now, that
> has those two patches yanked out so that the others can go thru.
> 
> Ingo, please consider pulling from the perf-urgent-for-mingo-20161017
> tag, just signed and pushed, it has:
> 
> tag perf-urgent-for-mingo-20161017
> Tagger: Arnaldo Carvalho de Melo 
> Date:   Mon Oct 17 11:26:10 2016 -0300
> 
> perf/urgent fixes:
> 
> - Fix handling of numa nodes in perf.data files (Jiri Olsa)
> 
> - Fix scrolling when refreshing 'perf top --tui --hierarchy' entries
>   (Namhyung Kim)
> 
> - Fix building of JIT support on Ubuntu 16.04 (Anton Blanchard)
> 
> - Fix handling of events including .c and .o, that were being treated as
>   BPF scripts instead of vendor ones (Wang Nan)
> 
> Signed-off-by: Arnaldo Carvalho de Melo 

Pulled, thanks a lot Arnaldo!

Ingo


Re: [GIT PULL] Re: [PATCH 04/27] perf list: Add support for listing only json events

2016-10-17 Thread Ingo Molnar

* Arnaldo Carvalho de Melo  wrote:

> Em Mon, Oct 17, 2016 at 06:57:56AM -0700, Andi Kleen escreveu:
> > > What we do know about the CPU vendor event names is that they are vendor 
> > > specific, 
> > > and that's a pretty stable property. So my suggestion would be to simply 
> > > make it:
> > > 
> > >   perf list vendor
> > > 
> > > with perhaps add aliases as well:
> > > 
> > >   perf list model
> > >   perf list cpu-model
> > > 
> > > ... and 'perf list hardware' should probably also list all the vendor 
> > > specific 
> > > hardware events as well.
> > 
> > Sure can change it.
> > 
> > > 
> > > Could we please work a bit more on making vendor specific hardware event 
> > > handling 
> > > more usable to people who don't care about internals?
> > 
> > Do you prefer fully new patches, or are incremential patches ok? 
> 
> I would like for you to base of my perf/urgent branch as of now, that
> has those two patches yanked out so that the others can go thru.
> 
> Ingo, please consider pulling from the perf-urgent-for-mingo-20161017
> tag, just signed and pushed, it has:
> 
> tag perf-urgent-for-mingo-20161017
> Tagger: Arnaldo Carvalho de Melo 
> Date:   Mon Oct 17 11:26:10 2016 -0300
> 
> perf/urgent fixes:
> 
> - Fix handling of numa nodes in perf.data files (Jiri Olsa)
> 
> - Fix scrolling when refreshing 'perf top --tui --hierarchy' entries
>   (Namhyung Kim)
> 
> - Fix building of JIT support on Ubuntu 16.04 (Anton Blanchard)
> 
> - Fix handling of events including .c and .o, that were being treated as
>   BPF scripts instead of vendor ones (Wang Nan)
> 
> Signed-off-by: Arnaldo Carvalho de Melo 

Pulled, thanks a lot Arnaldo!

Ingo


[GIT PULL] Re: [PATCH 04/27] perf list: Add support for listing only json events

2016-10-17 Thread Arnaldo Carvalho de Melo
Em Mon, Oct 17, 2016 at 06:57:56AM -0700, Andi Kleen escreveu:
> > What we do know about the CPU vendor event names is that they are vendor 
> > specific, 
> > and that's a pretty stable property. So my suggestion would be to simply 
> > make it:
> > 
> > perf list vendor
> > 
> > with perhaps add aliases as well:
> > 
> > perf list model
> > perf list cpu-model
> > 
> > ... and 'perf list hardware' should probably also list all the vendor 
> > specific 
> > hardware events as well.
> 
> Sure can change it.
> 
> > 
> > Could we please work a bit more on making vendor specific hardware event 
> > handling 
> > more usable to people who don't care about internals?
> 
> Do you prefer fully new patches, or are incremential patches ok? 

I would like for you to base of my perf/urgent branch as of now, that
has those two patches yanked out so that the others can go thru.

Ingo, please consider pulling from the perf-urgent-for-mingo-20161017
tag, just signed and pushed, it has:

tag perf-urgent-for-mingo-20161017
Tagger: Arnaldo Carvalho de Melo 
Date:   Mon Oct 17 11:26:10 2016 -0300

perf/urgent fixes:

- Fix handling of numa nodes in perf.data files (Jiri Olsa)

- Fix scrolling when refreshing 'perf top --tui --hierarchy' entries
  (Namhyung Kim)

- Fix building of JIT support on Ubuntu 16.04 (Anton Blanchard)

- Fix handling of events including .c and .o, that were being treated as
  BPF scripts instead of vendor ones (Wang Nan)

Signed-off-by: Arnaldo Carvalho de Melo 

- Arnaldo


[GIT PULL] Re: [PATCH 04/27] perf list: Add support for listing only json events

2016-10-17 Thread Arnaldo Carvalho de Melo
Em Mon, Oct 17, 2016 at 06:57:56AM -0700, Andi Kleen escreveu:
> > What we do know about the CPU vendor event names is that they are vendor 
> > specific, 
> > and that's a pretty stable property. So my suggestion would be to simply 
> > make it:
> > 
> > perf list vendor
> > 
> > with perhaps add aliases as well:
> > 
> > perf list model
> > perf list cpu-model
> > 
> > ... and 'perf list hardware' should probably also list all the vendor 
> > specific 
> > hardware events as well.
> 
> Sure can change it.
> 
> > 
> > Could we please work a bit more on making vendor specific hardware event 
> > handling 
> > more usable to people who don't care about internals?
> 
> Do you prefer fully new patches, or are incremential patches ok? 

I would like for you to base of my perf/urgent branch as of now, that
has those two patches yanked out so that the others can go thru.

Ingo, please consider pulling from the perf-urgent-for-mingo-20161017
tag, just signed and pushed, it has:

tag perf-urgent-for-mingo-20161017
Tagger: Arnaldo Carvalho de Melo 
Date:   Mon Oct 17 11:26:10 2016 -0300

perf/urgent fixes:

- Fix handling of numa nodes in perf.data files (Jiri Olsa)

- Fix scrolling when refreshing 'perf top --tui --hierarchy' entries
  (Namhyung Kim)

- Fix building of JIT support on Ubuntu 16.04 (Anton Blanchard)

- Fix handling of events including .c and .o, that were being treated as
  BPF scripts instead of vendor ones (Wang Nan)

Signed-off-by: Arnaldo Carvalho de Melo 

- Arnaldo


Re: [PATCH 04/27] perf list: Add support for listing only json events

2016-10-17 Thread Andi Kleen
> What we do know about the CPU vendor event names is that they are vendor 
> specific, 
> and that's a pretty stable property. So my suggestion would be to simply make 
> it:
> 
>   perf list vendor
> 
> with perhaps add aliases as well:
> 
>   perf list model
>   perf list cpu-model
> 
> ... and 'perf list hardware' should probably also list all the vendor 
> specific 
> hardware events as well.

Sure can change it.

> 
> Could we please work a bit more on making vendor specific hardware event 
> handling 
> more usable to people who don't care about internals?

Do you prefer fully new patches, or are incremential patches ok? 

-Andi


Re: [PATCH 04/27] perf list: Add support for listing only json events

2016-10-17 Thread Andi Kleen
> What we do know about the CPU vendor event names is that they are vendor 
> specific, 
> and that's a pretty stable property. So my suggestion would be to simply make 
> it:
> 
>   perf list vendor
> 
> with perhaps add aliases as well:
> 
>   perf list model
>   perf list cpu-model
> 
> ... and 'perf list hardware' should probably also list all the vendor 
> specific 
> hardware events as well.

Sure can change it.

> 
> Could we please work a bit more on making vendor specific hardware event 
> handling 
> more usable to people who don't care about internals?

Do you prefer fully new patches, or are incremential patches ok? 

-Andi


Re: [PATCH 04/27] perf list: Add support for listing only json events

2016-10-16 Thread Ingo Molnar

* Arnaldo Carvalho de Melo  wrote:

> From: Andi Kleen 
> 
> Add an argument to only list json events. To be used for the command
> line completion script. This requires adding a new flag to the alias
> structure.
> 
> Committer notes:
> 
> Using it:
> 
>   $ perf list json

Sigh, this is a pretty poor user interface. :-(

 - 'JSON' is an internal data format used by the source code and by vendors to 
   publish event lists. perf might use something else in the future to store 
the 
   events (for example native .c/.h files) - we don't know. Why should the user 
   care or remember?

 - Also, even if the user remembers, it's not clear that using a weird acronym 
   that does not mean much in itself is a good way to key off a high level user 
   interface. Acronyms Seriously Suck.

 - The output of 'perf list help' is not really helpful either, so the user who 
   knows that there's "something" to list the vendor hardware events is still 
   stuck. Also, 'perf list hardware' will list the wrong things.

What we do know about the CPU vendor event names is that they are vendor 
specific, 
and that's a pretty stable property. So my suggestion would be to simply make 
it:

perf list vendor

with perhaps add aliases as well:

perf list model
perf list cpu-model

... and 'perf list hardware' should probably also list all the vendor specific 
hardware events as well.

Could we please work a bit more on making vendor specific hardware event 
handling 
more usable to people who don't care about internals?

Thanks,

Ingo


Re: [PATCH 04/27] perf list: Add support for listing only json events

2016-10-16 Thread Ingo Molnar

* Arnaldo Carvalho de Melo  wrote:

> From: Andi Kleen 
> 
> Add an argument to only list json events. To be used for the command
> line completion script. This requires adding a new flag to the alias
> structure.
> 
> Committer notes:
> 
> Using it:
> 
>   $ perf list json

Sigh, this is a pretty poor user interface. :-(

 - 'JSON' is an internal data format used by the source code and by vendors to 
   publish event lists. perf might use something else in the future to store 
the 
   events (for example native .c/.h files) - we don't know. Why should the user 
   care or remember?

 - Also, even if the user remembers, it's not clear that using a weird acronym 
   that does not mean much in itself is a good way to key off a high level user 
   interface. Acronyms Seriously Suck.

 - The output of 'perf list help' is not really helpful either, so the user who 
   knows that there's "something" to list the vendor hardware events is still 
   stuck. Also, 'perf list hardware' will list the wrong things.

What we do know about the CPU vendor event names is that they are vendor 
specific, 
and that's a pretty stable property. So my suggestion would be to simply make 
it:

perf list vendor

with perhaps add aliases as well:

perf list model
perf list cpu-model

... and 'perf list hardware' should probably also list all the vendor specific 
hardware events as well.

Could we please work a bit more on making vendor specific hardware event 
handling 
more usable to people who don't care about internals?

Thanks,

Ingo


[PATCH 04/27] perf list: Add support for listing only json events

2016-10-13 Thread Arnaldo Carvalho de Melo
From: Andi Kleen 

Add an argument to only list json events. To be used for the command
line completion script. This requires adding a new flag to the alias
structure.

Committer notes:

Using it:

  $ perf list json

  Cache:
l1d.replacement
 [L1D data line replacements]
l1d_pend_miss.fb_full
 [Cycles a demand request was blocked due to Fill Buffers 
inavailability]
l1d_pend_miss.pending
 [L1D miss oustandings duration in cycles]
l1d_pend_miss.pending_cycles
 [Cycles with L1D load Misses outstanding]

page_walker_loads.itlb_l1
 [Number of ITLB page walker hits in the L1+FB]
page_walker_loads.itlb_l2
 [Number of ITLB page walker hits in the L2]
page_walker_loads.itlb_l3
 [Number of ITLB page walker hits in the L3 + XSNP]
tlb_flush.dtlb_thread
 [DTLB flush attempts of the thread-specific entries]
tlb_flush.stlb_any
 [STLB flush attempts]
  $

Signed-off-by: Andi Kleen 
Suggested-and-Tested-by: Arnaldo Carvalho de Melo 
Cc: Jiri Olsa 
Link: 
http://lkml.kernel.org/r/1475781807-6034-1-git-send-email-a...@firstfloor.org
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/Documentation/perf-list.txt |  2 +-
 tools/perf/builtin-list.c  |  9 ++---
 tools/perf/util/parse-events.c |  2 +-
 tools/perf/util/pmu.c  | 14 ++
 tools/perf/util/pmu.h  |  3 ++-
 5 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/tools/perf/Documentation/perf-list.txt 
b/tools/perf/Documentation/perf-list.txt
index 41857cce5e86..50a35b27a64d 100644
--- a/tools/perf/Documentation/perf-list.txt
+++ b/tools/perf/Documentation/perf-list.txt
@@ -8,7 +8,7 @@ perf-list - List all symbolic event types
 SYNOPSIS
 
 [verse]
-'perf list' [--no-desc] [--long-desc] [hw|sw|cache|tracepoint|pmu|event_glob]
+'perf list' [--no-desc] [--long-desc] 
[hw|sw|cache|tracepoint|pmu|json|sdt|event_glob]
 
 DESCRIPTION
 ---
diff --git a/tools/perf/builtin-list.c b/tools/perf/builtin-list.c
index ba9322ff858b..b9ccdc7ec733 100644
--- a/tools/perf/builtin-list.c
+++ b/tools/perf/builtin-list.c
@@ -32,7 +32,7 @@ int cmd_list(int argc, const char **argv, const char *prefix 
__maybe_unused)
OPT_END()
};
const char * const list_usage[] = {
-   "perf list [] 
[hw|sw|cache|tracepoint|pmu|sdt|event_glob]",
+   "perf list [] 
[hw|sw|cache|tracepoint|pmu|sdt|json|event_glob]",
NULL
};
 
@@ -69,9 +69,12 @@ int cmd_list(int argc, const char **argv, const char *prefix 
__maybe_unused)
print_hwcache_events(NULL, raw_dump);
else if (strcmp(argv[i], "pmu") == 0)
print_pmu_events(NULL, raw_dump, !desc_flag,
-   long_desc_flag);
+   long_desc_flag, false);
else if (strcmp(argv[i], "sdt") == 0)
print_sdt_events(NULL, NULL, raw_dump);
+   else if (strcmp(argv[i], "json") == 0)
+   print_pmu_events(NULL, raw_dump, !desc_flag,
+   long_desc_flag, true);
else if ((sep = strchr(argv[i], ':')) != NULL) {
int sep_idx;
 
@@ -100,7 +103,7 @@ int cmd_list(int argc, const char **argv, const char 
*prefix __maybe_unused)
event_symbols_sw, 
PERF_COUNT_SW_MAX, raw_dump);
print_hwcache_events(s, raw_dump);
print_pmu_events(s, raw_dump, !desc_flag,
-   long_desc_flag);
+   long_desc_flag, false);
print_tracepoint_events(NULL, s, raw_dump);
print_sdt_events(NULL, s, raw_dump);
free(s);
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 4e778eae1510..948ef84e4c6a 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -2275,7 +2275,7 @@ void print_events(const char *event_glob, bool name_only, 
bool quiet_flag,
 
print_hwcache_events(event_glob, name_only);
 
-   print_pmu_events(event_glob, name_only, quiet_flag, long_desc);
+   print_pmu_events(event_glob, name_only, quiet_flag, long_desc, false);
 
if (event_glob != NULL)
return;
diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
index b1474dcadfa2..d8d7d4c0319c 100644
--- a/tools/perf/util/pmu.c
+++ b/tools/perf/util/pmu.c
@@ -224,7 +224,7 @@ static int perf_pmu__parse_snapshot(struct perf_pmu_alias 
*alias,
 
 static int __perf_pmu__new_alias(struct list_head *list, char *dir, char *name,
 

[PATCH 04/27] perf list: Add support for listing only json events

2016-10-13 Thread Arnaldo Carvalho de Melo
From: Andi Kleen 

Add an argument to only list json events. To be used for the command
line completion script. This requires adding a new flag to the alias
structure.

Committer notes:

Using it:

  $ perf list json

  Cache:
l1d.replacement
 [L1D data line replacements]
l1d_pend_miss.fb_full
 [Cycles a demand request was blocked due to Fill Buffers 
inavailability]
l1d_pend_miss.pending
 [L1D miss oustandings duration in cycles]
l1d_pend_miss.pending_cycles
 [Cycles with L1D load Misses outstanding]

page_walker_loads.itlb_l1
 [Number of ITLB page walker hits in the L1+FB]
page_walker_loads.itlb_l2
 [Number of ITLB page walker hits in the L2]
page_walker_loads.itlb_l3
 [Number of ITLB page walker hits in the L3 + XSNP]
tlb_flush.dtlb_thread
 [DTLB flush attempts of the thread-specific entries]
tlb_flush.stlb_any
 [STLB flush attempts]
  $

Signed-off-by: Andi Kleen 
Suggested-and-Tested-by: Arnaldo Carvalho de Melo 
Cc: Jiri Olsa 
Link: 
http://lkml.kernel.org/r/1475781807-6034-1-git-send-email-a...@firstfloor.org
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/Documentation/perf-list.txt |  2 +-
 tools/perf/builtin-list.c  |  9 ++---
 tools/perf/util/parse-events.c |  2 +-
 tools/perf/util/pmu.c  | 14 ++
 tools/perf/util/pmu.h  |  3 ++-
 5 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/tools/perf/Documentation/perf-list.txt 
b/tools/perf/Documentation/perf-list.txt
index 41857cce5e86..50a35b27a64d 100644
--- a/tools/perf/Documentation/perf-list.txt
+++ b/tools/perf/Documentation/perf-list.txt
@@ -8,7 +8,7 @@ perf-list - List all symbolic event types
 SYNOPSIS
 
 [verse]
-'perf list' [--no-desc] [--long-desc] [hw|sw|cache|tracepoint|pmu|event_glob]
+'perf list' [--no-desc] [--long-desc] 
[hw|sw|cache|tracepoint|pmu|json|sdt|event_glob]
 
 DESCRIPTION
 ---
diff --git a/tools/perf/builtin-list.c b/tools/perf/builtin-list.c
index ba9322ff858b..b9ccdc7ec733 100644
--- a/tools/perf/builtin-list.c
+++ b/tools/perf/builtin-list.c
@@ -32,7 +32,7 @@ int cmd_list(int argc, const char **argv, const char *prefix 
__maybe_unused)
OPT_END()
};
const char * const list_usage[] = {
-   "perf list [] 
[hw|sw|cache|tracepoint|pmu|sdt|event_glob]",
+   "perf list [] 
[hw|sw|cache|tracepoint|pmu|sdt|json|event_glob]",
NULL
};
 
@@ -69,9 +69,12 @@ int cmd_list(int argc, const char **argv, const char *prefix 
__maybe_unused)
print_hwcache_events(NULL, raw_dump);
else if (strcmp(argv[i], "pmu") == 0)
print_pmu_events(NULL, raw_dump, !desc_flag,
-   long_desc_flag);
+   long_desc_flag, false);
else if (strcmp(argv[i], "sdt") == 0)
print_sdt_events(NULL, NULL, raw_dump);
+   else if (strcmp(argv[i], "json") == 0)
+   print_pmu_events(NULL, raw_dump, !desc_flag,
+   long_desc_flag, true);
else if ((sep = strchr(argv[i], ':')) != NULL) {
int sep_idx;
 
@@ -100,7 +103,7 @@ int cmd_list(int argc, const char **argv, const char 
*prefix __maybe_unused)
event_symbols_sw, 
PERF_COUNT_SW_MAX, raw_dump);
print_hwcache_events(s, raw_dump);
print_pmu_events(s, raw_dump, !desc_flag,
-   long_desc_flag);
+   long_desc_flag, false);
print_tracepoint_events(NULL, s, raw_dump);
print_sdt_events(NULL, s, raw_dump);
free(s);
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 4e778eae1510..948ef84e4c6a 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -2275,7 +2275,7 @@ void print_events(const char *event_glob, bool name_only, 
bool quiet_flag,
 
print_hwcache_events(event_glob, name_only);
 
-   print_pmu_events(event_glob, name_only, quiet_flag, long_desc);
+   print_pmu_events(event_glob, name_only, quiet_flag, long_desc, false);
 
if (event_glob != NULL)
return;
diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
index b1474dcadfa2..d8d7d4c0319c 100644
--- a/tools/perf/util/pmu.c
+++ b/tools/perf/util/pmu.c
@@ -224,7 +224,7 @@ static int perf_pmu__parse_snapshot(struct perf_pmu_alias 
*alias,
 
 static int __perf_pmu__new_alias(struct list_head *list, char *dir, char *name,
 char *desc, char *val, char *long_desc,
-char *topic)
+