Find the answer to your Linux question:
Results 1 to 6 of 6
Hello Guys, I am examining a code that uses OpenMP APIs and I would like to see the CPU usage in my Fedora machine when running the code. I have ...
  1. #1
    Just Joined!
    Join Date
    Dec 2009
    Posts
    3

    Post [SOLVED] How to find out cpu usage?

    Hello Guys,

    I am examining a code that uses OpenMP APIs and I would like to see the CPU usage in my Fedora machine when running the code. I have a dual core so I am expecting to see a single core usage when running the code without OpenMP and then see both cores busy when OpenMP is applied.

    I tried mpstat -P ALL and I ssh to the machine with two terminals, one to run the program and the other to type the mpstat command. But I did not see any change in the cpu usage and almost always I get the following numbers:

    11:46:53 PM CPU %user %nice %sys %iowait %irq %soft %steal %idle intr/s
    11:46:53 PM all 0.98 0.01 0.56 0.01 0.00 0.00 0.00 98.44 230.57
    11:46:53 PM 0 0.52 0.01 0.19 0.01 0.00 0.00 0.00 99.28 15.65
    11:46:53 PM 1 1.43 0.01 0.93 0.00 0.01 0.00 0.00 97.62 27.53

    I have tried the top command which list the processes usage and I can see my code using 100% of cpu (when OpenMP is off) but I do not know why such statistics do not show up on mpstat :s

    Any recommendation guys on how to accomplish what I am after?

  2. #2
    Linux Engineer b2bwild's Avatar
    Join Date
    Jul 2008
    Location
    Behind You!
    Posts
    1,108
    use
    Code:
    ps -aux | grep nameofexecutable
    3rd column is %CPU
    Never make any misteaks.

    Read my Blog at --> Penguin Inside Subscribe Feed

  3. #3
    Just Joined!
    Join Date
    Dec 2009
    Posts
    3
    Quote Originally Posted by b2bwild View Post
    use
    Code:
    ps -aux | grep nameofexecutable
    3rd column is %CPU
    Thanks for your reply. This command gives the overall usage but I wanna know the usage per core so what can I do?

  4. #4
    Just Joined! AsusDave's Avatar
    Join Date
    Dec 2009
    Posts
    2
    What about the system monitor app in GNOME? Assuming that is, you use GNOME.

    HTH
    Dave

  5. #5
    Linux Engineer b2bwild's Avatar
    Join Date
    Jul 2008
    Location
    Behind You!
    Posts
    1,108
    PS, won't show usage for multicore cpus or multiple cpus. it got only %c formatter for whole cpu usages.

    May be you should use taskset command to set affinity for a process. then check its cpu usage.
    Never make any misteaks.

    Read my Blog at --> Penguin Inside Subscribe Feed

  6. #6
    Just Joined!
    Join Date
    Dec 2009
    Posts
    3
    Hello Guys,

    Thank you all for your response. I guess I found what I am looking for. If you go to Fedora --> applications --> system --> system monitor and click the system load tab, you will see the CPU load history per core as well as the memory and network traffic. The cpu usage there is what I am looking for since there is two plots one for each core of my dual processor machine.

    Thanks all for your response.

Posting Permissions

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