Why CPU stats between ps and top Command are Different

ความแตกต่างของการใช้ command ps กับ top ในการดู CPU stat อยู่ตรงที่

  • คำสั่ง ps จะใช้วิธีการคำนวน cpu utilization ด้วย total CPU time หารด้วย time task is running
  • คำสั่ง top จะแสดงค่าในรูปแบบ percent ของค่า overall CPU time

การคิดค่า CPU Utilization ของคำสั่ง ps ถ้าในกรณีที่มี process หนึ่งรันอยู่เป็นเวลานานแต่ไม่ได้ใช้งาน CPU มากนัก เมื่อเราใช้คำสั่ง

#ps %cpu

จะเห็นว่าค่า CPU Utilization ของคำสั่งนี้จะน้อยมากๆ ดังนั้นเมื่อ ต้องการดูค่า CPU Utilization ในปัจจุบัน ให้ใช้คำสั่ง top ดู เพราะว่าจะถูกต้องมากกว่า ps

Related posts:

  1. What are the memory and CPU limits of the largesmp kernel in Red Hat Enterprise Linux 4? ใน RedHat v.4 (Update 3 ขึ้นไป) ที่ใช้งานกันอยู่ในปัจจุบันนี้ ทาง...
  2. Enable Dynamic CPU Speed Scaling in Linux เทคโนโลยีเกี่ยวกับการประหยัดพลังงานของ Linux ในชื่อ “cpuspeed” ได้ถูกพัฒนามาตั้งแต่ทาง intel และ amd...
  3. Use SNMP and MRTG to monitor CPU, MEM and Disk use status จากบทความที่แล้วเรื่องการติดตั้ง mrtg กับ IOSTAT ซึ่งเป็นการติดตั้งวิธีการที่ประยุกต์เอาคำสั่งพวก Monitor tools มาช่วยในการทำงานกับ...
  4. Setup MRTG to monitor CPU workload , Memory and Disk use status with IOSTAT. การติดตั้ง mrtg ในการ monitor สถานะต่างๆ ที่จะพูดถึงต่อไปนี้เป็นการนำ monitor tools...
  5. Get Squid Performance Statistic from command line เมื่อต้องการทราบรายละเอียดการทำงานของ Squid เราสามารถใช้คำสั่ง squidclient เพื่อใช้ในการขอดูข้อมูลต่างๆ ใน Squid *...

You can leave a response, or trackback from your own site.

Leave a Reply