please give me some advice about my script
The following code is for monitoring the memory used by apache processes. But I got a problem that the data I got by this script is much larger than the physical memory. It was said that there are some libraries used simultaneously by many processes, so the data I got has some double counted part. Because apache has many httpd processes.
Anyone have an idea of getting the multi-processes memory used? Thanks a lot! Code:
#!/bin/sh |
Maybe subtracting VmLib from each process will be more accurate...
cheers |
Quote:
VmPeak: 67980 kB VmSize: 67976 kB VmLck: 0 kB VmHWM: 5676 kB VmRSS: 5672 kB VmData: 4504 kB VmStk: 84 kB VmExe: 372 kB VmLib: 15324 kB And after I revising my script as the following Code:
#!/bin/bash I got the result : ElapsedTime VmSize VmRSS 14:08:14:487053684 31643556 3456272 14:08:28:750838950 31643556 3456272 but the physical memory is only 1G... |
It seems what you really want is the sum of private RSS ... someone has already written a script to do what you are trying to do though if that helps .. http://www.pixelbeat.org/scripts/ps_mem.py
cheers |
Quote:
|
Quote:
|
If you don't know python maybe you could wrap it in a shell script :
Code:
... |
Quote:
I think it will work, thanks a lot |
Quote:
Oh, I > the output to output.csv what is the difference between the .csv and .log ? It worked when I use .csv |
Your script was writing output as csv, you may have to massage the data from this one if you want in it the same format
|
Quote:
|
Maybe it's handling the load with the currently allocated resources .. ?
|
Quote:
|
'man nice'
|
Quote:
# sudo bash processname & and returned the pid of processname ,then sudo nice -20 pid Is there a way to get the pid of processname or bash without running with &? I mean run the script and return the pid of it . |
All times are GMT -5. The time now is 12:36 AM. |