1. 26 3月, 2022 1 次提交
    • W
      perf tools: Enhance the matching of sub-commands abbreviations · ae0f4eb3
      Wei Li 提交于
      We support short command 'rec*' for 'record' and 'rep*' for 'report' in
      lots of sub-commands, but the matching is not quite strict currnetly.
      
      It may be puzzling sometime, like we mis-type a 'recport' to report but
      it will perform 'record' in fact without any message.
      
      To fix this, add a check to ensure that the short cmd is valid prefix
      of the real command.
      
      Committer testing:
      
        [root@quaco ~]# perf c2c re sleep 1
      
         Usage: perf c2c {record|report}
      
            -v, --verbose         be more verbose (show counter open errors, etc)
      
        # perf c2c rec sleep 1
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.038 MB perf.data (16 samples) ]
        # perf c2c recport sleep 1
      
         Usage: perf c2c {record|report}
      
            -v, --verbose         be more verbose (show counter open errors, etc)
      
        # perf c2c record sleep 1
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.038 MB perf.data (15 samples) ]
        # perf c2c records sleep 1
      
         Usage: perf c2c {record|report}
      
            -v, --verbose         be more verbose (show counter open errors, etc)
      
        #
      Signed-off-by: NWei Li <liwei391@huawei.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Hanjun Guo <guohanjun@huawei.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Rui Xiang <rui.xiang@huawei.com>
      Link: http://lore.kernel.org/lkml/20220325092032.2956161-1-liwei391@huawei.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      ae0f4eb3
  2. 23 3月, 2022 1 次提交
    • K
      perf script: Add 'brstackinsnlen' for branch stacks · 6f680c6a
      Kan Liang 提交于
      When analyzing with 'perf script', it's useful to understand the
      captured instruction and the next sequential instruction.
      
      To calculate the address of the next sequential instruction, the length
      of the captured instruction is required.
      
      For example, you can’t know the next sequential instruction after an
      unconditional branch unless you calculate that based on its length.
      
      For branch stacks, 'perf script' only prints the instruction bytes with
      'brstackinsn', but lacks the instruction length.
      
      Add 'brstackinsnlen' to print the instruction length.
      
        $ perf script -F ip,brstackinsn,brstackinsnlen --xed
           7fa555be8f75
              _start:
              00007fa555be8090    mov %rsp, %rdi              ilen: 3
              00007fa555be8093    callq  0x7fa555be8ea0       ilen: 5 # PRED 102 cycles [102] 0.02 IPC
              _dl_start+38:
              00007fa555be8ec6    movq  %rdx,0x227853(%rip)   ilen: 7
              00007fa555be8ecd    leaq  0x227f94(%rip),%rdx   ilen: 7
      Signed-off-by: NKan Liang <kan.liang@linux.intel.com>
      Cc: Ahmad Yasin <ahmad.yasin@intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Link: https://lore.kernel.org/r/1647871212-184070-1-git-send-email-kan.liang@linux.intel.com
      [ Added the new field to tools/perf/Documentation/perf-script.txt ]
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      6f680c6a
  3. 08 3月, 2022 2 次提交
  4. 23 2月, 2022 1 次提交
  5. 16 2月, 2022 3 次提交
  6. 23 1月, 2022 1 次提交
    • Y
      perf script: Fix printing 'phys_addr' failure issue · 9edcde68
      Yao Jin 提交于
      Perf script was failed to print the phys_addr for SPE profiling.
      One 'dummy' event is added by SPE profiling but it doesn't have PHYS_ADDR
      attribute set, perf script then exits with error.
      
      Now referring to 'addr', use evsel__do_check_stype() to check the type.
      
      Before:
      
        # perf record -e arm_spe_0/branch_filter=0,ts_enable=1,pa_enable=1,load_filter=1,jitter=0,\
      		store_filter=0,min_latency=0,event_filter=2/ -p 4064384 -- sleep 3
        # perf script -F pid,tid,addr,phys_addr
        Samples for 'dummy:u' event do not have PHYS_ADDR attribute set. Cannot print 'phys_addr' field.
      
      After:
      
        # perf record -e arm_spe_0/branch_filter=0,ts_enable=1,pa_enable=1,load_filter=1,jitter=0,\
      		store_filter=0,min_latency=0,event_filter=2/ -p 4064384 -- sleep 3
        # perf script -F pid,tid,addr,phys_addr
        4064384/4064384 ffff802f921be0d0      2f921be0d0
        4064384/4064384 ffff802f921be0d0      2f921be0d0
      Reviewed-by: NGerman Gomez <german.gomez@arm.com>
      Signed-off-by: NYao Jin <jinyao5@huawei.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Hanjun Guo <guohanjun@huawei.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lore.kernel.org/lkml/20220121065954.2121900-1-liwei391@huawei.comSigned-off-by: NWei Li <liwei391@huawei.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      9edcde68
  7. 13 1月, 2022 3 次提交
    • I
      perf cpumap: Give CPUs their own type · 6d18804b
      Ian Rogers 提交于
      A common problem is confusing CPU map indices with the CPU, by wrapping
      the CPU with a struct then this is avoided. This approach is similar to
      atomic_t.
      
      Committer notes:
      
      To make it build with BUILD_BPF_SKEL=1 these files needed the
      conversions to 'struct perf_cpu' usage:
      
        tools/perf/util/bpf_counter.c
        tools/perf/util/bpf_counter_cgroup.c
        tools/perf/util/bpf_ftrace.c
      
      Also perf_env__get_cpu() was removed back in "perf cpumap: Switch
      cpu_map__build_map to cpu function".
      
      Additionally these needed to be fixed for the ARM builds to complete:
      
        tools/perf/arch/arm/util/cs-etm.c
        tools/perf/arch/arm64/util/pmu.c
      Suggested-by: NJohn Garry <john.garry@huawei.com>
      Signed-off-by: NIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      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: Mathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Clarke <pc@us.ibm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Riccardo Mancini <rickyman7@gmail.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Vineet Singh <vineet.singh@intel.com>
      Cc: coresight@lists.linaro.org
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: zhengjun.xing@intel.com
      Link: https://lore.kernel.org/r/20220105061351.120843-49-irogers@google.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      6d18804b
    • I
      perf script: Fix flipped index and cpu · b57af1b4
      Ian Rogers 提交于
      perf_counts are accessed by the densely packed index.
      Signed-off-by: NIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: John Garry <john.garry@huawei.com>
      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: Mathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Clarke <pc@us.ibm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Riccardo Mancini <rickyman7@gmail.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Vineet Singh <vineet.singh@intel.com>
      Cc: coresight@lists.linaro.org
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: zhengjun.xing@intel.com
      Link: https://lore.kernel.org/r/20220105061351.120843-47-irogers@google.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      b57af1b4
    • I
      perf script: Use for each cpu to aid readability · f9551b3f
      Ian Rogers 提交于
      Use perf_cpu_map__for_each_cpu() to help with readability.
      Signed-off-by: NIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: John Garry <john.garry@huawei.com>
      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: Mathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Clarke <pc@us.ibm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Riccardo Mancini <rickyman7@gmail.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Vineet Singh <vineet.singh@intel.com>
      Cc: coresight@lists.linaro.org
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: zhengjun.xing@intel.com
      Link: https://lore.kernel.org/r/20220105061351.120843-33-irogers@google.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      f9551b3f
  8. 29 12月, 2021 1 次提交
  9. 22 12月, 2021 2 次提交
  10. 16 12月, 2021 1 次提交
    • G
      perf arch: Support register names from all archs · 83869019
      German Gomez 提交于
      When reading a perf.data file with register values, there is a mismatch
      between the names and the values of the registers because the tool is
      built using only the register names from the local architecture.
      
      Reading a perf.data file that was recorded on ARM64, gives the following
      erroneous output on an X86 machine:
      
        # perf report -i perf_arm64.data -D
        [...]
        24661932634451 0x698 [0x21d0]: PERF_RECORD_SAMPLE(IP, 0x1): 43239/43239: 0xffffc5be8f100f98 period: 1 addr: 0
        ... user regs: mask 0x1ffffffff ABI 64-bit
        .... AX    0x0000ffffd1515817
        .... BX    0x0000ffffd1515480
        .... CX    0x0000aaaadabf6c80
        .... DX    0x000000000000002e
        .... SI    0x0000000040100401
        .... DI    0x0040600200000080
        .... BP    0x0000ffffd1510e10
        .... SP    0x0000000000000000
        .... IP    0x00000000000000dd
        .... FLAGS 0x0000ffffd1510cd0
        .... CS    0x0000000000000000
        .... SS    0x0000000000000030
        .... DS    0x0000ffffa569a208
        .... ES    0x0000000000000000
        .... FS    0x0000000000000000
        .... GS    0x0000000000000000
        .... R8    0x0000aaaad3de9650
        .... R9    0x0000ffffa57397f0
        .... R10   0x0000000000000001
        .... R11   0x0000ffffa57fd000
        .... R12   0x0000ffffd1515817
        .... R13   0x0000ffffd1515480
        .... R14   0x0000aaaadabf6c80
        .... R15   0x0000000000000000
        .... unknown 0x0000000000000001
        .... unknown 0x0000000000000000
        .... unknown 0x0000000000000000
        .... unknown 0x0000000000000000
        .... unknown 0x0000000000000000
        .... unknown 0x0000ffffd1510d90
        .... unknown 0x0000ffffa5739b90
        .... unknown 0x0000ffffd1510d80
        .... XMM0  0x0000ffffa57392c8
         ... thread: perf-exec:43239
         ...... dso: [kernel.kallsyms]
      
      As can be seen, the register names correspond to X86 registers, even
      though the perf.data file was recorded on an ARM64 system. After this
      patch, the output of the command displays the correct register names:
      
        # perf report -i perf_arm64.data -D
        [...]
        24661932634451 0x698 [0x21d0]: PERF_RECORD_SAMPLE(IP, 0x1): 43239/43239: 0xffffc5be8f100f98 period: 1 addr: 0
        ... user regs: mask 0x1ffffffff ABI 64-bit
        .... x0    0x0000ffffd1515817
        .... x1    0x0000ffffd1515480
        .... x2    0x0000aaaadabf6c80
        .... x3    0x000000000000002e
        .... x4    0x0000000040100401
        .... x5    0x0040600200000080
        .... x6    0x0000ffffd1510e10
        .... x7    0x0000000000000000
        .... x8    0x00000000000000dd
        .... x9    0x0000ffffd1510cd0
        .... x10   0x0000000000000000
        .... x11   0x0000000000000030
        .... x12   0x0000ffffa569a208
        .... x13   0x0000000000000000
        .... x14   0x0000000000000000
        .... x15   0x0000000000000000
        .... x16   0x0000aaaad3de9650
        .... x17   0x0000ffffa57397f0
        .... x18   0x0000000000000001
        .... x19   0x0000ffffa57fd000
        .... x20   0x0000ffffd1515817
        .... x21   0x0000ffffd1515480
        .... x22   0x0000aaaadabf6c80
        .... x23   0x0000000000000000
        .... x24   0x0000000000000001
        .... x25   0x0000000000000000
        .... x26   0x0000000000000000
        .... x27   0x0000000000000000
        .... x28   0x0000000000000000
        .... x29   0x0000ffffd1510d90
        .... lr    0x0000ffffa5739b90
        .... sp    0x0000ffffd1510d80
        .... pc    0x0000ffffa57392c8
         ... thread: perf-exec:43239
         ...... dso: [kernel.kallsyms]
      
      Tester comments:
      
      Athira reports:
      
      "Looks good to me. Tested this patchset in powerpc by capturing regs in
      powerpc and doing perf report to read the data from x86."
      Reported-by: NAlexandre Truong <alexandre.truong@arm.com>
      Reviewed-by: NAthira Jajeev <atrajeev@linux.vnet.ibm.com>
      Signed-off-by: NGerman Gomez <german.gomez@arm.com>
      Tested-by: NAthira Jajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: John Garry <john.garry@huawei.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Will Deacon <will@kernel.org>
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: linux-csky@vger.kernel.org
      Cc: linux-riscv@lists.infradead.org
      Link: https://lore.kernel.org/r/20211207180653.1147374-4-german.gomez@arm.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      83869019
  11. 07 11月, 2021 1 次提交
  12. 31 10月, 2021 2 次提交
  13. 28 10月, 2021 1 次提交
  14. 19 9月, 2021 1 次提交
    • A
      perf script: Fix ip display when type != attr->type · ff6f41fb
      Adrian Hunter 提交于
      set_print_ip_opts() was not being called when type != attr->type
      because there is not a one-to-one relationship between output types
      and attr->type. That resulted in ip not printing.
      
      The attr_type() function is removed, and the match of attr->type to
      output type is corrected.
      
      Example on ADL using taskset to select an atom cpu:
      
       # perf record -e cpu_atom/cpu-cycles/ taskset 0x1000 uname
       Linux
       [ perf record: Woken up 1 times to write data ]
       [ perf record: Captured and wrote 0.003 MB perf.data (7 samples) ]
      
       Before:
      
        # perf script | head
               taskset   428 [-01] 10394.179041:          1 cpu_atom/cpu-cycles/:
               taskset   428 [-01] 10394.179043:          1 cpu_atom/cpu-cycles/:
               taskset   428 [-01] 10394.179044:         11 cpu_atom/cpu-cycles/:
               taskset   428 [-01] 10394.179045:        407 cpu_atom/cpu-cycles/:
               taskset   428 [-01] 10394.179046:      16789 cpu_atom/cpu-cycles/:
               taskset   428 [-01] 10394.179052:     676300 cpu_atom/cpu-cycles/:
                 uname   428 [-01] 10394.179278:    4079859 cpu_atom/cpu-cycles/:
      
       After:
      
        # perf script | head
               taskset   428 10394.179041:          1 cpu_atom/cpu-cycles/:  ffffffff95a0bb97 __intel_pmu_enable_all.constprop.48+0x47 ([kernel.kallsyms])
               taskset   428 10394.179043:          1 cpu_atom/cpu-cycles/:  ffffffff95a0bb97 __intel_pmu_enable_all.constprop.48+0x47 ([kernel.kallsyms])
               taskset   428 10394.179044:         11 cpu_atom/cpu-cycles/:  ffffffff95a0bb97 __intel_pmu_enable_all.constprop.48+0x47 ([kernel.kallsyms])
               taskset   428 10394.179045:        407 cpu_atom/cpu-cycles/:  ffffffff95a0bb97 __intel_pmu_enable_all.constprop.48+0x47 ([kernel.kallsyms])
               taskset   428 10394.179046:      16789 cpu_atom/cpu-cycles/:  ffffffff95a0bb97 __intel_pmu_enable_all.constprop.48+0x47 ([kernel.kallsyms])
               taskset   428 10394.179052:     676300 cpu_atom/cpu-cycles/:      7f829ef73800 cfree+0x0 (/lib/libc-2.32.so)
                 uname   428 10394.179278:    4079859 cpu_atom/cpu-cycles/:  ffffffff95bae912 vma_interval_tree_remove+0x1f2 ([kernel.kallsyms])
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Reviewed-by: NKan Liang <kan.liang@linux.intel.com>
      Cc: Jin Yao <yao.jin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Link: http://lore.kernel.org/lkml/20210911133053.15682-1-adrian.hunter@intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      ff6f41fb
  15. 03 9月, 2021 1 次提交
  16. 11 8月, 2021 1 次提交
  17. 02 8月, 2021 1 次提交
  18. 16 7月, 2021 2 次提交
  19. 10 7月, 2021 1 次提交
    • J
      libperf: Move 'leader' from tools/perf to perf_evsel::leader · fba7c866
      Jiri Olsa 提交于
      Move evsel::leader to perf_evsel::leader, so we can move the group
      interface to libperf.
      
      Also add several evsel helpers to ease up the transition:
      
        struct evsel *evsel__leader(struct evsel *evsel);
        - get leader evsel
      
        bool evsel__has_leader(struct evsel *evsel, struct evsel *leader);
        - true if evsel has leader as leader
      
        bool evsel__is_leader(struct evsel *evsel);
        - true if evsel is itw own leader
      
        void evsel__set_leader(struct evsel *evsel, struct evsel *leader);
        - set leader for evsel
      
      Committer notes:
      
      Fix this when building with 'make BUILD_BPF_SKEL=1'
      
        tools/perf/util/bpf_counter.c
      
        -       if (evsel->leader->core.nr_members > 1) {
        +       if (evsel->core.leader->nr_members > 1) {
      Signed-off-by: NJiri Olsa <jolsa@kernel.org>
      Requested-by: NShunsuke Nakamura <nakamura.shun@fujitsu.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Michael Petlan <mpetlan@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lore.kernel.org/lkml/20210706151704.73662-4-jolsa@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      fba7c866
  20. 02 7月, 2021 4 次提交
  21. 23 6月, 2021 3 次提交
  22. 01 6月, 2021 2 次提交
  23. 25 5月, 2021 4 次提交