| Author |
memory usage by a process
|
|
| Niraj123 2005-05-01, 6:21 pm |
| Is their any system call or library to find the memory usage of a
particular process nd total cpu utilization of a particular system.
I dont wanna use top command and proc directory.
TIA
Niraj
| |
| David Schwartz 2005-05-01, 6:21 pm |
|
"Niraj123" <niraj.kumar.ait@gmail.com> wrote in message
news:f1f62115.0504282059.7f833e87@posting.google.com...
> Is their any system call or library to find the memory usage of a
> particular process nd total cpu utilization of a particular system.
>
> I dont wanna use top command and proc directory.
What's wrong with calling the 'top' or 'ps' command? They're the closest
to a platform-independent solution you're likely to find.
Also, what does "memory usage" mean? Is virtual memory that has no
resident physical page "used"? Is a shared library used by three programs
part of the memory usage of all of those programs? None of them?
You need to give us a lot more information on what exactly you want to
know, whether you need a platform-specific solution or a
platform-independent one, and why the obvious solutions aren't acceptable to
you.
DS
| |
| niraj.kumar.ait@gmail.com 2005-05-01, 6:21 pm |
| Actually when i use top command then it give whole information in text
format i can redirect in into file but again i will have to parse the
text file which i dont want to do.
I just need the % memory utilization & %cpu utilization of a particular
process without parsing the test file.Total cpu & memory utilization of
the system.
| |
|
|
| Jhair Tocancipa Triana 2005-05-01, 6:21 pm |
| niraj kumar ait writes:
> Actually when i use top command then it give whole information in text
> format i can redirect in into file but again i will have to parse the
> text file which i dont want to do.
> I just need the % memory utilization & %cpu utilization of a particular
> process without parsing the test file.Total cpu & memory utilization of
> the system.
libstatgrab does just that.
http://www.i-scream.org/libstatgrab/
--
--Jhair
PGP key available from public servers - ID: 0xBAA600D0
| |
| niraj.kumar.ait@gmail.com 2005-05-01, 6:21 pm |
| processes has only two valid values:
RUSAGE_SELF
Just the current process.
RUSAGE_CHILDREN
All child processes (direct and indirect) that have already
terminated.
so we cant use that for other process which is currently running
|
|
|
|