Server IP : 15.235.198.142 / Your IP : 216.73.216.190 Web Server : Apache/2.4.58 (Ubuntu) System : Linux ballsack 6.8.0-45-generic #45-Ubuntu SMP PREEMPT_DYNAMIC Fri Aug 30 12:02:04 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /usr/share/doc/bpftrace/examples/ |
Upload File : |
Demonstrations of cpuwalk, the Linux bpftrace/eBPF version. cpuwalk samples which CPUs processes are running on, and prints a summary histogram. For example, here is a Linux kernel build on a 36-CPU server: # ./cpuwalk.bt Attaching 2 probes... Sampling CPU at 99hz... Hit Ctrl-C to end. ^C @cpu: [0, 1) 130 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ | [1, 2) 137 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ | [2, 3) 99 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ | [3, 4) 99 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ | [4, 5) 82 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ | [5, 6) 34 |@@@@@@@@@@@@ | [6, 7) 67 |@@@@@@@@@@@@@@@@@@@@@@@@ | [7, 8) 41 |@@@@@@@@@@@@@@@ | [8, 9) 97 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ | [9, 10) 140 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| [10, 11) 105 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ | [11, 12) 77 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@ | [12, 13) 39 |@@@@@@@@@@@@@@ | [13, 14) 58 |@@@@@@@@@@@@@@@@@@@@@ | [14, 15) 64 |@@@@@@@@@@@@@@@@@@@@@@@ | [15, 16) 57 |@@@@@@@@@@@@@@@@@@@@@ | [16, 17) 99 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ | [17, 18) 56 |@@@@@@@@@@@@@@@@@@@@ | [18, 19) 44 |@@@@@@@@@@@@@@@@ | [19, 20) 80 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ | [20, 21) 64 |@@@@@@@@@@@@@@@@@@@@@@@ | [21, 22) 59 |@@@@@@@@@@@@@@@@@@@@@ | [22, 23) 88 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ | [23, 24) 84 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ | [24, 25) 29 |@@@@@@@@@@ | [25, 26) 48 |@@@@@@@@@@@@@@@@@ | [26, 27) 62 |@@@@@@@@@@@@@@@@@@@@@@@ | [27, 28) 66 |@@@@@@@@@@@@@@@@@@@@@@@@ | [28, 29) 57 |@@@@@@@@@@@@@@@@@@@@@ | [29, 30) 59 |@@@@@@@@@@@@@@@@@@@@@ | [30, 31) 56 |@@@@@@@@@@@@@@@@@@@@ | [31, 32) 23 |@@@@@@@@ | [32, 33) 90 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ | [33, 34) 62 |@@@@@@@@@@@@@@@@@@@@@@@ | [34, 35) 39 |@@@@@@@@@@@@@@ | [35, 36) 68 |@@@@@@@@@@@@@@@@@@@@@@@@@ | This shows that all 36 CPUs were active, with some busier than others. Compare that output to the following workload from an application: # ./cpuwalk.bt Attaching 2 probes... Sampling CPU at 99hz... Hit Ctrl-C to end. ^C @cpu: [6, 7) 243 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| [7, 8) 0 | | [8, 9) 0 | | [9, 10) 0 | | [10, 11) 0 | | [11, 12) 0 | | [12, 13) 0 | | [13, 14) 0 | | [14, 15) 0 | | [15, 16) 0 | | [16, 17) 0 | | [17, 18) 0 | | [18, 19) 0 | | [19, 20) 0 | | [20, 21) 1 | | In this case, only a single CPU (6) is really active doing work. Only a single sample was taken of another CPU (20) running a process. If the workload was supposed to be making use of multiple CPUs, it isn't, and that can be investigated (application's configuration, number of threads, CPU binding, etc).