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