Albrecht Uhlmann
|
Re: How to get performance metrics from API
|
Albrecht Uhlmann
03/12/2020 8:00 AM
post120365
|
Re: How to get performance metrics from API
I am wondering that the procfs DCMD control codes could not be used to obtain that information?
|
|
|
Jason Tiller
|
Re: How to get performance metrics from API
|
Jason Tiller
03/12/2020 2:43 PM
post120369
|
Re: How to get performance metrics from API
Hi, Elad,
Thank you for replying.
> The getrusage() function should give you the process run times. I'm not sure
> why it was never extended to provide information beyond that.
I would like to receive the usage time for my process's children, as well. getrusage() documentation says this:
"Which process to get the usage for:
RUSAGE_CHILDREN — get information about resources used by the terminated and waited-for children of the current
process. If the child is never waited for (e.g., if the parent has SA_NOCLDWAIT set, or sets SIGCHLD to SIG_IGN), the
resource information for the child process is discarded and isn't included. "
It appears that all children are accumulated into one result - is that correct? There's no way for me to query the usage
by PID for an individual child?
> Memory usage is a much trickier subject, as no single number can encompass the
> notion of "usage". If you look under /proc/<PID>/vmstat you will see different
> numbers corresponding to the amount of virtual address space used, how much of
> it is private as opposed to shared, how much private memory was reserved for
> the process, etc.
I'm not looking for a precise measurement but a coarse method to show the change in memory allocation over time. I'm
trying to show trends (memory leakage) and perhaps spikes (large changes in allocation) in applications that are
effectively daemons and are always running. In this scenario, I'm writing something akin to Unix 'init' and spawning
child processes at startup that I then want to monitor.
The getrusage has some conflicting info. It describes various members of the struct:
"ru_idrss
An “integral” value indicating the amount of memory in use by a process while the process is running. This value
is the sum of the resident set sizes of the process running when a clock tick occurs. The value is given in pages times
clock ticks. It doesn't take sharing into account. See the Caveats section, below."
Then in the Caveats it says:
"Only the timeval fields of struct rusage are supported."
Caveats then goes on to describe the inner workings of some other fields... but I can't tell if they're actually
supported or not.
Is ru_idrss something I could use?
Thanks again,
---Jason
|
|
|