perf pmu: Support alias descriptions

Add support to print alias descriptions in perf list, which are taken
from the generated event files.

The sorting code is changed to put the events with descriptions at the
end. The descriptions are printed as possibly multiple word wrapped
lines.

Example output:

% perf list
...
  arith.fpu_div
       [Divide operations executed]
  arith.fpu_div_active
       [Cycles when divider is busy executing divide operations]

Committer notes:

Further testing on a Broadwell machine (ThinkPad t450s), using these
files:

  $ find tools/perf/pmu-events/arch/x86/
  tools/perf/pmu-events/arch/x86/
  tools/perf/pmu-events/arch/x86/Broadwell
  tools/perf/pmu-events/arch/x86/Broadwell/Cache.json
  tools/perf/pmu-events/arch/x86/Broadwell/Other.json
  tools/perf/pmu-events/arch/x86/Broadwell/Frontend.json
  tools/perf/pmu-events/arch/x86/Broadwell/Virtual-Memory.json
  tools/perf/pmu-events/arch/x86/Broadwell/Pipeline.json
  tools/perf/pmu-events/arch/x86/Broadwell/Floating-point.json
  tools/perf/pmu-events/arch/x86/Broadwell/Memory.json
  tools/perf/pmu-events/arch/x86/mapfile.csv
  $

Taken from:

https://github.com/sukadev/linux/tree/json-code+data-v21/tools/perf/pmu-events/arch/x86/

to get this machinery to actually parse JSON files, generate
$(OUTPUT)pmu-events/pmu-events.c, compile it and link it with perf, that
will then use the table it contains, these files will be submitted right
after this patchkit.

  [acme@jouet linux]$ perf list page_walker

  List of pre-defined events (to be used in -e):

    page_walker_loads.dtlb_l1
         [Number of DTLB page walker hits in the L1+FB]
    page_walker_loads.dtlb_l2
         [Number of DTLB page walker hits in the L2]
    page_walker_loads.dtlb_l3
         [Number of DTLB page walker hits in the L3 + XSNP]
    page_walker_loads.dtlb_memory
         [Number of DTLB page walker hits in Memory]
    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]

[acme@jouet linux]$

Signed-off-by: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Acked-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: linuxppc-dev@lists.ozlabs.org
Link: http://lkml.kernel.org/r/1473978296-20712-7-git-send-email-sukadev@linux.vnet.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2 files changed