Why CPU stats between ps and top Command are Different

Posted In System - By Tum. On Wednesday, August 12th, 2009 With 0 Comments

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

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

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

#ps -up PID

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

คำค้นยอดนิยม: การใช้งานคำสั่ง top

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">

*