| 1 |
cycle_thief.stp - Track IRQ's and Other Processes Stealing Cycles from a Task |
| 2 |
|
| 3 |
Description: |
| 4 |
The cycle_thief.stp script instruments the scheduler and IRQ handler |
| 5 |
to determine which processes and interrupts are competing with the |
| 6 |
specified task for the cpu cycles. This script uses the '-c' or '-x' |
| 7 |
options to focus on a specific task. The script output the number of |
| 8 |
times the task migrates between processors, histograms showing the |
| 9 |
length of time on and off processor, lists of processes running while |
| 10 |
the task is off the processor, and the interrupts that occurred while |
| 11 |
the task was running. |
| 12 |
|
| 13 |
|
| 14 |
$ stap cycle_thief.stp |
| 15 |
|
| 16 |
task 0 migrated: 1 |
| 17 |
|
| 18 |
task 0 on processor (us): |
| 19 |
value |-------------------------------------------------- count |
| 20 |
2 | 0 |
| 21 |
4 | 0 |
| 22 |
8 |@ 1 |
| 23 |
16 | 0 |
| 24 |
32 | 0 |
| 25 |
64 | 0 |
| 26 |
128 |@@@@@@@@ 8 |
| 27 |
256 |@ 1 |
| 28 |
512 | 0 |
| 29 |
1024 |@ 1 |
| 30 |
2048 |@@@@@@@@ 8 |
| 31 |
4096 |@@@@@@@@@@@ 11 |
| 32 |
8192 |@@ 2 |
| 33 |
16384 |@@ 2 |
| 34 |
32768 |@@@@@@@@@@@@ 12 |
| 35 |
65536 |@@@@@ 5 |
| 36 |
131072 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 30 |
| 37 |
262144 | 0 |
| 38 |
524288 | 0 |
| 39 |
|
| 40 |
|
| 41 |
task 0 off processor (us) |
| 42 |
value |-------------------------------------------------- count |
| 43 |
1 | 0 |
| 44 |
2 | 0 |
| 45 |
4 |@@@@ 4 |
| 46 |
8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@ 27 |
| 47 |
16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 34 |
| 48 |
32 |@@@@ 4 |
| 49 |
64 |@@@@@ 5 |
| 50 |
128 |@@@@@ 5 |
| 51 |
256 | 0 |
| 52 |
512 |@ 1 |
| 53 |
1024 | 0 |
| 54 |
2048 | 0 |
| 55 |
|
| 56 |
|
| 57 |
other pids taking processor from task 0 |
| 58 |
PID count command |
| 59 |
25145 33 stapio |
| 60 |
19189 17 kworker/0:3 |
| 61 |
7 13 rcu_sched |
| 62 |
22717 9 kworker/1:1 |
| 63 |
380 8 jbd2/dm-0-8 |
| 64 |
9 8 rcuos/1 |
| 65 |
570 6 kworker/0:1H |
| 66 |
8 3 rcuos/0 |
| 67 |
478 3 systemd-journal |
| 68 |
24747 3 kworker/0:1 |
| 69 |
491 2 systemd-udevd |
| 70 |
19120 2 sshd |
| 71 |
25142 2 stapio |
| 72 |
615 1 alsactl |
| 73 |
625 1 irqbalance |
| 74 |
25144 1 stapio |
| 75 |
31816 1 kworker/u4:1 |
| 76 |
25141 1 stap |
| 77 |
724 1 NetworkManager |
| 78 |
25143 1 systemd-udevd |
| 79 |
|
| 80 |
irq taking processor from task 0 |
| 81 |
irq count min(us) avg(us) max(us) |
| 82 |
44 9 3 8 19 |
| 83 |
|
| 84 |
The output from running the script for ~10 seconds. |
| 85 |
|
| 86 |
The histograms provide a visual of the time a process spent on, or off. The |
| 87 |
sampled processes are listed below the histograms to give a sense of what |
| 88 |
was running at the time. |
| 89 |
|
| 90 |
As mentioned in the description, the script can be focused on a certain process |
| 91 |
with -c/-x. |
| 92 |
|
| 93 |
$ stap cycle_thief.stp -T 10 |
| 94 |
|
| 95 |
task 29018 migrated: 2 |
| 96 |
|
| 97 |
task 29018 on processor (us): |
| 98 |
value |-------------------------------------------------- count |
| 99 |
2 | 0 |
| 100 |
4 | 0 |
| 101 |
8 |@ 1 |
| 102 |
16 | 0 |
| 103 |
32 |@ 1 |
| 104 |
64 |@ 1 |
| 105 |
128 | 0 |
| 106 |
256 |@ 1 |
| 107 |
512 | 0 |
| 108 |
1024 | 0 |
| 109 |
|
| 110 |
|
| 111 |
task 29018 off processor (us) |
| 112 |
value |-------------------------------------------------- count |
| 113 |
2 | 0 |
| 114 |
4 | 0 |
| 115 |
8 |@ 1 |
| 116 |
16 |@ 1 |
| 117 |
32 | 0 |
| 118 |
64 | 0 |
| 119 |
~ |
| 120 |
2097152 | 0 |
| 121 |
4194304 | 0 |
| 122 |
8388608 |@ 1 |
| 123 |
16777216 | 0 |
| 124 |
33554432 | 0 |
| 125 |
|
| 126 |
|
| 127 |
other pids taking processor from task 29018 |
| 128 |
PID count command |
| 129 |
0 41 swapper/0 |
| 130 |
19189 24 kworker/0:3 |
| 131 |
7 12 rcu_sched |
| 132 |
8 8 rcuos/0 |
| 133 |
29002 5 kworker/0:0 |
| 134 |
380 4 jbd2/dm-0-8 |
| 135 |
570 3 kworker/0:1H |
| 136 |
6 3 kworker/u4:0 |
| 137 |
491 2 systemd-udevd |
| 138 |
29016 2 stapio |
| 139 |
29017 1 systemd-udevd |
| 140 |
478 1 systemd-journal |
| 141 |
625 1 irqbalance |
| 142 |
14 1 migration/1 |
| 143 |
|
| 144 |
irq taking processor from task 29018 |
| 145 |
irq count min(us) avg(us) max(us) |