^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) perf-sched(1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) =============
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) NAME
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) ----
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) perf-sched - Tool to trace/measure scheduler properties (latencies)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) SYNOPSIS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) --------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) [verse]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) 'perf sched' {record|latency|map|replay|script|timehist}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) DESCRIPTION
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) -----------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) There are several variants of 'perf sched':
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) 'perf sched record <command>' to record the scheduling events
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) of an arbitrary workload.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) 'perf sched latency' to report the per task scheduling latencies
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) and other scheduling properties of the workload.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) 'perf sched script' to see a detailed trace of the workload that
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) was recorded (aliased to 'perf script' for now).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) 'perf sched replay' to simulate the workload that was recorded
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) via perf sched record. (this is done by starting up mockup threads
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) that mimic the workload based on the events in the trace. These
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) threads can then replay the timings (CPU runtime and sleep patterns)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) of the workload as it occurred when it was recorded - and can repeat
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) it a number of times, measuring its performance.)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 'perf sched map' to print a textual context-switching outline of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) workload captured via perf sched record. Columns stand for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) individual CPUs, and the two-letter shortcuts stand for tasks that
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) are running on a CPU. A '*' denotes the CPU that had the event, and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) a dot signals an idle CPU.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 'perf sched timehist' provides an analysis of scheduling events.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) Example usage:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) perf sched record -- sleep 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) perf sched timehist
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) By default it shows the individual schedule events, including the wait
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) time (time between sched-out and next sched-in events for the task), the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) task scheduling delay (time between wakeup and actually running) and run
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) time for the task:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) time cpu task name wait time sch delay run time
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) [tid/pid] (msec) (msec) (msec)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) -------------- ------ -------------------- --------- --------- ---------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) 79371.874569 [0011] gcc[31949] 0.014 0.000 1.148
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) 79371.874591 [0010] gcc[31951] 0.000 0.000 0.024
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) 79371.874603 [0010] migration/10[59] 3.350 0.004 0.011
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) 79371.874604 [0011] <idle> 1.148 0.000 0.035
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) 79371.874723 [0005] <idle> 0.016 0.000 1.383
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) 79371.874746 [0005] gcc[31949] 0.153 0.078 0.022
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) ...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) Times are in msec.usec.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) OPTIONS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) -------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) -i::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) --input=<file>::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) Input file name. (default: perf.data unless stdin is a fifo)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) -v::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) --verbose::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) Be more verbose. (show symbol address, etc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) -D::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) --dump-raw-trace=::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) Display verbose dump of the sched data.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) -f::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) --force::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) Don't complain, do it.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) OPTIONS for 'perf sched map'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) ----------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) --compact::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) Show only CPUs with activity. Helps visualizing on high core
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) count systems.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) --cpus::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) Show just entries with activities for the given CPUs.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) --color-cpus::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) Highlight the given cpus.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) --color-pids::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) Highlight the given pids.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) OPTIONS for 'perf sched timehist'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) ---------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) -k::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) --vmlinux=<file>::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) vmlinux pathname
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) --kallsyms=<file>::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) kallsyms pathname
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) -g::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) --call-graph::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) Display call chains if present (default on).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) --max-stack::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) Maximum number of functions to display in backtrace, default 5.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) -C=::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) --cpu=::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) Only show events for the given CPU(s) (comma separated list).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) -p=::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) --pid=::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) Only show events for given process ID (comma separated list).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) -t=::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) --tid=::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) Only show events for given thread ID (comma separated list).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) -s::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) --summary::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) Show only a summary of scheduling by thread with min, max, and average
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) run times (in sec) and relative stddev.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) -S::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) --with-summary::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) Show all scheduling events followed by a summary by thread with min,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) max, and average run times (in sec) and relative stddev.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) --symfs=<directory>::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) Look for files with symbols relative to this directory.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) -V::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) --cpu-visual::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) Show visual aid for sched switches by CPU: 'i' marks idle time,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 's' are scheduler events.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) -w::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) --wakeups::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) Show wakeup events.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) -M::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) --migrations::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) Show migration events.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) -n::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) --next::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) Show next task.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) -I::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) --idle-hist::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) Show idle-related events only.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) --time::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) Only analyze samples within given time window: <start>,<stop>. Times
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) have the format seconds.microseconds. If start is not given (i.e., time
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) string is ',x.y') then analysis starts at the beginning of the file. If
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) stop time is not given (i.e, time string is 'x.y,') then analysis goes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) to end of file.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) --state::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) Show task state when it switched out.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) SEE ALSO
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) --------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) linkperf:perf-record[1]