A variety of tools provides current power management statistics. For
example, a fantastic tool and widely used tool is powertop. However,
when it comes to power management optimizing, these tools are often not
informative enough - the dirty details to fix things are just missing.
For example, for an optimization it is usually not sufficient to know
that task foobar wakes up 400 times per second. For an tangible
optimization it is important to know what are the source of wakeup -
like fired timers or interrupts caused by connected peripherals (a
question related to the task runtime behavior). Especially if products
should be optimized to stay longer in deep core/package sleep phases
this information is important. This script tries to build the bridge to
provide helpful information to power optimize a system on one hand and
still be generally usable on the other hand.
It anwsers questsion like:
- what tasks (process, threards) are constantly interrupting processor
sleep states?
- operates tasks in a power aware fashion (long running but rarely vs
short running but often)?
This script provides its functionality via subcommands, similar to git.
The most important subcommands are:
- run-sequences (eventlog)
- run-periods
- wakeups
All Core Mode
CORE
PKG
Core Specific Mode
CPU Time Idle Duration Prev(tid) Next(tid) Runtime
001 1.2345 0.0001 CORE IDLE -> systemd(pid) 0.01 # rot hinterlegen, da von idle task
001 2.2345 systemd(pid) -> gnome-shell(pid) 0.01
Visualisieren zusammenhängendle Bündle von Wakeupsperioden, basiernd
von Wakeups Events. Je nach unterstüzten Terminal werden diese Blöcke in
unterschiedlicen Farbkodierungen dargestellt: rot bei kurzzeitigen
unterbrechungen (wo kein tiefer schlaf möglich ist) bis zu grünen
bereichen wo die CPU sehr tiefe schlafphasen erreichen kann.
--mode package
Als idle perioden werden lediglich perioden betrachtet, wo kein Core
aktiv ist. Dies ermöglicht es in der Regel der Hardware in die tiefsten
Power States zu wechseln
--mode core
Der Core mode kann nur auf speufische Cores angewandt werden. Er
ermöglicht es sich dediziert die Zustände eines Cores zu visualisieren.
Perf umgebungen, wo die perf scripte mit langer verzögerungen
ausgeliefert werden, oder auf custom embedded system wo die perf scripte
nicht mit instaliert werden können dieses script auch manuell ausführen,
Python support bleibt aber natürlich eine Grundvoraussetzung:
$ perf script -s /path/to/pm-statistics.py
Für die Option ist das script folgendermaßen aufzurufen:
$ perf script -s /path/to/pm-statisticss.py -- --help
Signed-off-by: Hagen Paul Pfeifer <hagen@jauu.net>
$ report
Idle -> Task
{Task, Idle} -> Task
Wakeups per seconds
Wakeups per seconds per CPU
IRQs Overall
IRQs per Core
--core 0,1,2,3,..
--show-tid instead of pid
CPU Time [s] Idle Prev(tid) Next(tid) Runtime
001 1.2345 0.0001 swapper -> systemd(pid) 0.01 # rot hinterlegen, da von idle task
001 2.2345 systemd(pid) -> gnome-shell(pid) 0.01
task -> swapper wird nicht angezeigt
perf script -i /tmp/perf.out -s ~/src/code/linux/tools/perf/scripts/python/power-statistics.py -- --mode task
Signed-off-by: Hagen Paul Pfeifer <hagen@jauu.net>