@@ -202,10 +202,6 @@ Here is the list of current tracers that may be configured.
202
202
to draw a graph of function calls similar to C code
203
203
source.
204
204
205
- "sched_switch"
206
-
207
- Traces the context switches and wakeups between tasks.
208
-
209
205
"irqsoff"
210
206
211
207
Traces the areas that disable interrupts and saves
@@ -273,39 +269,6 @@ format, the function name that was traced "path_put" and the
273
269
parent function that called this function "path_walk". The
274
270
timestamp is the time at which the function was entered.
275
271
276
- The sched_switch tracer also includes tracing of task wakeups
277
- and context switches.
278
-
279
- ksoftirqd/1-7 [01] 1453.070013: 7:115:R + 2916:115:S
280
- ksoftirqd/1-7 [01] 1453.070013: 7:115:R + 10:115:S
281
- ksoftirqd/1-7 [01] 1453.070013: 7:115:R ==> 10:115:R
282
- events/1-10 [01] 1453.070013: 10:115:S ==> 2916:115:R
283
- kondemand/1-2916 [01] 1453.070013: 2916:115:S ==> 7:115:R
284
- ksoftirqd/1-7 [01] 1453.070013: 7:115:S ==> 0:140:R
285
-
286
- Wake ups are represented by a "+" and the context switches are
287
- shown as "==>". The format is:
288
-
289
- Context switches:
290
-
291
- Previous task Next Task
292
-
293
- <pid>:<prio>:<state> ==> <pid>:<prio>:<state>
294
-
295
- Wake ups:
296
-
297
- Current task Task waking up
298
-
299
- <pid>:<prio>:<state> + <pid>:<prio>:<state>
300
-
301
- The prio is the internal kernel priority, which is the inverse
302
- of the priority that is usually displayed by user-space tools.
303
- Zero represents the highest priority (99). Prio 100 starts the
304
- "nice" priorities with 100 being equal to nice -20 and 139 being
305
- nice 19. The prio "140" is reserved for the idle task which is
306
- the lowest priority thread (pid 0).
307
-
308
-
309
272
Latency trace format
310
273
--------------------
311
274
@@ -491,79 +454,6 @@ x494] <- /root/a.out[+0x4a8] <- /lib/libc-2.7.so[+0x1e1a6]
491
454
latencies, as described in "Latency
492
455
trace format".
493
456
494
- sched_switch
495
- ------------
496
-
497
- This tracer simply records schedule switches. Here is an example
498
- of how to use it.
499
-
500
- # echo sched_switch > current_tracer
501
- # echo 1 > tracing_enabled
502
- # sleep 1
503
- # echo 0 > tracing_enabled
504
- # cat trace
505
-
506
- # tracer: sched_switch
507
- #
508
- # TASK-PID CPU# TIMESTAMP FUNCTION
509
- # | | | | |
510
- bash-3997 [01] 240.132281: 3997:120:R + 4055:120:R
511
- bash-3997 [01] 240.132284: 3997:120:R ==> 4055:120:R
512
- sleep-4055 [01] 240.132371: 4055:120:S ==> 3997:120:R
513
- bash-3997 [01] 240.132454: 3997:120:R + 4055:120:S
514
- bash-3997 [01] 240.132457: 3997:120:R ==> 4055:120:R
515
- sleep-4055 [01] 240.132460: 4055:120:D ==> 3997:120:R
516
- bash-3997 [01] 240.132463: 3997:120:R + 4055:120:D
517
- bash-3997 [01] 240.132465: 3997:120:R ==> 4055:120:R
518
- <idle>-0 [00] 240.132589: 0:140:R + 4:115:S
519
- <idle>-0 [00] 240.132591: 0:140:R ==> 4:115:R
520
- ksoftirqd/0-4 [00] 240.132595: 4:115:S ==> 0:140:R
521
- <idle>-0 [00] 240.132598: 0:140:R + 4:115:S
522
- <idle>-0 [00] 240.132599: 0:140:R ==> 4:115:R
523
- ksoftirqd/0-4 [00] 240.132603: 4:115:S ==> 0:140:R
524
- sleep-4055 [01] 240.133058: 4055:120:S ==> 3997:120:R
525
- [...]
526
-
527
-
528
- As we have discussed previously about this format, the header
529
- shows the name of the trace and points to the options. The
530
- "FUNCTION" is a misnomer since here it represents the wake ups
531
- and context switches.
532
-
533
- The sched_switch file only lists the wake ups (represented with
534
- '+') and context switches ('==>') with the previous task or
535
- current task first followed by the next task or task waking up.
536
- The format for both of these is PID:KERNEL-PRIO:TASK-STATE.
537
- Remember that the KERNEL-PRIO is the inverse of the actual
538
- priority with zero (0) being the highest priority and the nice
539
- values starting at 100 (nice -20). Below is a quick chart to map
540
- the kernel priority to user land priorities.
541
-
542
- Kernel Space User Space
543
- ===============================================================
544
- 0(high) to 98(low) user RT priority 99(high) to 1(low)
545
- with SCHED_RR or SCHED_FIFO
546
- ---------------------------------------------------------------
547
- 99 sched_priority is not used in scheduling
548
- decisions(it must be specified as 0)
549
- ---------------------------------------------------------------
550
- 100(high) to 139(low) user nice -20(high) to 19(low)
551
- ---------------------------------------------------------------
552
- 140 idle task priority
553
- ---------------------------------------------------------------
554
-
555
- The task states are:
556
-
557
- R - running : wants to run, may not actually be running
558
- S - sleep : process is waiting to be woken up (handles signals)
559
- D - disk sleep (uninterruptible sleep) : process must be woken up
560
- (ignores signals)
561
- T - stopped : process suspended
562
- t - traced : process is being traced (with something like gdb)
563
- Z - zombie : process waiting to be cleaned up
564
- X - unknown
565
-
566
-
567
457
ftrace_enabled
568
458
--------------
569
459
0 commit comments