<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/linux.git/tools/perf/scripts/python/bin, branch v6.19.10</title>
<subtitle>Linux Kernel
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v6.19.10</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v6.19.10'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/'/>
<updated>2025-02-19T00:12:19Z</updated>
<entry>
<title>perf script: Fix hangup in offline flamegraph report</title>
<updated>2025-02-19T00:12:19Z</updated>
<author>
<name>Namhyung Kim</name>
<email>namhyung@kernel.org</email>
</author>
<published>2025-02-19T00:05:58Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=29bab85418efd329c1a984fc9b885b6709481b27'/>
<id>urn:sha1:29bab85418efd329c1a984fc9b885b6709481b27</id>
<content type='text'>
A recent change in the flamegraph script fixed an issue with live mode
but it created another for offline mode.  It needs to pass "-" to -i
option to read from stdin in the live mode.  Actually there's a logic
to pass the option in the perf script code, but the script was written
with "-- $@" which prevented the option to go to the perf script.  So
the previous commit added the hard-coded "-i -" to the report command.

But it's a problem for the offline mode which expects input from a file
and now it's stuck on reading from stdin.  Let's remove the "-i - --"
part and let it pass the options properly to perf script.

Closes: https://lore.kernel.org/linux-perf-users/c41e4b04-e1fd-45ab-80b0-ec2ac6e94310@linux.ibm.com
Fixes: 23e0a63c6dd3f69c ("perf script: force stdin for flamegraph in live mode")
Reported-by: Thomas Richter &lt;tmricht@linux.ibm.com&gt;
Tested-by: Thomas Richter &lt;tmricht@linux.ibm.com&gt;
Cc: Anubhav Shelat &lt;ashelat@redhat.com&gt;
Signed-off-by: Namhyung Kim &lt;namhyung@kernel.org&gt;
</content>
</entry>
<entry>
<title>perf script: force stdin for flamegraph in live mode</title>
<updated>2025-02-04T03:49:10Z</updated>
<author>
<name>Anubhav Shelat</name>
<email>ashelat@redhat.com</email>
</author>
<published>2025-01-31T14:57:05Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=23e0a63c6dd3f69cb7ee18411e5f6857cca55b30'/>
<id>urn:sha1:23e0a63c6dd3f69cb7ee18411e5f6857cca55b30</id>
<content type='text'>
Currently, running "perf script flamegraph -a -F 99 sleep 1" should
produce flamegraph.html containing the flamegraph. Howevever, it gives a
segmentation fault.

This is caused because the flamegraph.py script is
supposed to take as input the output of "perf record", which should be
in stdin. This would require passing "-i -" to flamegraph.py. However,
the "flamegraph-report" script causes "perf script" command to take the
"-i -" option instead of flamegraph.py, which causes no problem for
"perf script", but causes a seg fault since flamegraph.py has no input
file. To fix this I added the "-i -" option directly to the
flamegraph-report script to ensure flamegraph.py gets input from stdin.

Signed-off-by: Anubhav Shelat &lt;ashelat@redhat.com&gt;
Tested-by: Michael Petlan &lt;mpetlan@redhat.com&gt;
Link: https://lore.kernel.org/r/20250131145704.3164542-2-ashelat@redhat.com
Signed-off-by: Namhyung Kim &lt;namhyung@kernel.org&gt;
</content>
</entry>
<entry>
<title>perf scripts python: Add support for input args in gecko script</title>
<updated>2023-08-24T17:39:43Z</updated>
<author>
<name>Anup Sharma</name>
<email>anupnewsmail@gmail.com</email>
</author>
<published>2023-08-12T21:36:27Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=43803cb16f997794a256483f29beb68abef2fa9e'/>
<id>urn:sha1:43803cb16f997794a256483f29beb68abef2fa9e</id>
<content type='text'>
Refines the argument handling mechanism in the "gecko-report" script to
enable better compatibility and improved user experience.

The script now differentiates between scenarios where arguments are
provided for record and report cases where gecko.py arguments are
passed.

Signed-off-by: Anup Sharma &lt;anupnewsmail@gmail.com&gt;
Cc: Adrian Hunter &lt;adrian.hunter@intel.com&gt;
Cc: Alexander Shishkin &lt;alexander.shishkin@linux.intel.com&gt;
Cc: Ian Rogers &lt;irogers@google.com&gt;
Cc: Ingo Molnar &lt;mingo@redhat.com&gt;
Cc: Jiri Olsa &lt;jolsa@kernel.org&gt;
Cc: Mark Rutland &lt;mark.rutland@arm.com&gt;
Cc: Namhyung Kim &lt;namhyung@kernel.org&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Link: https://lore.kernel.org/r/ZNf7W+EIrrCSHZN0@yoga
Signed-off-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
</content>
</entry>
<entry>
<title>perf scripts python: Add command execution for gecko script</title>
<updated>2023-07-28T22:01:16Z</updated>
<author>
<name>Anup Sharma</name>
<email>anupnewsmail@gmail.com</email>
</author>
<published>2023-07-21T17:57:46Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=f9f72b2ab77e986ac30de09a735a002b37d81503'/>
<id>urn:sha1:f9f72b2ab77e986ac30de09a735a002b37d81503</id>
<content type='text'>
This will enable the execution of gecko.py script using record and
report commands in 'perf script'.  And this will be also reflected at
"perf script -l" command.

For Example:
    perf script record gecko
    perf script report gecko

Committer notes:

As discussed on the perf tools office hours, I made -F 99 the default
for the record script and removed the double -- on the report script so
that the existing 'perf script' protocol for the combined operation:

    # perf script gecko

Works, i.e. the record script pipes its stdout into the stdin of the
report script, basically:

  /bin/sh /usr/libexec/perf-core/scripts/python/bin/gecko-record -F 99 -g -a -q -o - | \
  /bin/sh /usr/libexec/perf-core/scripts/python/bin/gecko-report -i -

Testing it:

The resulting JSON file needs to be uploaded to
https://profiler.firefox.com, Anup already has code to start a local
http server on the trace_begin handler of the gecko python script, start
firefox and feed it the JSON.

The example below only collects sample for the specified workload, so
that we don't produce thousands of lines, to collect system wide
samples, use instead:

  # perf script gecko -a sleep 0.5

  # nohup perf script gecko sleep 0.5
  {
    "meta": {
      "interval": 1,
      "processType": 0,
      "product": "x86_64 GNU/Linux",
      "stackwalk": 1,
      "debug": 0,
      "gcpoison": 0,
      "asyncstack": 1,
      "startTime": 274601692.636,
      "shutdownTime": null,
      "version": 24,
      "presymbolicated": true,
      "categories": [
        {
          "name": "User",
          "color": "yellow",
          "subcategories": [
            "Other"
          ]
        },
        {
          "name": "Kernel",
          "color": "orange",
          "subcategories": [
            "Other"
          ]
        }
      ],
      "markerSchema": []
    },
    "libs": [],
    "threads": [
      {
        "tid": 3344498,
        "pid": 3344498,
        "name": "sleep",
        "markers": {
          "schema": {
            "name": 0,
            "startTime": 1,
            "endTime": 2,
            "phase": 3,
            "category": 4,
            "data": 5
          },
          "data": []
        },
        "samples": {
          "schema": {
            "stack": 0,
            "time": 1,
            "responsiveness": 2
          },
          "data": [
            [
              21,
              274601692.636,
              0
            ],
            [
              23,
              274601692.641,
              0
            ],
            [
              29,
              274601692.643,
              0
            ],
            [
              42,
              274601692.648,
              0
            ]
          ]
        },
        "frameTable": {
          "schema": {
            "location": 0,
            "relevantForJS": 1,
            "innerWindowID": 2,
            "implementation": 3,
            "optimizations": 4,
            "line": 5,
            "column": 6,
            "category": 7,
            "subcategory": 8
          },
          "data": [
            [
              0,
              false,
              0,
              null,
              null,
              null,
              null,
              1,
              null
            ],
            [
              1,
              false,
              0,
              null,
              null,
              null,
              null,
              1,
              null
            ],
            [
              2,
              false,
              0,
              null,
              null,
              null,
              null,
              1,
              null
            ],
            [
              3,
              false,
              0,
              null,
              null,
              null,
              null,
              1,
              null
            ],
            [
              4,
              false,
              0,
              null,
              null,
              null,
              null,
              1,
              null
            ],
            [
              5,
              false,
              0,
              null,
              null,
              null,
              null,
              1,
              null
            ],
            [
              6,
              false,
              0,
              null,
              null,
              null,
              null,
              1,
              null
            ],
            [
              7,
              false,
              0,
              null,
              null,
              null,
              null,
              1,
              null
            ],
            [
              8,
              false,
              0,
              null,
              null,
              null,
              null,
              1,
              null
            ],
            [
              9,
              false,
              0,
              null,
              null,
              null,
              null,
              1,
              null
            ],
            [
              10,
              false,
              0,
              null,
              null,
              null,
              null,
              1,
              null
            ],
            [
              11,
              false,
              0,
              null,
              null,
              null,
              null,
              1,
              null
            ],
            [
              12,
              false,
              0,
              null,
              null,
              null,
              null,
              1,
              null
            ],
            [
              13,
              false,
              0,
              null,
              null,
              null,
              null,
              1,
              null
            ],
            [
              14,
              false,
              0,
              null,
              null,
              null,
              null,
              1,
              null
            ],
            [
              15,
              false,
              0,
              null,
              null,
              null,
              null,
              1,
              null
            ],
            [
              16,
              false,
              0,
              null,
              null,
              null,
              null,
              1,
              null
            ],
            [
              17,
              false,
              0,
              null,
              null,
              null,
              null,
              1,
              null
            ],
            [
              18,
              false,
              0,
              null,
              null,
              null,
              null,
              1,
              null
            ],
            [
              19,
              false,
              0,
              null,
              null,
              null,
              null,
              1,
              null
            ],
            [
              20,
              false,
              0,
              null,
              null,
              null,
              null,
              1,
              null
            ],
            [
              21,
              false,
              0,
              null,
              null,
              null,
              null,
              1,
              null
            ],
            [
              22,
              false,
              0,
              null,
              null,
              null,
              null,
              1,
              null
            ],
            [
              23,
              false,
              0,
              null,
              null,
              null,
              null,
              1,
              null
            ],
            [
              24,
              false,
              0,
              null,
              null,
              null,
              null,
              1,
              null
            ],
            [
              25,
              false,
              0,
              null,
              null,
              null,
              null,
              1,
              null
            ],
            [
              26,
              false,
              0,
              null,
              null,
              null,
              null,
              1,
              null
            ],
            [
              27,
              false,
              0,
              null,
              null,
              null,
              null,
              1,
              null
            ],
            [
              28,
              false,
              0,
              null,
              null,
              null,
              null,
              1,
              null
            ],
            [
              29,
              false,
              0,
              null,
              null,
              null,
              null,
              1,
              null
            ],
            [
              30,
              false,
              0,
              null,
              null,
              null,
              null,
              1,
              null
            ],
            [
              31,
              false,
              0,
              null,
              null,
              null,
              null,
              1,
              null
            ],
            [
              32,
              false,
              0,
              null,
              null,
              null,
              null,
              1,
              null
            ],
            [
              33,
              false,
              0,
              null,
              null,
              null,
              null,
              1,
              null
            ],
            [
              34,
              false,
              0,
              null,
              null,
              null,
              null,
              1,
              null
            ],
            [
              35,
              false,
              0,
              null,
              null,
              null,
              null,
              1,
              null
            ],
            [
              36,
              false,
              0,
              null,
              null,
              null,
              null,
              1,
              null
            ],
            [
              37,
              false,
              0,
              null,
              null,
              null,
              null,
              1,
              null
            ],
            [
              38,
              false,
              0,
              null,
              null,
              null,
              null,
              1,
              null
            ]
          ]
        },
        "stackTable": {
          "schema": {
            "prefix": 0,
            "frame": 1
          },
          "data": [
            [
              null,
              0
            ],
            [
              0,
              1
            ],
            [
              1,
              2
            ],
            [
              2,
              3
            ],
            [
              3,
              4
            ],
            [
              4,
              5
            ],
            [
              5,
              6
            ],
            [
              6,
              7
            ],
            [
              7,
              8
            ],
            [
              8,
              9
            ],
            [
              9,
              10
            ],
            [
              10,
              11
            ],
            [
              11,
              12
            ],
            [
              12,
              13
            ],
            [
              13,
              14
            ],
            [
              14,
              15
            ],
            [
              15,
              16
            ],
            [
              16,
              17
            ],
            [
              17,
              18
            ],
            [
              18,
              19
            ],
            [
              19,
              20
            ],
            [
              20,
              21
            ],
            [
              20,
              22
            ],
            [
              22,
              23
            ],
            [
              11,
              24
            ],
            [
              24,
              25
            ],
            [
              25,
              26
            ],
            [
              26,
              27
            ],
            [
              27,
              28
            ],
            [
              28,
              29
            ],
            [
              9,
              11
            ],
            [
              30,
              24
            ],
            [
              31,
              25
            ],
            [
              32,
              30
            ],
            [
              33,
              31
            ],
            [
              34,
              32
            ],
            [
              35,
              29
            ],
            [
              36,
              33
            ],
            [
              37,
              34
            ],
            [
              38,
              35
            ],
            [
              39,
              36
            ],
            [
              40,
              37
            ],
            [
              41,
              38
            ]
          ]
        },
        "stringTable": [
          "__func__.0 (in [kernel.kallsyms].rodata)",
          "perf_trace_ext4_fc_track_inode (in [kernel.kallsyms])",
          "perf_trace_ext4_es_insert_delayed_block (in [kernel.kallsyms])",
          "ext4_es_show_pblock (in [kernel.kallsyms])",
          "perf_trace_ext4_ext_rm_leaf (in [kernel.kallsyms])",
          "devcgroup_access_write (in [kernel.kallsyms])",
          "devcgroup_update_access (in [kernel.kallsyms])",
          "propagate_exception (in [kernel.kallsyms])",
          "revalidate_active_exceptions (in [kernel.kallsyms])",
          "perf_trace_ext4_fc_commit_stop (in [kernel.kallsyms])",
          "perf_fetch_caller_regs (in [kernel.kallsyms])",
          "khugepaged (in [kernel.kallsyms])",
          "khugepaged_wait_work (in [kernel.kallsyms])",
          "freezable_schedule_timeout (in [kernel.kallsyms])",
          "freezer_count (in [kernel.kallsyms])",
          "try_to_freeze (in [kernel.kallsyms])",
          "try_to_freeze_unsafe (in [kernel.kallsyms])",
          "split_huge_pages_write (in [kernel.kallsyms])",
          "migrate_pages (in [kernel.kallsyms])",
          "unmap_and_move (in [kernel.kallsyms])",
          "__unmap_and_move (in [kernel.kallsyms])",
          "collect_events (in [kernel.kallsyms])",
          "uncore_down_prepare (in [kernel.kallsyms])",
          "perf_iommu_read (in [kernel.kallsyms])",
          "khugepaged_do_scan (in [kernel.kallsyms])",
          "khugepaged_scan_mm_slot (in [kernel.kallsyms])",
          "khugepaged_scan_file (in [kernel.kallsyms])",
          "need_resched (in [kernel.kallsyms])",
          "get_current (in [kernel.kallsyms])",
          "move_to_new_page (in [kernel.kallsyms])",
          "khugepaged_scan_pmd (in [kernel.kallsyms])",
          "trace_mm_khugepaged_scan_pmd (in [kernel.kallsyms])",
          "migrate_huge_page_move_mapping (in [kernel.kallsyms])",
          "do_huge_pmd_numa_page (in [kernel.kallsyms])",
          "pmd_pfn (in [kernel.kallsyms])",
          "protnone_mask (in [kernel.kallsyms])",
          "__pte_needs_invert (in [kernel.kallsyms])",
          "reclaim_high (in [kernel.kallsyms])",
          "memcg_memory_event (in [kernel.kallsyms])"
        ],
        "registerTime": 0,
        "unregisterTime": null,
        "processType": "default"
      }
    ],
    "processes": [],
    "pausedRanges": []
  }
  #

Signed-off-by: Anup Sharma &lt;anupnewsmail@gmail.com&gt;
Tested-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
Cc: Adrian Hunter &lt;adrian.hunter@intel.com&gt;
Cc: Alexander Shishkin &lt;alexander.shishkin@linux.intel.com&gt;
Cc: Ian Rogers &lt;irogers@google.com&gt;
Cc: Ingo Molnar &lt;mingo@redhat.com&gt;
Cc: Jiri Olsa &lt;jolsa@kernel.org&gt;
Cc: Mark Rutland &lt;mark.rutland@arm.com&gt;
Cc: Namhyung Kim &lt;namhyung@kernel.org&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Link: https://lore.kernel.org/r/cbf03cda175ea3dd2c6cd87bd3f12d803446cb95.1689961706.git.anupnewsmail@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
</content>
</entry>
<entry>
<title>perf script: Introduce task analyzer python script</title>
<updated>2022-12-14T14:24:31Z</updated>
<author>
<name>Hagen Paul Pfeifer</name>
<email>hagen@jauu.net</email>
</author>
<published>2022-12-06T15:44:04Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=e76aff0523f7d3393f967bc13b10bb04b759abfa'/>
<id>urn:sha1:e76aff0523f7d3393f967bc13b10bb04b759abfa</id>
<content type='text'>
Introduce a new 'perf script' to analyze task scheduling behavior.

During the task analysis, some data is always needed - which goes beyond
the simple time of switching on and off a task (process/thread). This
concerns for example the runtime of a process or the frequency with
which the process was called. This script serves to simplify this
recurring analyze process. It immediately provides the user with helpful
task characteristic information about the tasks runtimes.

Usage:

Recorded can be in two ways:

  $ perf script record tasks-analyzer -- sleep 10
  $ perf record -e sched:sched_switch -a -- sleep 10

The script can parse all perf.data files, most important: sched:sched_switch
events are mandatory, other events will be ignored.

Most simple report use case is to just call the script without arguments:

  $ perf script report tasks-analyzer
      Switched-In      Switched-Out CPU      PID      TID             Comm    Runtime     Time Out-In
  15576.658891407   15576.659156086   4     2412     2428            gdbus        265            1949
  15576.659111320   15576.659455410   0     2412     2412      gnome-shell        344            2267
  15576.659491326   15576.659506173   2       74       74      kworker/2:1         15           13145
  15576.659506173   15576.659825748   2     2858     2858  gnome-terminal-        320           63263
  15576.659871270   15576.659902872   6    20932    20932    kworker/u16:0         32         2314582
  15576.659909951   15576.659945501   3    27264    27264               sh         36              -1
  15576.659853285   15576.659971052   7    27265    27265             perf        118         5050741
  [...]

What is not shown here are the ASCII color sequences. For example, if
the task consists of only one thread, the TID is grayed out.

Runtime is the time the task was running on the CPU, Time Out-In is the
time between the process being scheduled *out* and scheduled back *in*.
So the last time span between two executions. If -1 is printed, then the
task simply ran the first time in the measurements - a Out-In delta
could not be calculated.

In addition to the chronological representation, there is a summary on
task level. This output can be additionally switched on via the
--summary option and provides information such as max, min &amp; average
runtime per process. The maximum runtime is often important for
debugging. The call looks like this:

  $ perf script report tasks-analyzer --summary
  Summary
       Task Information                       Runtime Information
    PID   TID            Comm Runs Accumulated    Mean  Median  Min   Max          Max At
     14    14     ksoftirqd/0   13         334      26      15    9   127 15571.621211956
     15    15     rcu_preempt  133        1778      13      13    2    33 15572.581176024
     16    16     migration/0    3          49      16      13   12    24 15571.608915425
     20    20     migration/1    3          34      11      13    8    13 15571.639101555
     25    25     migration/2    3          32      11      12    9    12 15575.639239896
  [...]

Besides these two options, there are a number of other options that change the
output and behavior. This can be queried via --help. Options worth mentioning include:

- filter-tasks         - filter out unneeded tasks, --filter-task 1337,/sbin/init
- highlight-tasks      - more pleasant focusing, --highlight-tasks 1:red,mutt:yellow
- extended-times       - show combinations of elapsed times between schedule in/schedule out
- summary-extended     - summary with additional information, like maximum delta time statistics
- rename-comms-by-tids - handy for inexpressive processnames like python, --rename 1337:my-python-app
- ms                   - show timestamps in milliseconds, nanoseconds is also possible (--ns)
- time-limit           - limit the analyzer to a time range, --time-limit 15576.0:15576.1

Script is tested and prime time ready for python2 &amp; python3:

- make PYTHON=python3 prefix=/usr/local install
- make PYTHON=python2 prefix=/usr/local install

Signed-off-by: Hagen Paul Pfeifer &lt;hagen@jauu.net&gt;
Cc: Andi Kleen &lt;ak@linux.intel.com&gt;
Cc: Ian Rogers &lt;irogers@google.com&gt;
Cc: Jiri Olsa &lt;jolsa@kernel.org&gt;
Cc: Namhyung Kim &lt;namhyung@kernel.org&gt;
Link: https://lore.kernel.org/r/20221206154406.41941-2-petar.gligor@gmail.com
Signed-off-by: Petar Gligoric &lt;petar.gligoric@rohde-schwarz.com&gt;
Signed-off-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
</content>
</entry>
<entry>
<title>perf scripts python: Fix passing arguments to stackcollapse report</title>
<updated>2021-09-10T14:45:19Z</updated>
<author>
<name>Michael Petlan</name>
<email>mpetlan@redhat.com</email>
</author>
<published>2020-04-27T14:23:27Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=51ae7fa62dcb0ab96ea5f83aec254a1fb6d4d371'/>
<id>urn:sha1:51ae7fa62dcb0ab96ea5f83aec254a1fb6d4d371</id>
<content type='text'>
The '--' prevented arguments from being passed to the script, such as:

  $ perf script report stackcollapse -i my_perf.data

Signed-off-by: Michael Petlan &lt;mpetlan@redhat.com&gt;
Cc: Jiri Olsa &lt;jolsa@redhat.com&gt;
Cc: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
LPU-Reference: 20200427142327.21172-1-mpetlan@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
</content>
</entry>
<entry>
<title>perf scripts python: intel-pt-events.py: Add branches to script</title>
<updated>2021-05-25T13:07:17Z</updated>
<author>
<name>Adrian Hunter</name>
<email>adrian.hunter@intel.com</email>
</author>
<published>2021-05-25T09:51:12Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=a92bf335fd82eeee0e95705bfd25014ee0c8262e'/>
<id>urn:sha1:a92bf335fd82eeee0e95705bfd25014ee0c8262e</id>
<content type='text'>
As an example, add branch information to intel-pt-events.py script.
This shows how a simple python script can be used to customize
perf script output for Intel PT branch traces or power event traces.

Signed-off-by: Adrian Hunter &lt;adrian.hunter@intel.com&gt;
Cc: Andi Kleen &lt;ak@linux.intel.com&gt;
Cc: Jiri Olsa &lt;jolsa@redhat.com&gt;
Link: https://lore.kernel.org/r/20210525095112.1399-11-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
</content>
</entry>
<entry>
<title>perf flamegraph: Use /bin/bash for report and record scripts</title>
<updated>2020-05-05T19:35:32Z</updated>
<author>
<name>Arnaldo Carvalho de Melo</name>
<email>acme@redhat.com</email>
</author>
<published>2020-05-05T16:33:12Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=19ce2321739da5fc27f6a5ed1e1cb15e384ad030'/>
<id>urn:sha1:19ce2321739da5fc27f6a5ed1e1cb15e384ad030</id>
<content type='text'>
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 5287f9269206 ("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&lt;----------8&lt;----------8&lt;-----
  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 -- "$@"
  -----&gt;8----------&gt;8----------&gt;8-----

Fixes: 5287f9269206 ("perf script: Add flamegraph.py script")
Reported-by: Daniel Díaz &lt;daniel.diaz@linaro.org&gt;
Acked-by: Andreas Gerstmayr &lt;agerstmayr@redhat.com&gt;
Cc: Adrian Hunter &lt;adrian.hunter@intel.com&gt;
Cc: Jiri Olsa &lt;jolsa@kernel.org&gt;
Cc: lkft-triage@lists.linaro.org
Cc: Namhyung Kim &lt;namhyung@kernel.org&gt;
Link: http://lore.kernel.org/lkml/CAEUSe7_wmKS361mKLTB1eYbzYXcKkXdU26BX5BojdKRz8MfPCw@mail.gmail.com
Link: http://lore.kernel.org/lkml/20200505170320.GZ30487@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
</content>
</entry>
<entry>
<title>perf script: Add flamegraph.py script</title>
<updated>2020-04-16T15:19:14Z</updated>
<author>
<name>Andreas Gerstmayr</name>
<email>agerstmayr@redhat.com</email>
</author>
<published>2020-03-20T15:13:48Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=5287f926920688e1151741d49da37a533ccf1960'/>
<id>urn:sha1:5287f926920688e1151741d49da37a533ccf1960</id>
<content type='text'>
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: Andreas Gerstmayr &lt;agerstmayr@redhat.com&gt;
Tested-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
Cc: Alexander Shishkin &lt;alexander.shishkin@linux.intel.com&gt;
Cc: Jiri Olsa &lt;jolsa@redhat.com&gt;
Cc: Mark Rutland &lt;mark.rutland@arm.com&gt;
Cc: Namhyung Kim &lt;namhyung@kernel.org&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Brendan Gregg &lt;bgregg@netflix.com&gt;
Cc: Martin Spier &lt;mspier@netflix.com&gt;
Link: http://lore.kernel.org/lkml/20200320151355.66302-1-agerstmayr@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
</content>
</entry>
<entry>
<title>perf script powerpc: Python script for hypervisor call statistics</title>
<updated>2018-06-06T15:52:06Z</updated>
<author>
<name>Ravi Bangoria</name>
<email>ravi.bangoria@linux.ibm.com</email>
</author>
<published>2018-06-05T12:48:01Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=ec1e6e6a681815e4d02a54eed92edec6fa4128ee'/>
<id>urn:sha1:ec1e6e6a681815e4d02a54eed92edec6fa4128ee</id>
<content type='text'>
Add python script to show hypervisor call statistics. Ex,

  # perf record -a -e "{powerpc:hcall_entry,powerpc:hcall_exit}"
  # perf script -s scripts/python/powerpc-hcalls.py
    hcall                            count   min(ns)   max(ns)   avg(ns)
    --------------------------------------------------------------------
    H_RANDOM                            82       838      1164       904
    H_PUT_TCE                           47      1078      5928      2003
    H_EOI                              266      1336      3546      1654
    H_ENTER                             28      1646      4038      1952
    H_PUT_TCE_INDIRECT                 230      2166     18168      6109
    H_IPI                              238      1072      3232      1688
    H_SEND_LOGICAL_LAN                  42      5488     21366      7694
    H_STUFF_TCE                        294       986      6210      3591
    H_XIRR                             266      2286      6990      3783
    H_PROTECT                           10      2196      3556      2555
    H_VIO_SIGNAL                       294      1028      2784      1311
    H_ADD_LOGICAL_LAN_BUFFER            53      1978      3450      2600
    H_SEND_CRQ                          77      1762      7240      2447

Signed-off-by: Ravi Bangoria &lt;ravi.bangoria@linux.ibm.com&gt;
Cc: Alexander Shishkin &lt;alexander.shishkin@linux.intel.com&gt;
Cc: Jiri Olsa &lt;jolsa@redhat.com&gt;
Cc: Michael Ellerman &lt;mpe@ellerman.id.au&gt;
Cc: Namhyung Kim &lt;namhyung@kernel.org&gt;
Cc: Naveen N. Rao &lt;naveen.n.rao@linux.vnet.ibm.com&gt;
Link: http://lkml.kernel.org/r/20180605124801.17210-1-ravi.bangoria@linux.ibm.com
[ Fixup typo: table_loockup -&gt; table_lookup ]
Signed-off-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
</content>
</entry>
</feed>
