LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
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 11-30-2004, 10:38 PM   #1
r_213
Member
 
Registered: Sep 2004
Posts: 36

Rep: Reputation: 15
API's to get process info


Hi,

I would like to know if there is any alternative to get information about the processes running other than accessing /proc/<pidlist>/ files.


Regards,
Rangan
 
Old 12-01-2004, 07:50 AM   #2
Quartz
LQ Newbie
 
Registered: Jan 2004
Location: Grenoble - France
Posts: 7

Rep: Reputation: 0
Use getrusage()

Not all informations are set.

/* Structure which says how much of each resource has been used. */
struct rusage
{
/* Total amount of user time used. */
struct timeval ru_utime;
/* Total amount of system time used. */
struct timeval ru_stime;
/* Maximum resident set size (in kilobytes). */
long int ru_maxrss;
/* Amount of sharing of text segment memory
with other processes (kilobyte-seconds). */
long int ru_ixrss;
/* Amount of data segment memory used (kilobyte-seconds). */
long int ru_idrss;
/* Amount of stack memory used (kilobyte-seconds). */
long int ru_isrss;
/* Number of soft page faults (i.e. those serviced by reclaiming
a page from the list of pages awaiting reallocation. */
long int ru_minflt;
/* Number of hard page faults (i.e. those that required I/O). */
long int ru_majflt;
/* Number of times a process was swapped out of physical memory. */
long int ru_nswap;
/* Number of input operations via the file system. Note: This
and `ru_oublock' do not include operations with the cache. */
long int ru_inblock;
/* Number of output operations via the file system. */
long int ru_oublock;
/* Number of IPC messages sent. */
long int ru_msgsnd;
/* Number of IPC messages received. */
long int ru_msgrcv;
/* Number of signals delivered. */
long int ru_nsignals;
/* Number of voluntary context switches, i.e. because the process
gave up the process before it had to (usually to wait for some
resource to be available). */
long int ru_nvcsw;
/* Number of involuntary context switches, i.e. a higher priority process
became runnable or the current process used up its time slice. */
long int ru_nivcsw;
};
 
Old 12-04-2004, 04:22 AM   #3
r_213
Member
 
Registered: Sep 2004
Posts: 36

Original Poster
Rep: Reputation: 15
Does this also give the state of a process? its name...arguments?
 
Old 12-06-2004, 01:07 AM   #4
r_213
Member
 
Registered: Sep 2004
Posts: 36

Original Poster
Rep: Reputation: 15
Anybody having any idea on this?
 
Old 12-06-2004, 08:23 AM   #5
Quartz
LQ Newbie
 
Registered: Jan 2004
Location: Grenoble - France
Posts: 7

Rep: Reputation: 0
TO have process name or arguments, you must either call user command ps (beware about POSIX compliance), or use /proc.
 
  


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
get info about a specific process hfawzy Programming 4 01-31-2007 01:11 PM
how to send some info to a process? puishor Programming 1 11-28-2005 03:09 PM
how to get more process' info according to its PID? iclinux Programming 1 02-05-2005 05:30 AM
INFO: configuring monit (process monitoring) markus1982 Linux - Software 0 05-25-2003 05:39 AM
Process Info (more than ps ) LammaDog Linux - Newbie 2 05-12-2002 02:22 AM

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

All times are GMT -5. The time now is 11:16 AM.

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