1. 15 6月, 2021 3 次提交
  2. 23 9月, 2020 2 次提交
    • H
      perf script: Add min, max to futex-contention output, in addition to avg · 69f48c70
      Hagen Paul Pfeifer 提交于
      Average is quite informative, but the outliners - especially max - are
      also of interest.
      
      Before:
      
        mutex-locker[793299] lock 5637ec61e080 contended 3400 times, 446 avg ns
        mutex-locker[793301] lock 5637ec61e080 contended 3563 times, 385 avg ns
        mutex-locker[793300] lock 5637ec61e080 contended 3110 times, 1855 avg ns
      
      After:
      
        mutex-locker[795251] lock 55b14e6dd080 contended 3853 times, 1279 avg ns [max: 12270 ns, min 340 ns]
        mutex-locker[795253] lock 55b14e6dd080 contended 2911 times, 518 avg ns [max: 51660261 ns, min 347 ns]
        mutex-locker[795252] lock 55b14e6dd080 contended 3843 times, 385 avg ns [max: 24323998 ns, min 338 ns]
      
      Committer testing:
      
        [root@five ~]# perf script record futex-contention -a
        ^C[ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 1.877 MB perf.data (923 samples) ]
      
        [root@five ~]# perf evlist
        syscalls:sys_enter_futex
        syscalls:sys_exit_futex
        dummy:HG
        # Tip: use 'perf evlist --trace-fields' to show fields for tracepoint events
        #
      
      Before:
      
        [root@five ~]# perf script report futex-contention
        JS Helper[2457] lock 55fe0cf82610 contended 4 times, 6657 avg ns
        ibus-daemon[2975] lock 56227f6d0210 contended 4 times, 1020 avg ns
        chromium-browse[1905801] lock 7ffe573f5088 contended 8 times, 108463 avg ns
        gnome-shell[2240] lock 55fe0cf82678 contended 1 times, 8616 avg ns
        gnome-shel:cs0[2292] lock 55fe0d0ab768 contended 3 times, 606016034 avg ns
        JS Helper[2458] lock 55fe0cf82690 contended 1 times, 1167840 avg ns
        chromium-browse[1905470] lock 7ffe573f5358 contended 1 times, 551504 avg ns
        chromium-browse[1905948] lock 7ffe573f5358 contended 1 times, 577422 avg ns
        gnome-shell[2240] lock 55fe0cf82660 contended 6 times, 202696 avg ns
        pool[2602] lock 7fd600008ef0 contended 1 times, 500046007 avg ns
        chromium-browse[1905801] lock 7ffe573f5128 contended 4 times, 285083 avg ns
        JS Helper[2460] lock 55fe0cf82690 contended 1 times, 680877 avg ns
        JS Helper[2459] lock 55fe0cf82610 contended 7 times, 4224 avg ns
        chromium-browse[1905434] lock 7ffe573f5358 contended 1 times, 697038 avg ns
        chromium-browse[212592] lock 7ffe573f53c8 contended 4 times, 460601 avg ns
        gnome-shel:cs0[2292] lock 55fe0d0ab76c contended 2 times, 601237648 avg ns
        JS Helper[2460] lock 55fe0cf82610 contended 4 times, 3340 avg ns
        JS Helper[2462] lock 55fe0cf82694 contended 1 times, 237275 avg ns
        chromium-browse[1905605] lock 7ffe573f5358 contended 2 times, 634555 avg ns
        chromium-browse[1905992] lock 7ffe573f5358 contended 1 times, 583965 avg ns
        chromium-browse[1905647] lock 7ffe573f5368 contended 8 times, 549800 avg ns
        JS Helper[2462] lock 55fe0cf82610 contended 2 times, 4694 avg ns
        JS Helper[2461] lock 55fe0cf82694 contended 1 times, 257793 avg ns
        JS Helper[2456] lock 55fe0cf82690 contended 1 times, 677771 avg ns
        JS Helper[2463] lock 55fe0cf82610 contended 3 times, 5139 avg ns
        gdbus[2980] lock 56227f6d0210 contended 2 times, 2465 avg ns
        gnome-shell[2240] lock 55fe0cf82664 contended 5 times, 8036 avg ns
        chromium-browse[1906308] lock 7ffe573f5358 contended 1 times, 210735 avg ns
        JS Helper[2463] lock 55fe0cf82694 contended 1 times, 251531 avg ns
        chromium-browse[1905801] lock 7ffe573f4f58 contended 4 times, 399927 avg ns
        [root@five ~]#
      
      After:
      
        [root@five ~]# perf script report futex-contention
        JS Helper[2457] lock 55fe0cf82610 contended 4 times, 6657 avg ns [max: 11502 ns, min 792 ns]
        ibus-daemon[2975] lock 56227f6d0210 contended 4 times, 1020 avg ns [max: 1813 ns, min 581 ns]
        chromium-browse[1905801] lock 7ffe573f5088 contended 8 times, 108463 avg ns [max: 380103 ns, min 57989 ns]
        gnome-shell[2240] lock 55fe0cf82678 contended 1 times, 8616 avg ns [max: 8616 ns, min 8616 ns]
        gnome-shel:cs0[2292] lock 55fe0d0ab768 contended 3 times, 606016034 avg ns [max: 611295960 ns, min 600191357 ns]
        JS Helper[2458] lock 55fe0cf82690 contended 1 times, 1167840 avg ns [max: 1167840 ns, min 1167840 ns]
        chromium-browse[1905470] lock 7ffe573f5358 contended 1 times, 551504 avg ns [max: 551504 ns, min 551504 ns]
        chromium-browse[1905948] lock 7ffe573f5358 contended 1 times, 577422 avg ns [max: 577422 ns, min 577422 ns]
        gnome-shell[2240] lock 55fe0cf82660 contended 6 times, 202696 avg ns [max: 398998 ns, min 5050 ns]
        pool[2602] lock 7fd600008ef0 contended 1 times, 500046007 avg ns [max: 500046007 ns, min 500046007 ns]
        chromium-browse[1905801] lock 7ffe573f5128 contended 4 times, 285083 avg ns [max: 389531 ns, min 76183 ns]
        JS Helper[2460] lock 55fe0cf82690 contended 1 times, 680877 avg ns [max: 680877 ns, min 680877 ns]
        JS Helper[2459] lock 55fe0cf82610 contended 7 times, 4224 avg ns [max: 12724 ns, min 1012 ns]
        chromium-browse[1905434] lock 7ffe573f5358 contended 1 times, 697038 avg ns [max: 697038 ns, min 697038 ns]
        chromium-browse[212592] lock 7ffe573f53c8 contended 4 times, 460601 avg ns [max: 594956 ns, min 232996 ns]
        gnome-shel:cs0[2292] lock 55fe0d0ab76c contended 2 times, 601237648 avg ns [max: 601255863 ns, min 601219434 ns]
        JS Helper[2460] lock 55fe0cf82610 contended 4 times, 3340 avg ns [max: 9168 ns, min 962 ns]
        JS Helper[2462] lock 55fe0cf82694 contended 1 times, 237275 avg ns [max: 237275 ns, min 237275 ns]
        chromium-browse[1905605] lock 7ffe573f5358 contended 2 times, 634555 avg ns [max: 1024060 ns, min 245050 ns]
        chromium-browse[1905992] lock 7ffe573f5358 contended 1 times, 583965 avg ns [max: 583965 ns, min 583965 ns]
        chromium-browse[1905647] lock 7ffe573f5368 contended 8 times, 549800 avg ns [max: 775293 ns, min 258375 ns]
        JS Helper[2462] lock 55fe0cf82610 contended 2 times, 4694 avg ns [max: 8556 ns, min 832 ns]
        JS Helper[2461] lock 55fe0cf82694 contended 1 times, 257793 avg ns [max: 257793 ns, min 257793 ns]
        JS Helper[2456] lock 55fe0cf82690 contended 1 times, 677771 avg ns [max: 677771 ns, min 677771 ns]
        JS Helper[2463] lock 55fe0cf82610 contended 3 times, 5139 avg ns [max: 6873 ns, min 931 ns]
        gdbus[2980] lock 56227f6d0210 contended 2 times, 2465 avg ns [max: 4188 ns, min 742 ns]
        gnome-shell[2240] lock 55fe0cf82664 contended 5 times, 8036 avg ns [max: 13105 ns, min 401 ns]
        chromium-browse[1906308] lock 7ffe573f5358 contended 1 times, 210735 avg ns [max: 210735 ns, min 210735 ns]
        JS Helper[2463] lock 55fe0cf82694 contended 1 times, 251531 avg ns [max: 251531 ns, min 251531 ns]
        chromium-browse[1905801] lock 7ffe573f4f58 contended 4 times, 399927 avg ns [max: 476904 ns, min 178495 ns]
        [root@five ~]#
      Signed-off-by: NHagen Paul Pfeifer <hagen@jauu.net>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Link: http://lore.kernel.org/lkml/20200922200922.1306034-1-hagen@jauu.netSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      69f48c70
    • H
      perf script: Autopep8 futex-contention · 2a684fcb
      Hagen Paul Pfeifer 提交于
      10 years leaves its mark! Python has evolved and so has its style guide.
      Even with vim it is getting hard to follow the no longer valid
      guidelines (spaces vs. tabs).
      
      Autopep8 this code to modernize it!
      Signed-off-by: NHagen Paul Pfeifer <hagen@jauu.net>
      Link: http://lore.kernel.org/lkml/20200921201928.799498-1-hagen@jauu.netSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      2a684fcb
  3. 03 7月, 2020 5 次提交
    • A
      perf scripts python: exported-sql-viewer.py: Fix time chart call tree · f18d5cf8
      Adrian Hunter 提交于
      Using Python version 3.8.2 and PySide2 version 5.14.0, time chart call tree
      would not expand the tree to the result. Fix by using setExpanded().
      
      Example:
      
        $ perf record -e intel_pt//u uname
        Linux
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.034 MB perf.data ]
        $ perf script --itrace=bep -s ~/libexec/perf-core/scripts/python/export-to-sqlite.py perf.data.db branches calls
        2020-06-26 15:32:14.928997 Creating database ...
        2020-06-26 15:32:14.933971 Writing records...
        2020-06-26 15:32:15.535251 Adding indexes
        2020-06-26 15:32:15.542993 Dropping unused tables
        2020-06-26 15:32:15.549716 Done
        $ python3 ~/libexec/perf-core/scripts/python/exported-sql-viewer.py perf.data.db
      
        Select: Charts -> Time chart by CPU
        Move mouse over middle of chart
        Right-click and select Show Call Tree
      
      Before: displays Call Tree but not expanded to selected time
      After: displays Call Tree expanded to selected time
      
      Fixes: e69d5df7 ("perf scripts python: exported-sql-viewer.py: Add ability for Call tree to open at a specified task and time")
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: stable@vger.kernel.org
      Link: http://lore.kernel.org/lkml/20200629091955.17090-7-adrian.hunter@intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      f18d5cf8
    • A
      perf scripts python: exported-sql-viewer.py: Fix zero id in call tree 'Find' result · 031c8d5e
      Adrian Hunter 提交于
      Using ctrl-F ('Find') would not find 'unknown' because it matches id
      zero.  Fix by excluding id zero from selection.
      
      Example:
      
         $ perf record -e intel_pt//u uname
         Linux
         [ perf record: Woken up 1 times to write data ]
         [ perf record: Captured and wrote 0.034 MB perf.data ]
         $ perf script --itrace=bep -s ~/libexec/perf-core/scripts/python/export-to-sqlite.py perf.data.db branches calls
         2020-06-26 15:32:14.928997 Creating database ...
         2020-06-26 15:32:14.933971 Writing records...
         2020-06-26 15:32:15.535251 Adding indexes
         2020-06-26 15:32:15.542993 Dropping unused tables
         2020-06-26 15:32:15.549716 Done
         $ python3 ~/libexec/perf-core/scripts/python/exported-sql-viewer.py perf.data.db
      
         Select: Reports -> Call Tree
         Press: Ctrl-F
         Enter: unknown
         Press: Enter
      
      Before: displays 'unknown' not found
      After: tree is expanded to line showing 'unknown'
      
      Fixes: ae8b887c ("perf scripts python: exported-sql-viewer.py: Add call tree")
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: stable@vger.kernel.org
      Link: http://lore.kernel.org/lkml/20200629091955.17090-6-adrian.hunter@intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      031c8d5e
    • A
      perf scripts python: exported-sql-viewer.py: Fix zero id in call graph 'Find' result · 7ff520b0
      Adrian Hunter 提交于
      Using ctrl-F ('Find') would not find 'unknown' because it matches id zero.
      Fix by excluding id zero from selection.
      
      Example:
      
        $ perf record -e intel_pt//u uname
        Linux
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.034 MB perf.data ]
        $ perf script --itrace=bep -s ~/libexec/perf-core/scripts/python/export-to-sqlite.py perf.data.db branches calls
        2020-06-26 15:32:14.928997 Creating database ...
        2020-06-26 15:32:14.933971 Writing records...
        2020-06-26 15:32:15.535251 Adding indexes
        2020-06-26 15:32:15.542993 Dropping unused tables
        2020-06-26 15:32:15.549716 Done
        $ python3 ~/libexec/perf-core/scripts/python/exported-sql-viewer.py perf.data.db
      
        Select: Reports -> Context-Sensitive Call Graph
        Press: Ctrl-F
        Enter: unknown
        Press: Enter
      
      Before: gets stuck
      After: tree is expanded to line showing 'unknown'
      
      Fixes: 254c0d82 ("perf scripts python: exported-sql-viewer.py: Factor out CallGraphModelBase")
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: stable@vger.kernel.org
      Link: http://lore.kernel.org/lkml/20200629091955.17090-5-adrian.hunter@intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      7ff520b0
    • A
      perf scripts python: exported-sql-viewer.py: Fix unexpanded 'Find' result · 3a3cf7c5
      Adrian Hunter 提交于
      Using Python version 3.8.2 and PySide2 version 5.14.0, ctrl-F ('Find')
      would not expand the tree to the result. Fix by using setExpanded().
      
      Example:
      
        $ perf record -e intel_pt//u uname
        Linux
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.034 MB perf.data ]
        $ perf script --itrace=bep -s ~/libexec/perf-core/scripts/python/export-to-sqlite.py perf.data.db branches calls
        2020-06-26 15:32:14.928997 Creating database ...
        2020-06-26 15:32:14.933971 Writing records...
        2020-06-26 15:32:15.535251 Adding indexes
        2020-06-26 15:32:15.542993 Dropping unused tables
        2020-06-26 15:32:15.549716 Done
        $ python3 ~/libexec/perf-core/scripts/python/exported-sql-viewer.py perf.data.db
      
        Select: Reports -> Context-Sensitive Call Graph    or     Reports -> Call Tree
        Press: Ctrl-F
        Enter: main
        Press: Enter
      
      Before: line showing 'main' does not display
      
      After: tree is expanded to line showing 'main'
      
      Fixes: ebd70c7d ("perf scripts python: exported-sql-viewer.py: Add ability to find symbols in the call-graph")
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: stable@vger.kernel.org
      Link: http://lore.kernel.org/lkml/20200629091955.17090-4-adrian.hunter@intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      3a3cf7c5
    • A
      perf scripts python: export-to-postgresql.py: Fix struct.pack() int argument · 640432e6
      Adrian Hunter 提交于
      Python 3.8 is requiring that arguments being packed as integers are also
      integers.  Add int() accordingly.
      
       Before:
      
         $ perf record -e intel_pt//u uname
         $ perf script --itrace=bep -s ~/libexec/perf-core/scripts/python/export-to-postgresql.py perf_data_db branches calls
         2020-06-25 16:09:10.547256 Creating database...
         2020-06-25 16:09:10.733185 Writing to intermediate files...
         Traceback (most recent call last):
           File "/home/ahunter/libexec/perf-core/scripts/python/export-to-postgresql.py", line 1106, in synth_data
             cbr(id, raw_buf)
           File "/home/ahunter/libexec/perf-core/scripts/python/export-to-postgresql.py", line 1058, in cbr
             value = struct.pack("!hiqiiiiii", 4, 8, id, 4, cbr, 4, MHz, 4, percent)
         struct.error: required argument is not an integer
         Fatal Python error: problem in Python trace event handler
         Python runtime state: initialized
      
         Current thread 0x00007f35d3695780 (most recent call first):
         <no Python frame>
         Aborted (core dumped)
      
       After:
      
         $ dropdb perf_data_db
         $ rm -rf perf_data_db-perf-data
         $ perf script --itrace=bep -s ~/libexec/perf-core/scripts/python/export-to-postgresql.py perf_data_db branches calls
         2020-06-25 16:09:40.990267 Creating database...
         2020-06-25 16:09:41.207009 Writing to intermediate files...
         2020-06-25 16:09:41.270915 Copying to database...
         2020-06-25 16:09:41.382030 Removing intermediate files...
         2020-06-25 16:09:41.384630 Adding primary keys
         2020-06-25 16:09:41.541894 Adding foreign keys
         2020-06-25 16:09:41.677044 Dropping unused tables
         2020-06-25 16:09:41.703761 Done
      
      Fixes: aba44287 ("perf scripts python: export-to-postgresql.py: Export Intel PT power and ptwrite events")
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: stable@vger.kernel.org
      Link: http://lore.kernel.org/lkml/20200629091955.17090-2-adrian.hunter@intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      640432e6
  4. 23 6月, 2020 1 次提交
  5. 06 5月, 2020 1 次提交
    • A
      perf flamegraph: Use /bin/bash for report and record scripts · 19ce2321
      Arnaldo Carvalho de Melo 提交于
      As all the other tools/perf/scripts/python/bin/*-{report,record}
      scripts, fixing the this problem reported by Daniel Diaz:
      
        Our OpenEmbedded builds detected an issue with 5287f926 ("perf
        script: Add flamegraph.py script"):
          ERROR: perf-1.0-r9 do_package_qa: QA Issue:
        /usr/libexec/perf-core/scripts/python/bin/flamegraph-report contained
        in package perf-python requires /usr/bin/sh, but no providers found in
        RDEPENDS_perf-python? [file-rdeps]
      
        This means that there is a new binary pulled in in the shebang line
        which was unaccounted for: `/usr/bin/sh`. I don't see any other usage
        of /usr/bin/sh in the kernel tree (does not even exist on my Ubuntu
        dev machine) but plenty of /bin/sh. This patch is needed:
        -----8<----------8<----------8<-----
        diff --git a/tools/perf/scripts/python/bin/flamegraph-record
        b/tools/perf/scripts/python/bin/flamegraph-record
        index 725d66e71570..a2f3fa25ef81 100755
        --- a/tools/perf/scripts/python/bin/flamegraph-record
        +++ b/tools/perf/scripts/python/bin/flamegraph-record
        @@ -1,2 +1,2 @@
        -#!/usr/bin/sh
        +#!/bin/sh
         perf record -g "$@"
        diff --git a/tools/perf/scripts/python/bin/flamegraph-report
        b/tools/perf/scripts/python/bin/flamegraph-report
        index b1a79afd903b..b0177355619b 100755
        --- a/tools/perf/scripts/python/bin/flamegraph-report
        +++ b/tools/perf/scripts/python/bin/flamegraph-report
        @@ -1,3 +1,3 @@
        -#!/usr/bin/sh
        +#!/bin/sh
         # description: create flame graphs
         perf script -s "$PERF_EXEC_PATH"/scripts/python/flamegraph.py -- "$@"
        ----->8---------->8---------->8-----
      
      Fixes: 5287f926 ("perf script: Add flamegraph.py script")
      Reported-by: NDaniel Díaz <daniel.diaz@linaro.org>
      Acked-by: NAndreas Gerstmayr <agerstmayr@redhat.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: lkft-triage@lists.linaro.org
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: http://lore.kernel.org/lkml/CAEUSe7_wmKS361mKLTB1eYbzYXcKkXdU26BX5BojdKRz8MfPCw@mail.gmail.com
      Link: http://lore.kernel.org/lkml/20200505170320.GZ30487@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      19ce2321
  6. 16 4月, 2020 1 次提交
    • A
      perf script: Add flamegraph.py script · 5287f926
      Andreas Gerstmayr 提交于
      This script works in tandem with d3-flame-graph to generate flame graphs
      from perf. It supports two output formats: JSON and HTML (the default).
      The HTML format will look for a standalone d3-flame-graph template file
      in /usr/share/d3-flame-graph/d3-flamegraph-base.html and fill in the
      collected stacks.
      
      Usage:
      
          perf record -a -g -F 99 sleep 60
          perf script report flamegraph
      
      Combined:
      
          perf script flamegraph -a -F 99 sleep 60
      
      Committer testing:
      
      Tested both with "PYTHON=python3" and with the default, that uses
      python2-devel:
      
      Complete set of instructions:
      
        $ mkdir /tmp/build/perf
        $ make PYTHON=python3 -C tools/perf O=/tmp/build/perf install-bin
        $ export PATH=~/bin:$PATH
        $ perf record -a -g -F 99 sleep 60
        $ perf script report flamegraph
      
      Now go and open the generated flamegraph.html file in a browser.
      
      At first this required building with PYTHON=python3, but after I
      reported this Andreas was kind enough to send a patch making it work
      with both python and python3.
      Signed-off-by: NAndreas Gerstmayr <agerstmayr@redhat.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.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>
      Cc: Brendan Gregg <bgregg@netflix.com>
      Cc: Martin Spier <mspier@netflix.com>
      Link: http://lore.kernel.org/lkml/20200320151355.66302-1-agerstmayr@redhat.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      5287f926
  7. 13 11月, 2019 1 次提交
  8. 07 10月, 2019 6 次提交
  9. 30 8月, 2019 1 次提交
  10. 11 7月, 2019 1 次提交
  11. 10 7月, 2019 7 次提交
  12. 09 7月, 2019 2 次提交
  13. 25 6月, 2019 2 次提交
  14. 05 6月, 2019 7 次提交
    • A
      perf scripts python: exported-sql-viewer.py: Select find text when find bar is activated · 80b3fb64
      Adrian Hunter 提交于
      The user probably wants to replace the find text, so select the find
      text when the find bar is activated.
      
      That is fairly standard behaviour for search text entry.
      
      Entering text will replace the current text, but using edit keys
      (arrows, home, end etc) cancels the selection and enables editing.
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Link: http://lkml.kernel.org/r/20190520113728.14389-23-adrian.hunter@intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      80b3fb64
    • A
      perf scripts python: exported-sql-viewer.py: Add IPC information to Call Tree · b3b66079
      Adrian Hunter 提交于
      Enhance the call tree to display IPC information if it is available.
      
      Committer testing:
      
      [acme@quaco adrian.hunter]$ python ~acme/libexec/perf-core/scripts/python/exported-sql-viewer.py ~/c/adrian.hunter/simple-retpoline.db
      
      Reports -> Call Tree, then expand a few trees, then select with the
      mouse and press control+C (copy):
      
      Call Path                   Object        Call Time Time  Time(%) Insn  Insn   Cyc   Cyc   IPC Branch Branch
      ▼ simple-retpolin                                   (ns)          Cnt   Cnt(%) Cnt   Cnt(%)     Count Count(%)
        ▼ 23003:23003
          ▼ _start                ld-2.28.so    112195670 218295 100.0 127746 100.0 207320 100.0 0.62 13046 100.0
             unknown             unknown       112195987   3202   1.5      0   0.0      0   0.0    0     1   0.0
             _dl_start           ld-2.28.so    112199189 188471  86.3 123394  96.6 180007  86.8 0.69 12529  96.0
            ▼ _dl_init            ld-2.28.so    112387660  13406   6.1   3207   2.5  14868   7.2 0.22   327   2.5
               call_init.part.0  ld-2.28.so    112387773    117   0.9     70   2.2    639   4.3 0.11     3   0.9
               call_init.part.0  ld-2.28.so    112387890  13129  97.9   3103  96.8  14100  94.8 0.22   315  96.3
               call_init.part.0  ld-2.28.so    112401020      0   0.0      0   0.0      0   0.0    0     2   0.6
            ▼ _start              simple-retpol 112401066  12899   5.9   1142   0.9  11561   5.6 0.10   184   1.4
               unknown           unknown       112401388    846   6.6      0   0.0      0   0.0    0     1   0.5
              ▼ __libc_start_main libc-2.28.so  112402344  11621  90.1   1129  98.9  10350  89.5 0.11   181  98.4
                 __cxa_atexit    libc-2.28.so  112402360   2302  19.8    101   8.9   1817  17.6 0.06    13   7.2
                 __libc_csu_init simple-retpol 112404673    121   1.0     43   3.8    340   3.3 0.13     8   4.4
                 _setjmp         libc-2.28.so  112404794     74   0.6     46   4.1    206   2.0 0.22     4   2.2
                ▼ main            simple-retpol 112404892     44   0.4     23   2.0    126   1.2 0.18    12   6.6
                  ▼ foo           simple-retpol 112404892     19  43.2     12  52.2     55  43.7 0.22     5  41.7
                      bar         simple-retpol 112404896     12  63.2      3  25.0     34  61.8 0.09     1  20.0
                  ▼ foo           simple-retpol 112404911     25  56.8     11  47.8     71  56.3 0.15     5  41.7
                     bar         simple-retpol 112404924     10  40.0      3  27.3     27  38.0 0.11     1  20.0
                 exit            libc-2.28.so  112404936   9029  77.7    878  77.8   7765  75.0 0.11   139  76.8
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Link: http://lkml.kernel.org/r/20190520113728.14389-22-adrian.hunter@intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      b3b66079
    • A
      perf scripts python: exported-sql-viewer.py: Add IPC information to Call Graph Graph · 38a846d4
      Adrian Hunter 提交于
      Enhance the call graph to display IPC information if it is available.
      
      Committer testing:
      
      [acme@quaco adrian.hunter]$ python ~acme/libexec/perf-core/scripts/python/exported-sql-viewer.py ~/c/adrian.hunter/simple-retpoline.db
      
      Reports -> Context Sensitive Callgraph, then expand a few trees, then
      select with the mouse and press control+C:
      
      Call Path                     Object          Count Time(ns) Time(%) Insn Insn   Cyc   Cyc    IPC Branch Branch
      ▼ simple-retpolin                                                    Cnt  Cnt(%) Cnt   Cnt(%)     Cnt    Cnt(%)
        ▼ 23003:23003
          ▼ _start                  ld-2.28.so         1 218295   100.0  127746 100.0 207320 100.0 0.62 13046  100.0
             unknown               unknown            1   3202     1.5       0   0.0      0   0.0    0     1    0.0
             _dl_start             ld-2.28.so         1 188471    86.3  123394  96.6 180007  86.8 0.69 12529   96.0
             _dl_init              ld-2.28.so         1  13406     6.1    3207   2.5  14868   7.2 0.22   327    2.5
            ▼ _start                simple-retpoline   1  12899     5.9    1142   0.9  11561   5.6 0.10   184    1.4
               unknown             unknown            1    846     6.6       0   0.0      0   0.0    0     1    0.5
              ▼ __libc_start_main   libc-2.28.so       1  11621    90.1    1129  98.9  10350  89.5 0.11   181   98.4
                 __cxa_atexit      libc-2.28.so       1   2302    19.8     101   8.9   1817  17.6 0.06    13    7.2
                 __libc_csu_init   simple-retpoline   1    121     1.0      43   3.8    340   3.3 0.13     8    4.4
                ▼ _setjmp           libc-2.28.so       1     74     0.6      46   4.1    206   2.0 0.22     4    2.2
                  ▼ __sigsetjmp     libc-2.28.so       1     74   100.0      46 100.0    206 100.0 0.22     3   75.0
                     __sigjmp_save libc-2.28.so       1      0     0.0       0   0.0      0   0.0    0     1   33.3
                ▼ main              simple-retpoline   1     44     0.4      23   2.0    126   1.2 0.18    12    6.6
                  ▼ foo             simple-retpoline   2     44   100.0      23 100.0    126 100.0 0.18    10   83.3
                      bar           simple-retpoline   2     22    50.0       6  26.1     61  48.4 0.10     2   20.0
                 exit              libc-2.28.so       1   9029    77.7     878  77.8   7765  75.0 0.11   139   76.8
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Link: http://lkml.kernel.org/r/20190520113728.14389-21-adrian.hunter@intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      38a846d4
    • A
      perf scripts python: exported-sql-viewer.py: Add CallGraphModelParams · 4a0979d4
      Adrian Hunter 提交于
      Add a parameter to call graph and call tree, to determine whether IPC
      information is available.
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Link: http://lkml.kernel.org/r/20190520113728.14389-20-adrian.hunter@intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      4a0979d4
    • A
      perf scripts python: exported-sql-viewer.py: Add IPC information to the Branch reports · 530e22fd
      Adrian Hunter 提交于
      Enhance the "All branches" and "Selected branches" reports to display IPC
      information if it is available.
      
      Committer testing:
      
      So, testing this I noticed that it all starts with the left arrow in every
      line, that should mean there is some tree there, i.e. look at all those 
      symbols:
      
      Reports -> All Branches:
      
      Time              CPU Command         PID   TID   Branch Type  In Tx  Insn Cnt  Cyc Cnt  IPC  Branch
       187836112195670 7   simple-retpolin 23003 23003 trace begin  No     0         0        0               0 unknown (unknown) -> 7f6f33d4f110
      +_start (ld-2.28.so)
       187836112195987 7   simple-retpolin 23003 23003 trace end    No     0         883      0    7f6f33d4f110 _start (ld-2.28.so) -> 0 unknown
      +(unknown)
       187836112199189 7   simple-retpolin 23003 23003 trace begin  No     0         0        0               0 unknown (unknown) -> 7f6f33d4f110
      +_start (ld-2.28.so)
       187836112199189 7   simple-retpolin 23003 23003 call         No     0         0        0    7f6f33d4f113 _start+0x3 (ld-2.28.so) -> 7f6f33d4ff50
      +_dl_start (ld-2.28.so)
       187836112199544 7   simple-retpolin 23003 23003 trace end    No     17        996      0.02 7f6f33d4ff73 _dl_start+0x23 (ld-2.28.so) -> 0
      +unknown (unknown)
       187836112200939 7   simple-retpolin 23003 23003 trace begin  No     0         0        0               0 unknown (unknown) -> 7f6f33d4ff73
      +_dl_start+0x23 (ld-2.28.so)
       187836112201229 7   simple-retpolin 23003 23003 trace end    No     1         816      0.00 7f6f33d4ff7a _dl_start+0x2a (ld-2.28.so) -> 0
      +unknown (unknown)
       187836112203500 7   simple-retpolin 23003 23003 trace begin  No     0         0        0               0 unknown (unknown) -> 7f6f33d4ff7a
      +_dl_start+0x2a (ld-2.28.so)
      
      But if you click on it, that  disappears and a new click doesn't make
      it reappear, looks buggy, minor oddity, reported to Adrian.
      
      Reports -> Selected Branches, then ask for branches in the ld-2.28.so
      DSO:
      
      Time               CPU  Command          PID    TID    Branch Type        In Tx  Insn Cnt  Cyc Cnt  IPC   Branch
       187836112195987  7    simple-retpolin  23003  23003  trace end          No     0         883      0     7f6f33d4f110 _start (ld-2.28.so) -> 0 unknown (unknown)
       187836112199189  7    simple-retpolin  23003  23003  trace begin        No     0         0        0                0 unknown (unknown) -> 7f6f33d4f110 _start (ld-2.28.so)
       187836112199189  7    simple-retpolin  23003  23003  call               No     0         0        0     7f6f33d4f113 _start+0x3 (ld-2.28.so) -> 7f6f33d4ff50 _dl_start (ld-2.28.so)
       187836112199544  7    simple-retpolin  23003  23003  trace end          No     17        996      0.02  7f6f33d4ff73 _dl_start+0x23 (ld-2.28.so) -> 0 unknown (unknown)
       187836112200939  7    simple-retpolin  23003  23003  trace begin        No     0         0        0                0 unknown (unknown) -> 7f6f33d4ff73 _dl_start+0x23 (ld-2.28.so)
       187836112201229  7    simple-retpolin  23003  23003  trace end          No     1         816      0.00  7f6f33d4ff7a _dl_start+0x2a (ld-2.28.so) -> 0 unknown (unknown)
       187836112203500  7    simple-retpolin  23003  23003  trace begin        No     0         0        0                0 unknown (unknown) -> 7f6f33d4ff7a _dl_start+0x2a (ld-2.28.so)
       187836112203528  7    simple-retpolin  23003  23003  unconditional jump No     0         0        0     7f6f33d4ffe7 _dl_start+0x97 (ld-2.28.so) -> 7f6f33d5000b _dl_start+0xbb (ld-2.28.so)
       187836112203528  7    simple-retpolin  23003  23003  conditional jump   No     0         0        0     7f6f33d5000f _dl_start+0xbf (ld-2.28.so) -> 7f6f33d4fffb _dl_start+0xab (ld-2.28.so)
       187836112203528  7    simple-retpolin  23003  23003  conditional jump   No     0         0        0     7f6f33d5000f _dl_start+0xbf (ld-2.28.so) -> 7f6f33d4fffb _dl_start+0xab (ld-2.28.so)
       187836112203539  7    simple-retpolin  23003  23003  conditional jump   No     0         0        0     7f6f33d50025 _dl_start+0xd5 (ld-2.28.so) -> 7f6f33d50210 _dl_start+0x2c0 (ld-2.28.so)
       187836112203539  7    simple-retpolin  23003  23003  conditional jump   No     0         0        0     7f6f33d5021a _dl_start+0x2ca (ld-2.28.so) -> 7f6f33d50360 _dl_start+0x410 (ld-2.28.so)
       187836112203539  7    simple-retpolin  23003  23003  unconditional jump No     0         0        0     7f6f33d50377 _dl_start+0x427 (ld-2.28.so) -> 7f6f33d4ffff _dl_start+0xaf (ld-2.28.so)
       187836112203539  7    simple-retpolin  23003  23003  conditional jump   No     0         0        0     7f6f33d5000f _dl_start+0xbf (ld-2.28.so) -> 7f6f33d4fffb _dl_start+0xab (ld-2.28.so)
       187836112203562  7    simple-retpolin  23003  23003  conditional jump   No     0         0        0     7f6f33d5000f _dl_start+0xbf (ld-2.28.so) -> 7f6f33d4fffb _dl_start+0xab (ld-2.28.so)
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Link: http://lkml.kernel.org/r/20190520113728.14389-19-adrian.hunter@intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      530e22fd
    • A
      perf scripts python: export-to-postgresql.py: Export IPC information · ec7f448e
      Adrian Hunter 提交于
      Export cycle and instruction counts on samples and calls tables.
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Link: http://lkml.kernel.org/r/20190520113728.14389-18-adrian.hunter@intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      ec7f448e
    • A
      perf scripts python: export-to-sqlite.py: Export IPC information · 64adadb3
      Adrian Hunter 提交于
      Export cycle and instruction counts on samples and calls tables.
      
      Committer testing:
      
      First runs some workload collecting intel_pt with the 'cyc' ter just for
      userspace:
      
        [root@quaco adrian.hunter]# perf record -o simple-retpoline.perf.data -e intel_pt/cyc/u ./simple-retpoline
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.035 MB simple-retpoline.perf.data ]
        [root@quaco adrian.hunter]#
      
      Then use the export-to-sqlite.py script to see if the changes in this
      cset don't make it to break and if the changes in the db schema are the
      ones expected:
      
        [root@quaco adrian.hunter]# perf script -i simple-retpoline.perf.data --itrace=be -s ~acme/libexec/perf-core/scripts/python/export-to-sqlite.py simple-retpoline.db branches calls
        2019-05-31 11:50:46.942710 Creating database ...
        2019-05-31 11:50:46.949663 Writing records...
        2019-05-31 11:50:47.224033 Adding indexes
        2019-05-31 11:50:47.231599 Done
        [root@quaco adrian.hunter]#
      
      Now lets use the db:
      
        [root@quaco adrian.hunter]# sqlite3 simple-retpoline.db
        SQLite version 3.26.0 2018-12-01 12:34:55
        Enter ".help" for usage hints.
        sqlite> .schema samples
        CREATE TABLE samples (id integer NOT NULL PRIMARY KEY,evsel_id bigint,machine_id bigint,thread_id bigint,comm_id bigint,dso_id bigint,symbol_id bigint,sym_offset bigint,ip bigint,time bigint,cpuinteger,to_dso_id bigint,to_symbol_id bigint,to_sym_offset bigint,to_ip bigint,branch_type integer,in_tx boolean,call_path_id bigint,insn_count bigint,cyc_count bigint);
        sqlite>
      
      Cool, the 'insn_count' and 'cyc_count' are there, now lets see if we can
      use them in a query:
      
        sqlite> select insn_count,cyc_count from samples where cyc_count > 1500 and insn_count < 10;
        6|1507
        sqlite> select insn_count,cyc_count from samples where cyc_count > 1500;
        118|2210
        140|1516
        3783|1861
        132|1521
        6|1507
        sqlite>
      
      Seems to work :-)
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Link: http://lkml.kernel.org/r/20190520113728.14389-17-adrian.hunter@intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      64adadb3