Proposal of a python script: latency.py

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


Hi,

Here is a little script which mainly works with tracepoints events. It
measures time intervals between events occurences.

The script latency.py analyzes tracepoints events saved into a
recorded perf archive. Events (which have been passed as argument to
the script) are sorted according to their running CPUs and their
timestamps. Then, the script computes time intervals between events
which occurred in the specified order.

Basic statistics (min, avg, max) and (optionally) histograms are displayed.

You will find some small test-cases (beware the record was executed on
a qemu system).

Do you consider the script interesting enough?

Alexis.

# perf script -s /libexec/perf-core/scripts/python/latency.py
events=irq:irq_handler_entry,irq:irq_handler_exit,irq:softirq_entry
# ========
# captured on: Sun Jun 24 23:27:06 2012
# hostname : perf-test
# os release : 3.5.0-rc3
# perf version : 3.5.0-rc3
# arch : x86_64
# nrcpus online : 1
# nrcpus avail : 1
# cpudesc : QEMU Virtual CPU version 1.0
# total memory : 765632 kB
# cmdline : /bin/perf record -e irq:irq_handler_entry -e
irq:irq_handler_exit -e irq:softirq_entry -a sleep 10
# event : name = irq:irq_handler_entry, type = 2, config = 0x19,
config1 = 0x0, config2 = 0x0, excl_usr = 0, excl_kern = 0, id = { 5 }
# event : name = irq:irq_handler_exit, type = 2, config = 0x18,
config1 = 0x0, config2 = 0x0, excl_usr = 0, excl_kern = 0, id = { 6 }
# event : name = irq:softirq_entry, type = 2, config = 0x17, config1 =
0x0, config2 = 0x0, excl_usr = 0, excl_kern = 0, id = { 7 }
# HEADER_CPU_TOPOLOGY info available, use -I to display
# ========
#
Install the audit-libs-python package to get syscall names
# === Legend ===
# L00: irq:irq_handler_entry -> irq:irq_handler_exit
# L01: irq:irq_handler_exit -> irq:softirq_entry
# L02: total
# === Statistics: min avg max (ns) ===
# cpus:            0            |           all
 L00  : 0027782 0089626 0143788 | 0027782 0089626 0143788
 L01  : 0008346 0056006 0122153 | 0008346 0056006 0122153
 L02  : 0036128 0145632 0186212 | 0036128 0145632 0186212

# perf script -s /libexec/perf-core/scripts/python/latency.py
events=irq:irq_handler_entry,irq:irq_handler_exit,irq:softirq_entry
histo=10000,10
# ========
# captured on: Sun Jun 24 23:27:06 2012
# hostname : perf-test
# os release : 3.5.0-rc3
# perf version : 3.5.0-rc3
# arch : x86_64
# nrcpus online : 1
# nrcpus avail : 1
# cpudesc : QEMU Virtual CPU version 1.0
# total memory : 765632 kB
# cmdline : /bin/perf record -e irq:irq_handler_entry -e
irq:irq_handler_exit -e irq:softirq_entry -a sleep 10
# event : name = irq:irq_handler_entry, type = 2, config = 0x19,
config1 = 0x0, config2 = 0x0, excl_usr = 0, excl_kern = 0, id = { 5 }
# event : name = irq:irq_handler_exit, type = 2, config = 0x18,
config1 = 0x0, config2 = 0x0, excl_usr = 0, excl_kern = 0, id = { 6 }
# event : name = irq:softirq_entry, type = 2, config = 0x17, config1 =
0x0, config2 = 0x0, excl_usr = 0, excl_kern = 0, id = { 7 }
# HEADER_CPU_TOPOLOGY info available, use -I to display
# ========
#
Install the audit-libs-python package to get syscall names
# === Legend ===
# L00: irq:irq_handler_entry -> irq:irq_handler_exit
# L01: irq:irq_handler_exit -> irq:softirq_entry
# L02: total
# === Statistics: min avg max (ns) ===
# cpus:            0            |           all
 L00  : 0027782 0089626 0143788 | 0027782 0089626 0143788
 L01  : 0008346 0056006 0122153 | 0008346 0056006 0122153
 L02  : 0036128 0145632 0186212 | 0036128 0145632 0186212
# === Histograms: bucket:10000ns ===
 L00 \ cpus:  0   | all
00000000000: 0000 | 0000
00000010000: 0000 | 0000
00000020000: 0002 | 0002
00000030000: 0001 | 0001
00000040000: 0000 | 0000
00000050000: 0000 | 0000
00000060000: 0000 | 0000
00000070000: 0004 | 0004
00000080000: 0010 | 0010
00000090000: 0002 | 0002
 overflows : 0008 | 0008
  totals   : 0027 | 0027
 L01 \ cpus:  0   | all
00000000000: 0002 | 0002
00000010000: 0000 | 0000
00000020000: 0013 | 0013
00000030000: 0001 | 0001
00000040000: 0000 | 0000
00000050000: 0000 | 0000
00000060000: 0000 | 0000
00000070000: 0000 | 0000
00000080000: 0000 | 0000
00000090000: 0009 | 0009
 overflows : 0002 | 0002
  totals   : 0027 | 0027
 L02 \ cpus:  0   | all
00000000000: 0000 | 0000
00000010000: 0000 | 0000
00000020000: 0000 | 0000
00000030000: 0001 | 0001
00000040000: 0001 | 0001
00000050000: 0000 | 0000
00000060000: 0000 | 0000
00000070000: 0000 | 0000
00000080000: 0000 | 0000
00000090000: 0000 | 0000
 overflows : 0025 | 0025
  totals   : 0027 | 0027

Attachment: 0001-perf-python-import-a-latency-calculation-python-scri.patch
Description: Binary data


[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]    [Yosemite Photos]    [Free Online Dating]     [Linux Kernel]     [Linux SCSI]     [XFree86]

Add to Google Powered by Linux