1 The following demonstrates running the cputimes program on an idle system.
2 We use an interval of 1 second and a count of 3,
21 In the above output, we can see a breakdown of CPU time into the catagories
22 KERNEL, PROCESS and IDLE. The time is measured in nanoseconds. Most of the
23 time is in the IDLE category, as the system is idle. Very little time
24 was spent serving the kernel.
29 In the following example, several programs are run to hog the CPUs,
45 Now there is no IDLE category, as the system is 100% utilised.
46 The programs were the following,
50 which keeps the CPU busy.
55 In the following example a different style of program is run to hog the CPUs,
57 while :; do date; done
59 This causes many processes to be created and destroyed in a hurry, and can
60 be difficult to troubleshoot (tools like prstat cannot sample quick enough
61 to easily identify what is going on). The following is the cputimes output,
77 Now the kernel is doing a substantial amount of work to create and destroy
83 In the following example, a large amount of network activity occurs while
102 2005 Apr 27 23:49:32,
107 2005 Apr 27 23:49:33,
112 2005 Apr 27 23:49:34,
118 Initially the system is idle. A command is run to cause heavy network
119 activity, which peaks during the fourth sample - during which the kernel
120 is using around 40% of the CPU. The Solaris 10 command "intrstat" can
121 help to analyse this activity further.
126 Longer samples are possible. The following is a 60 second sample,
129 2005 Apr 27 23:53:02,
139 cputimes has a "-a" option to print all processes. The following is a
140 single 1 second sample with -a,
143 2005 Apr 28 00:00:32,
163 gnome-terminal 74304348
167 The times are in nanoseconds, and multiple processes with the same name
168 have their times aggregated. The above output is at an amazing resolution -
169 svc.startd ran for 51 microseconds, and soffice.bin ran for 28 milliseconds.
174 The following is a 10 second sample on an idle desktop,
177 2005 Apr 28 00:03:57,
183 mapping-daemon 197674
189 gnome-vfs-daemon 549037
193 gnome-netstatus- 4329671
194 mixer_applet2 4833519
201 gnome-terminal 34891991
207 Wow, maybe not as idle as I thought!