La memoria total utilizada por una línea de comando de proceso

I was trying to find a way to find the total memory used by a process via commandline and came across this

top -b -n 1 | grep -i procss_name

  562 procss_name  20   0  198m 128m 1548 S    0  1.7   0:00.17 procss_name

since the process that i need to find the memory usage of, has many forks, the above command looks like

15098 procss_name  20   0  198m 128m 1344 S    0  1.7   0:00.30 procss_name
15099 procss_name  20   0  198m 128m 1500 S    0  1.7   0:00.20 procss_name
15100 procss_name  20   0  198m 128m 1460 S    0  1.7   0:00.11 procss_name
29925 procss_name  20   0  198m 129m 2832 S    0  1.7   0:02.76 procss_name
29926 procss_name  20   0  199m 127m 1044 S    0  1.7   0:00.33 procss_name

I know that the 198M shows the virtual memory usage, 128M shows the resident size, 1344 shows the shared mem usage, 0 shows the %CPU, and 1.7 shows the %mem usage. So my question is this: Are all these values pertaining to that particular child that has been forked, or is it the total of all the forked children. That is regarding the mem usage %, all have 1.7%. Does that mean that each child is using 1.7% or the total process is using 1.7%?

preguntado el 31 de enero de 12 a las 08:01

You can't tell from this information. What is it you realmente want to know? It's likely there's a way to find that out. -

consider also that the memory that a process is using is different form the memory that will be freed when the process end. -

@DavidSchwartz : the total memory(physical ram) usage and the total cpu usage by the process "procss_name" (by the parent process and all its children process) -

The OS doesn't track the exact information you want. But you can approximate it: (Sum of RSS values) - (Minimum RSS value * (number of processes - 1 ) ). In this case (128+128+128+129+127)-(127*4) or 132MB. -

0 Respuestas

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.