1. 16 Nov, 2022 32 commits
  2. 15 Nov, 2022 8 commits
    • Ian Rogers's avatar
      perf pmu: Restructure print_pmu_events() to avoid memory allocations · eb2d4514
      Ian Rogers authored
      Previously print_pmu_events() would compute the values to be printed,
      place them in struct sevent, sort them and then print them.
      
      Modify the code so that struct sevent holds just the PMU and event, sort
      these and then in the main print loop calculate aliases for names, etc.
      
      This avoids memory allocations for copied values as they are computed
      then printed.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Caleb Biggers <caleb.biggers@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Perry Taylor <perry.taylor@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Rob Herring <robh@kernel.org>
      Cc: Sandipan Das <sandipan.das@amd.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Weilin Wang <weilin.wang@intel.com>
      Cc: Xin Gao <gaoxin@cdjrlc.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Link: http://lore.kernel.org/lkml/20221114210723.2749751-9-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      eb2d4514
    • Ian Rogers's avatar
      perf list: Simplify symbol event printing · de3752a7
      Ian Rogers authored
      The current code computes an array of symbol names then sorts and prints
      them. Use a strlist to create a list of names that is sorted and then
      print it.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Caleb Biggers <caleb.biggers@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Perry Taylor <perry.taylor@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Rob Herring <robh@kernel.org>
      Cc: Sandipan Das <sandipan.das@amd.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Weilin Wang <weilin.wang@intel.com>
      Cc: Xin Gao <gaoxin@cdjrlc.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Link: http://lore.kernel.org/lkml/20221114210723.2749751-8-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      de3752a7
    • Ian Rogers's avatar
      perf list: Simplify cache event printing · 3301b3fe
      Ian Rogers authored
      The current code computes an array of cache names then sorts and prints
      them. Use a strlist to create a list of names that is sorted. Keep the
      hybrid names, it is unclear how to generalize it, but drop the
      computation of evt_pmus that is never used.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Caleb Biggers <caleb.biggers@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Kang Minchul <tegongkang@gmail.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Perry Taylor <perry.taylor@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Rob Herring <robh@kernel.org>
      Cc: Sandipan Das <sandipan.das@amd.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Weilin Wang <weilin.wang@intel.com>
      Cc: Xin Gao <gaoxin@cdjrlc.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Link: http://lore.kernel.org/lkml/20221114210723.2749751-7-irogers@google.com
      [ Fixed up clash with cf9f67b3 ("perf print-events: Remove redundant comparison with zero")]
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      3301b3fe
    • Ian Rogers's avatar
      perf list: Generalize limiting to a PMU name · ca0fe624
      Ian Rogers authored
      Deprecate the --cputype option and add a --unit option where '--unit
      cpu_atom' behaves like '--cputype atom'. The --unit option can be used
      with arbitrary PMUs, for example:
      
      ```
      $ perf list --unit msr pmu
      
      List of pre-defined events (to be used in -e or -M):
      
        msr/aperf/                                         [Kernel PMU event]
        msr/cpu_thermal_margin/                            [Kernel PMU event]
        msr/mperf/                                         [Kernel PMU event]
        msr/pperf/                                         [Kernel PMU event]
        msr/smi/                                           [Kernel PMU event]
        msr/tsc/                                           [Kernel PMU event]
      ```
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Caleb Biggers <caleb.biggers@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Perry Taylor <perry.taylor@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Rob Herring <robh@kernel.org>
      Cc: Sandipan Das <sandipan.das@amd.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Weilin Wang <weilin.wang@intel.com>
      Cc: Xin Gao <gaoxin@cdjrlc.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Link: http://lore.kernel.org/lkml/20221114210723.2749751-6-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      ca0fe624
    • Ian Rogers's avatar
      perf tracepoint: Sort events in iterator · d74060c0
      Ian Rogers authored
      In print_tracepoint_events() use tracing_events__scandir_alphasort() and
      scandir alphasort so that the subsystem and events are sorted and don't
      need a secondary qsort. Locally this results in the following change:
      
      ...
         ext4:ext4_zero_range                               [Tracepoint event]
      -  fib6:fib6_table_lookup                             [Tracepoint event]
         fib:fib_table_lookup                               [Tracepoint event]
      +  fib6:fib6_table_lookup                             [Tracepoint event]
         filelock:break_lease_block                         [Tracepoint event]
      ...
      
      ie fib6 now is after fib and not before it. This is more consistent
      with how numbers are more generally sorted, such as:
      
      ...
        syscalls:sys_enter_renameat                        [Tracepoint event]
        syscalls:sys_enter_renameat2                       [Tracepoint event]
      ...
      
      and so an improvement over the qsort approach.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Caleb Biggers <caleb.biggers@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Perry Taylor <perry.taylor@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Rob Herring <robh@kernel.org>
      Cc: Sandipan Das <sandipan.das@amd.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Weilin Wang <weilin.wang@intel.com>
      Cc: Xin Gao <gaoxin@cdjrlc.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Link: http://lore.kernel.org/lkml/20221114210723.2749751-5-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      d74060c0
    • Ian Rogers's avatar
      tools lib api fs tracing_path: Add scandir alphasort · 1504b6f9
      Ian Rogers authored
      tracing_events__opendir() allows iteration over files in
      <debugfs>/tracing/events but with an arbitrary sort order.
      
      Add a scandir alternative where the results are alphabetically sorted.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Caleb Biggers <caleb.biggers@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Perry Taylor <perry.taylor@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Rob Herring <robh@kernel.org>
      Cc: Sandipan Das <sandipan.das@amd.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Weilin Wang <weilin.wang@intel.com>
      Cc: Xin Gao <gaoxin@cdjrlc.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Link: http://lore.kernel.org/lkml/20221114210723.2749751-4-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      1504b6f9
    • Ian Rogers's avatar
      perf pmu: Add data structure documentation · fe13d43d
      Ian Rogers authored
      Add documentation to 'struct perf_pmu' and the associated structs of
      'perf_pmu_alias' and 'perf_pmu_format'.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Caleb Biggers <caleb.biggers@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Perry Taylor <perry.taylor@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Rob Herring <robh@kernel.org>
      Cc: Sandipan Das <sandipan.das@amd.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Weilin Wang <weilin.wang@intel.com>
      Cc: Xin Gao <gaoxin@cdjrlc.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Link: http://lore.kernel.org/lkml/20221114210723.2749751-3-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      fe13d43d
    • Ian Rogers's avatar
      perf pmu: Remove mostly unused 'struct perf_pmu' 'is_hybrid' member · e5f4afbe
      Ian Rogers authored
      Replace usage with perf_pmu__is_hybrid().
      Suggested-by: default avatarKan Liang <kan.liang@linux.intel.com>
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Caleb Biggers <caleb.biggers@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Perry Taylor <perry.taylor@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Rob Herring <robh@kernel.org>
      Cc: Sandipan Das <sandipan.das@amd.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Weilin Wang <weilin.wang@intel.com>
      Cc: Xin Gao <gaoxin@cdjrlc.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Link: http://lore.kernel.org/lkml/20221114210723.2749751-2-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      e5f4afbe