LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-04-2003, 11:00 PM   #1
GoboFraggle
LQ Newbie
 
Registered: Jan 2003
Posts: 10

Rep: Reputation: 0
What /proc proc file do I need?


I need to write a program that displays the amount of time that the CPU has spent in user mode, system mode, and idle. I also need the number of disksrequests on the system, the number of context switches that the kernel has performed, and the number of processes that have been created since the system was booted. I know there should be /proc files that I can get this info from, but I don't know which ones. Can anyone help?
 
Old 02-05-2003, 12:52 AM   #2
moeminhtun
Member
 
Registered: Dec 2002
Location: Singapore
Distribution: Fedora Core 6
Posts: 647

Rep: Reputation: 30
Everything you want is in the "/proc/stat" file.

For the cpu time spent, there are CPU and CPU0 field.
cpu 177343 22777 24422 1344414
cpu0 177343 22777 24422 1344414

cpu is the overall time-spent and cpu0 is the per-cpu time-spent.
The numbers are in this format.

user, nice, system, idle

And "disk_io" field for the disk requests, "ctxt" for the context switches and "processes" field for the proceses.
 
  


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
/proc/sys/fs/file-nr ?? jharris Linux - General 5 07-27-2009 07:07 PM
Correlation between /proc/devices and /proc/modules ColinLadyka Linux - General 1 02-13-2006 06:25 PM
how proc file use to hibernation sajjadc Linux - Software 0 06-07-2005 02:06 PM
Reading from a /proc file russelh Programming 2 12-02-2004 06:30 PM
how do i compile /proc file? eltn Programming 12 10-20-2004 06:15 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:51 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration