LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch
User Name
Password
Linux From Scratch This Forum is for the discussion of LFS.
LFS is a project that provides you with the steps necessary to build your own custom Linux system.

Notices


Reply
  Search this Thread
Old 07-23-2010, 02:02 AM   #1
qquest
LQ Newbie
 
Registered: Jul 2010
Posts: 2

Rep: Reputation: 0
Thumbs up How to get cpu % without calling system api


Hi Folks,
I need an requirement like get the cpu% of particular process without calling system call.
I have to handle load in my application. for every new request i have to check the cpu usage of application.
If we use system call for every request, that will take more cpu usage.

Is any way to get the cpu% other than system call?

am very new to linux. please help me to get rid of.

Thanks in advance

-vijay
 
Old 07-23-2010, 02:38 AM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,130

Rep: Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121
Define API.
How do you expect to get CPU usage without entering kernelspace to get the numbers ?.

All the data you need is exposed via /proc - you will need to do the (percentage) math yourself.
 
Old 07-23-2010, 03:44 AM   #3
qquest
LQ Newbie
 
Registered: Jul 2010
Posts: 2

Original Poster
Rep: Reputation: 0
Thanks for your immediate reply...

/proc also collect these info from kernel?

kernel will not expose these kind of info to user?

I meant kernel not maintaining any structure for these info to user to get these info directly rather than getting it to kernel

-vijay

Last edited by qquest; 07-23-2010 at 04:29 AM.
 
Old 07-23-2010, 06:32 AM   #4
crts
Senior Member
 
Registered: Jan 2010
Posts: 2,020

Rep: Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757
Hi,

since this is not a Linux From Scratch related question you should ask a moderator to move this thread to a better suited forum, e. g. programming.
 
Old 08-14-2010, 10:17 AM   #5
Aquarius_Girl
Senior Member
 
Registered: Dec 2008
Posts: 4,731
Blog Entries: 29

Rep: Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940
Vijay,

Use the "Report" button of your first post to report the thread to moderators. Posting the report message on their profiles is useless !!
 
  


Reply



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
API to getting the system information in ubuntu naveenisback Programming 3 09-23-2009 04:49 AM
difference between system call and api vinaytp Linux - Newbie 3 05-06-2009 09:47 AM
Gprof does not profile system API? George2 Programming 8 02-13-2007 08:08 AM
how to get all invoked system API of a program George2 Programming 3 07-21-2006 02:12 AM
System shutdown when calling SETUP. Tobbe Slackware 6 06-26-2003 11:03 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch

All times are GMT -5. The time now is 05:11 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration