Similar to the top command, the sar command also displays the overall CPU usage by default: $ sar -u 1 3 However, we can also install it manually using Linux package installers like Yum and Apt. In most machines, sysstat comes pre-installed. We can also use the tasksetcommand to add affinity so that the kernel always schedules the process on the configured core. To know the core utilization, we must identify the core on which the kernel has scheduled the process threads. However, as shown above, we still can’t figure out the per-core CPU usage of a specific process. ![]() Now, we can see that CPU0 utilizes 5.9%, and CPU1 utilizes 4.5% of the CPU on this two-core machine. If we want to know the CPU usage of each core, we can press “1” while the top command is active: $ top It only shows the overall used or idle CPU. However, we can see that this output doesn’t display per-core CPU usage. Furthermore, it also displays the utilization for all the users in the machine - for example, root and nginx from our output above. Notably, top displays the process-wise CPU usage together with the overall CPU usage. Tasks: 4 total, 1 running, 3 sleeping, 0 stopped, 0 zombie Simple syntax and the detailed snapshot of system resources makes top a common choice for identifying the CPU usage of the machine: $ top ![]() Generally speaking, the topcommand is the most popular choice for monitoring system resources.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |