Messages in this thread |  | | From | (Harald Koenig) | Subject | Re: linux equiv for pstat, NIS problems | Date | Mon, 16 Dec 1996 11:06:38 +0100 (MET) |
| |
> > > We are currently using "ps ax | wc -l" to get > > > the process total, but have not yet found a way to count total open files. > > > > Quick and dirty > > > > echo `find /proc/[0-9]* -path '*/fd/*' | wc -l` / \ > > `cat /proc/sys/kernel/file-max`
echo /proc/[0-9]*/fd/* | wc -w or set /proc/[0-9]*/fd/* echo $#
is a bit less overhead
> ahhhh....thanks =) Found what we need in /proc/sys/kernel/file-nr and > inode-nr, but you got me going in the right direction =) Much appreciated!
/proc/sys/kernel/file-nr doesn't seem to be the number of all open file descriptors. why ?!
# find /proc/[0-9]* -path '*/fd/*' | wc -l 185 # echo /proc/[0-9]*/fd/* | wc -w 188 # cat /proc/sys/kernel/file-nr 192
difference between "find" and "echo" method are due to open file handles of the interactive shell. but /proc/sys/kernel/file-nr is higher.
now I start 10 times
sleep 999 < /vmlinuz &
(you can redirect input or output to any unused/not_opened file) and now I get
# find /proc/[0-9]* -path '*/fd/*' | wc -l 215 # echo /proc/[0-9]*/fd/* | wc -w 218 # cat /proc/sys/kernel/file-nr 192
why didn't /proc/sys/kernel/file-nr change it's value at all ??
Harald -- All SCSI disks will from now on ___ _____ be required to send an email notice 0--,| /OOOOOOO\ 24 hours prior to complete hardware failure! <_/ / /OOOOOOOOOOO\ \ \/OOOOOOOOOOOOOOO\ \ OOOOOOOOOOOOOOOOO|// Harald Koenig, \/\/\/\/\/\/\/\/\/ Inst.f.Theoret.Astrophysik // / \\ \ koenig@tat.physik.uni-tuebingen.de ^^^^^ ^^^^^
|  |