1N/AThe following is a demonstration of the cpuwalk.d script,
1N/A
1N/A
1N/Acpuwalk.d is not that useful on a single CPU server,
1N/A
1N/A # cpuwalk.d
1N/A Sampling... Hit Ctrl-C to end.
1N/A ^C
1N/A
1N/A PID: 18843 CMD: bash
1N/A
1N/A value ------------- Distribution ------------- count
1N/A < 0 | 0
1N/A 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 30
1N/A 1 | 0
1N/A
1N/A PID: 8079 CMD: mozilla-bin
1N/A
1N/A value ------------- Distribution ------------- count
1N/A < 0 | 0
1N/A 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 10
1N/A 1 | 0
1N/A
1N/AThe output above shows that PID 18843, "bash", was sampled on CPU 0 a total
1N/Aof 30 times (we sample at 1000 hz).
1N/A
1N/A
1N/A
1N/AThe following is a demonstration of running cpuwalk.d with a 5 second
1N/Aduration. This is on a 4 CPU server running a multithreaded CPU bound
1N/Aapplication called "cputhread",
1N/A
1N/A # cpuwalk.d 5
1N/A Sampling...
1N/A
1N/A PID: 3 CMD: fsflush
1N/A
1N/A value ------------- Distribution ------------- count
1N/A 1 | 0
1N/A 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 30
1N/A 3 | 0
1N/A
1N/A PID: 12186 CMD: cputhread
1N/A
1N/A value ------------- Distribution ------------- count
1N/A < 0 | 0
1N/A 0 |@@@@@@@@@@ 4900
1N/A 1 |@@@@@@@@@@ 4900
1N/A 2 |@@@@@@@@@@ 4860
1N/A 3 |@@@@@@@@@@ 4890
1N/A 4 | 0
1N/A
1N/AAs we are sampling at 1000 hz, the application cputhread is indeed running
1N/Aconcurrently across all available CPUs. We measured the applicaiton on
1N/ACPU 0 a total of 4900 times, on CPU 1 a total of 4900 times, etc. As there
1N/Aare around 5000 samples per CPU available in this 5 second 1000 hz sample,
1N/Athe application is using almost all the CPU capacity in this server well.
1N/A
1N/A
1N/A
1N/AThe following is a similar demonstration, this time running a multithreaded
1N/ACPU bound application called "cpuserial" that has a poor use of locking
1N/Asuch that the threads "serialise",
1N/A
1N/A
1N/A # cpuwalk.d 5
1N/A Sampling...
1N/A
1N/A PID: 12194 CMD: cpuserial
1N/A
1N/A value ------------- Distribution ------------- count
1N/A < 0 | 0
1N/A 0 |@@@ 470
1N/A 1 |@@@@@@ 920
1N/A 2 |@@@@@@@@@@@@@@@@@@@@@@@@@ 3840
1N/A 3 |@@@@@@ 850
1N/A 4 | 0
1N/A
1N/AIn the above, we can see that this CPU bound application is not making
1N/Aefficient use of the CPU resources available, only reaching 3840 samples
1N/Aon CPU 2 out of a potential 5000. This problem was caused by a poor use
1N/Aof locks.
1N/A
1N/A
1N/A