1. 14 Dec, 2022 6 commits
    • Ian Rogers's avatar
      tools lib subcmd: Add dependency test to install_headers · 5d890591
      Ian Rogers authored
      Compute the headers to be installed from their source headers and make
      each have its own build target to install it. Using dependencies
      avoids headers being reinstalled and getting a new timestamp which
      then causes files that depend on the header to be rebuilt.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Josh Poimboeuf <jpoimboe@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Masahiro Yamada <masahiroy@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Nicolas Schier <nicolas@fjasle.eu>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Rix <trix@redhat.com>
      Cc: bpf@vger.kernel.org
      Cc: llvm@lists.linux.dev
      Link: https://lore.kernel.org/r/20221202045743.2639466-4-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      5d890591
    • Ian Rogers's avatar
      tools lib perf: Add dependency test to install_headers · 47e02b94
      Ian Rogers authored
      Compute the headers to be installed from their source headers and make
      each have its own build target to install it. Using dependencies
      avoids headers being reinstalled and getting a new timestamp which
      then causes files that depend on the header to be rebuilt.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Josh Poimboeuf <jpoimboe@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Masahiro Yamada <masahiroy@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Nicolas Schier <nicolas@fjasle.eu>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Rix <trix@redhat.com>
      Cc: bpf@vger.kernel.org
      Cc: llvm@lists.linux.dev
      Link: https://lore.kernel.org/r/20221202045743.2639466-3-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      47e02b94
    • Ian Rogers's avatar
      tools lib api: Add dependency test to install_headers · 1849f9f0
      Ian Rogers authored
      Compute the headers to be installed from their source headers and make
      each have its own build target to install it. Using dependencies
      avoids headers being reinstalled and getting a new timestamp which
      then causes files that depend on the header to be rebuilt.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Josh Poimboeuf <jpoimboe@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Masahiro Yamada <masahiroy@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Nicolas Schier <nicolas@fjasle.eu>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Rix <trix@redhat.com>
      Cc: bpf@vger.kernel.org
      Cc: llvm@lists.linux.dev
      Link: https://lore.kernel.org/r/20221202045743.2639466-2-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      1849f9f0
    • Athira Rajeev's avatar
      perf stat: Fix printing field separator in CSV metrics output · 8f4b1e3c
      Athira Rajeev authored
      In 'perf stat' with CSV output option, number of fields in metrics
      output is not matching with number of fields in other event output
      lines.
      
      Sample output below after applying patch to fix printing os->prefix.
      
      	# ./perf stat -x, --per-socket -a -C 1 ls
      	S0,1,82.11,msec,cpu-clock,82111626,100.00,1.000,CPUs utilized
      	S0,1,2,,context-switches,82109314,100.00,24.358,/sec
      	------
      ====>	S0,1,,,,,,,1.71,stalled cycles per insn
      
      The above command line uses field separator as "," via "-x," option and
      per-socket option displays socket value as first field. But here the
      last line for "stalled cycles per insn" has more separators.  Each csv
      output line is expected to have 8 field separators (for the 9 fields),
      where as last line has 9 "," in the result. Patch fixes this issue.
      
      The counter stats are displayed by function
      "perf_stat__print_shadow_stats" in code "util/stat-shadow.c". While
      printing the stats info for "stalled cycles per insn", function
      "new_line_csv" is used as new_line callback.
      
      The fields printed in each line contains: "Socket_id,aggr
      nr,Avg,unit,event_name,run,enable_percent,ratio,unit"
      
      The metric output prints Socket_id, aggr nr, ratio and unit. It has to
      skip through remaining five fields ie,
      Avg,unit,event_name,run,enable_percent. The csv line callback uses
      "os->nfields" to know the number of fields to skip to match with other
      lines.
      
      Currently it is set as:
      
      	os.nfields = 3 + aggr_fields[config->aggr_mode] + (counter->cgrp ? 1 : 0);
      
      But in case of aggregation modes, csv_sep already gets printed along
      with each field (Function "aggr_printout" in util/stat-display.c). So
      aggr_fields can be removed from nfields. And fixed number of fields to
      skip has to be "4". This is to skip fields for: "avg, unit, event name,
      run, enable_percent"
      
      This needs 4 csv separators. Patch removes aggr_fields
      and uses 4 as fixed number of os->nfields to skip.
      
      After the patch:
      
      	# ./perf stat -x, --per-socket -a -C 1 ls
      	S0,1,79.08,msec,cpu-clock,79085956,100.00,1.000,CPUs utilized
      	S0,1,7,,context-switches,79084176,100.00,88.514,/sec
      	------
      ====>	S0,1,,,,,,0.81,stalled cycles per insn
      
      Fixes: 92a61f64 ("perf stat: Implement CSV metrics output")
      Reported-by: default avatarDisha Goel <disgoel@linux.vnet.ibm.com>
      Reviewed-by: default avatarKajol Jain <kjain@linux.ibm.com>
      Signed-off-by: default avatarAthira Jajeev <atrajeev@linux.vnet.ibm.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Tested-by: default avatarDisha Goel <disgoel@linux.vnet.ibm.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Nageswara R Sastry <rnsastry@linux.ibm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: linuxppc-dev@lists.ozlabs.org
      Link: https://lore.kernel.org/r/20221205042852.83382-1-atrajeev@linux.vnet.ibm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      8f4b1e3c
    • Anshuman Khandual's avatar
      perf record: Add remaining branch filters: "no_cycles", "no_flags" & "hw_index" · 955f6def
      Anshuman Khandual authored
      This adds all remaining branch filters i.e "no_cycles", "no_flags" and
      "hw_index". While here, also updates the documentation.
      Signed-off-by: default avatarAnshuman Khandual <anshuman.khandual@arm.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lore.kernel.org/lkml/20221205064443.533587-1-anshuman.khandual@arm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      955f6def
    • Ian Rogers's avatar
      perf stat: Check existence of os->prefix, fixing a segfault · 3c97d25c
      Ian Rogers authored
      We need to check if we have a OS prefix, otherwise we stumble on a
      metric segv that I'm now seeing in Arnaldo's tree:
      
        $ gdb --args perf stat -M Backend true
        ...
        Performance counter stats for 'true':
      
                4,712,355      TOPDOWN.SLOTS                    #     17.3 % tma_core_bound
      
        Program received signal SIGSEGV, Segmentation fault.
        __strlen_evex () at ../sysdeps/x86_64/multiarch/strlen-evex.S:77
        77      ../sysdeps/x86_64/multiarch/strlen-evex.S: No such file or directory.
        (gdb) bt
        #0  __strlen_evex () at ../sysdeps/x86_64/multiarch/strlen-evex.S:77
        #1  0x00007ffff74749a5 in __GI__IO_fputs (str=0x0, fp=0x7ffff75f5680 <_IO_2_1_stderr_>)
        #2  0x0000555555779f28 in do_new_line_std (config=0x555555e077c0 <stat_config>, os=0x7fffffffbf10) at util/stat-display.c:356
        #3  0x000055555577a081 in print_metric_std (config=0x555555e077c0 <stat_config>, ctx=0x7fffffffbf10, color=0x0, fmt=0x5555558b77b5 "%8.1f", unit=0x7fffffffbb10 "%  tma_memory_bound", val=13.165355724442199) at util/stat-display.c:380
        #4  0x00005555557768b6 in generic_metric (config=0x555555e077c0 <stat_config>, metric_expr=0x55555593d5b7 "((CYCLE_ACTIVITY.STALLS_MEM_ANY + EXE_ACTIVITY.BOUND_ON_STORES) / (CYCLE_ACTIVITY.STALLS_TOTAL + (EXE_ACTIVITY.1_PORTS_UTIL + tma_retiring * EXE_ACTIVITY.2_PORTS_UTIL) + EXE_ACTIVITY.BOUND_ON_STORES))"..., metric_events=0x555555f334e0, metric_refs=0x555555ec81d0, name=0x555555f32e80 "TOPDOWN.SLOTS", metric_name=0x555555f26c80 "tma_memory_bound", metric_unit=0x55555593d5b1 "100%", runtime=0, map_idx=0, out=0x7fffffffbd90, st=0x555555e9e620 <rt_stat>) at util/stat-shadow.c:934
        #5  0x0000555555778cac in perf_stat__print_shadow_stats (config=0x555555e077c0 <stat_config>, evsel=0x555555f289d0, avg=4712355, map_idx=0, out=0x7fffffffbd90, metric_events=0x555555e078e8 <stat_config+296>, st=0x555555e9e620 <rt_stat>) at util/stat-shadow.c:1329
        #6  0x000055555577b6a0 in printout (config=0x555555e077c0 <stat_config>, os=0x7fffffffbf10, uval=4712355, run=325322, ena=325322, noise=4712355, map_idx=0) at util/stat-display.c:741
        #7  0x000055555577bc74 in print_counter_aggrdata (config=0x555555e077c0 <stat_config>, counter=0x555555f289d0, s=0, os=0x7fffffffbf10) at util/stat-display.c:838
        #8  0x000055555577c1d8 in print_counter (config=0x555555e077c0 <stat_config>, counter=0x555555f289d0, os=0x7fffffffbf10) at util/stat-display.c:957
        #9  0x000055555577dba0 in evlist__print_counters (evlist=0x555555ec3610, config=0x555555e077c0 <stat_config>, _target=0x555555e01c80 <target>, ts=0x0, argc=1, argv=0x7fffffffe450) at util/stat-display.c:1413
        #10 0x00005555555fc821 in print_counters (ts=0x0, argc=1, argv=0x7fffffffe450) at builtin-stat.c:1040
        #11 0x000055555560091a in cmd_stat (argc=1, argv=0x7fffffffe450) at builtin-stat.c:2665
        #12 0x00005555556b1eea in run_builtin (p=0x555555e11f70 <commands+336>, argc=4, argv=0x7fffffffe450) at perf.c:322
        #13 0x00005555556b2181 in handle_internal_command (argc=4, argv=0x7fffffffe450) at perf.c:376
        #14 0x00005555556b22d7 in run_argv (argcp=0x7fffffffe27c, argv=0x7fffffffe270) at perf.c:420
        #15 0x00005555556b26ef in main (argc=4, argv=0x7fffffffe450) at perf.c:550
        (gdb)
      
      Fixes: f123b2d8 ("perf stat: Remove prefix argument in print_metric_headers()")
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Link: http://lore.kernel.org/lkml/CAP-5=fUOjSM5HajU9TCD6prY39LbX4OQbkEbtKPPGRBPBN=_VQ@mail.gmail.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      3c97d25c
  2. 05 Dec, 2022 4 commits
  3. 24 Nov, 2022 24 commits
  4. 23 Nov, 2022 6 commits