Unix Programming - memory usage by a process

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > May 2005 > memory usage by a process





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

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.

torpedo@bluebottle.com

2005-05-01, 6:21 pm

The GNU C library provides the function to get the system resource
usage,if this is what exactly ur looking out for then check out the
link:

http://www.gnu.org/software/libc/ma...Limitation.html


torpedo

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

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com