Find the answer to your Linux question:
Results 1 to 2 of 2
i want to calculate %cpu usages... as glibtop is not available and i don't wanna use top under system()... so can any body help me in understanding user, nice, sys ...
  1. #1
    Just Joined! raj.aprilfool's Avatar
    Join Date
    Dec 2006
    Location
    Mumbai, India
    Posts
    35

    /proc/stat

    i want to calculate %cpu usages... as glibtop is not available and i don't wanna use top under system()... so can any body help me in understanding user, nice, sys and idle fields and it would be helpful if any math formula is given.....

    thanx....

  2. #2
    Just Joined! raj.aprilfool's Avatar
    Join Date
    Dec 2006
    Location
    Mumbai, India
    Posts
    35
    ok.... i think i figured out... the numbers r no of jiffies spent in each context (jiffies = 10ms)

    so i for demo purpose, i took 2 iteration at an interval of 5 sec so
    for percentage cpu load in user mode= (userITR2 - userITR1) / 5

    i guess it is right.... is it??

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...