2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-27 22:53:55 +08:00
linux-next/tools/perf/scripts/python
Adrian Hunter 1d865c06f5 perf scripts python: call-graph-from-sql.py: Provide better default column sizes
Set initial column sizes to improve initial display.

Committer testing:

Extended instructions on testing this, using the sqlite variant:

Make sure you have the SQLite glue for python+Qt installed, on fedora 27
I used:

  # dnf install python-pyside

Collect some PT samples, say 5-secs worth, system wide:

  # perf record -r 10 -e intel_pt//u -a sleep 5
  [ perf record: Woken up 49 times to write data ]
  [ perf record: Captured and wrote 96.131 MB perf.data ]

This results in this perf.data file:

  # ls -larth perf.data
  -rw-------. 1 root root 97M Oct 23 10:11 perf.data

With the following attributes:

  # perf evlist -v
  intel_pt//u: type: 8, size: 112, config: 0x300e601, { sample_period, sample_freq }: 1, sample_type: IP|TID|TIME|CPU|IDENTIFIER, read_format: ID, disabled: 1, inherit: 1, exclude_kernel: 1, exclude_hv: 1, sample_id_all: 1
  dummy:u: type: 1, size: 112, config: 0x9, { sample_period, sample_freq }: 1, sample_type: IP|TID|TIME|CPU|IDENTIFIER, read_format: ID, inherit: 1, exclude_kernel: 1, exclude_hv: 1, mmap: 1, comm: 1, task: 1, sample_id_all: 1, mmap2: 1, comm_exec: 1, context_switch: 1
  #

Then generate the "pt_example" tables using:

  # perf script -s ~/libexec/perf-core/scripts/python/export-to-sqlite.py pt_example branches calls
  2018-10-23 10:56:59.177711 Creating database...
  2018-10-23 10:56:59.195842 Writing records...
   instruction trace error type 1 cpu 2 pid 1644 tid 1644 ip 0x263984516750 code 5: Failed to get instruction
   instruction trace error type 1 cpu 2 pid 1644 tid 1644 ip 0x7f26e116fd20 code 6: Trace doesn't match instruction
   instruction trace error type 1 cpu 2 pid 1644 tid 1644 ip 0x7f26e162c9ee code 6: Trace doesn't match instruction
   instruction trace error type 1 cpu 2 pid 1644 tid 1644 ip 0x7f26e9ce831a code 6: Trace doesn't match instruction
  <SNIP>
   instruction trace error type 1 cpu 0 pid 1644 tid 1644 ip 0x7f26e13d07b4 code 6: Trace doesn't match instruction
  Warning:
  132 instruction trace errors
  2018-10-23 11:25:25.015717 Adding indexes
  2018-10-23 11:25:28.788061 Done
  #

In my example, that perf.data file generated this db:

  # file pt_example
  pt_example: SQLite 3.x database, last written using SQLite version 3020001
  [root@seventh perf]# ls -lah pt_example
  -rw-r--r--. 1 root root 6.6G Oct 23 11:25 pt_example
  #

Then use this python script to use that db and provide a GUI:

  $ python tools/perf/scripts/python/call-graph-from-sql.py pt_example branches calls

I compared the column widths before this patch and after applying it,
the visual results match the patch intent.

The following patches will refer to this set of instructions in the "Committer
Testing" section.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: http://lkml.kernel.org/r/20181001062853.28285-3-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2018-10-23 14:15:30 -03:00
..
bin perf script powerpc: Python script for hypervisor call statistics 2018-06-06 12:52:06 -03:00
Perf-Trace-Util perf scripts python: Add Python 3 support to EventClass.py 2018-07-11 10:01:50 -03:00
call-graph-from-sql.py perf scripts python: call-graph-from-sql.py: Provide better default column sizes 2018-10-23 14:15:30 -03:00
check-perf-trace.py perf script: Add callchain to generic and tracepoint events 2014-07-16 17:57:33 -03:00
compaction-times.py perf scripts python: Add new compaction-times script 2015-08-28 14:53:40 -03:00
event_analyzing_sample.py License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
export-to-postgresql.py perf script python: Fix export-to-postgresql.py occasional failure 2018-09-25 11:33:06 -03:00
export-to-sqlite.py perf script python: Fix export-to-sqlite.py sample columns 2018-09-25 11:37:05 -03:00
failed-syscalls-by-pid.py perf script: Add callchain to generic and tracepoint events 2014-07-16 17:57:33 -03:00
futex-contention.py perf script: Add callchain to generic and tracepoint events 2014-07-16 17:57:33 -03:00
intel-pt-events.py perf intel-pt: Add example script for power events and PTWRITE 2017-06-30 11:50:53 -03:00
mem-phys-addr.py perf script python: Add script to profile and resolve physical mem type 2018-01-12 11:06:57 -03:00
net_dropmonitor.py License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
netdev-times.py License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
powerpc-hcalls.py perf script powerpc: Python script for hypervisor call statistics 2018-06-06 12:52:06 -03:00
sched-migration.py perf scripts python: Add Python 3 support to sched-migration.py 2018-07-11 10:01:50 -03:00
sctop.py perf script: Add callchain to generic and tracepoint events 2014-07-16 17:57:33 -03:00
stackcollapse.py License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
stat-cpi.py License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
syscall-counts-by-pid.py perf script: Add callchain to generic and tracepoint events 2014-07-16 17:57:33 -03:00
syscall-counts.py perf script: Add callchain to generic and tracepoint events 2014-07-16 17:57:33 -03:00