LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 05-24-2006, 12:27 PM   #1
romydmisc
LQ Newbie
 
Registered: May 2006
Posts: 3

Rep: Reputation: 0
How to get %CPU usage of a process


Hi All,

I'm working on a client server application and i've a feature to calculate CPU utilization of server and display on client GUI panel. My server is running on Mono on SUSE linux.

I know there have been similar threads open before for %CPU usage, but since there has been no discussion on them since 2003, i've started a new thread. I'm trying to find Peak CPU usage and average CPU usage of a process my server is running on. I also want to do it programmatically and not from command line.

I've implemented a similar feature for windows using System.Management API in C#.NET. But Mono doesn't support System.Management API yet. Is there a way i can calculate CPU usage of a process programatically on linux.

Thanks,
Reema
 
Old 05-24-2006, 01:37 PM   #2
sundialsvcs
Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 5,425

Rep: Reputation: 1159Reputation: 1159Reputation: 1159Reputation: 1159Reputation: 1159Reputation: 1159Reputation: 1159Reputation: 1159Reputation: 1159
The top command is often used to do this.

Also, take a look at the various "files" in /proc. These will tell you a lot of real-time information about the processes on the system.

Before you get too far, though, "google it" .. or rather, search this web-site. Monitoring the CPU usage et al of a process is a frequently-requested action that ought not require a new tool to be written from scratch.
 
Old 05-24-2006, 02:02 PM   #3
romydmisc
LQ Newbie
 
Registered: May 2006
Posts: 3

Original Poster
Rep: Reputation: 0
Thanks and i'm actually trying everywhere. But the bad news is, my deadline is tomorrow. I can't beleive how difficult is it to find CPU usage information for a process on linux as compare to how easy it is on windows to just use an .NET API.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
limit cpu % usage for a process student04 Linux - General 15 03-18-2014 08:22 PM
How to get %CPU usage of a process devershetty Linux - Newbie 1 08-18-2008 02:52 AM
How to get %CPU usage of a process devershetty Linux - Newbie 13 08-16-2008 12:51 PM
process cpu usage vanv101 Fedora 9 06-24-2005 06:53 PM
CPU usage of a process asharma Solaris / OpenSolaris 7 03-29-2003 03:17 PM


All times are GMT -5. The time now is 07:24 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration