Subject: Re: Slow output from 'ps'
To: Herb Peyerl <hpeyerl@beer.org>
From: Greg A. Woods <woods@kuma.web.net>
List: current-users
Date: 06/29/1995 14:58:00
[ On Thu, June 29, 1995 at 10:08:09 (-0600), Herb Peyerl wrote: ]
> Subject: Re: Slow output from 'ps' 
>
> [sidney tmp 14]; time ps -aux
> [processes deleted]
> 0.0u 0.3s 0:01.28 31.2% 0+0k 24+7io 0pf+0w

On 950603 NetBSD/sparc running on a Sparc IPC 4/40 w/12Mb RAM and a
single 660Mb sd0:

ttyp0:<woods@tar> # time ps -aux > /dev/null
        6.16 real         0.36 user         0.90 sys

[ Though there's a 'make build' going in the background... ]

It'll go as low as 4 seconds real if I run it several times in
succession, but user and sys time stay about the same.

I have an average of 61 processes running, but ktrace shows that ps goes
out to /dev/drum for 0x1000 bytes of data about 112 times.  In
comparison there are only 8 reads for 0x1000 bytes (and one for 0x104
bytes) of /var/db/kvm_netbsd.db.

pstat -s reports:
Device      512-blocks     Used    Avail Capacity  Type
/dev/sd0b       121496    63208    58288    52%    Interleaved

My guess is that reading /dev/drum on a busy single spindle system costs
an awful lot of wall-clock time.

BTW, given the amount of data ps reads, using 'ktrace -t cns' (i.e. not
the default, and definitely not 'ktrace -t i') generates a much more
manageable dump file.

-- 
							Greg A. Woods

+1 416 443-1734			VE3TCP			robohack!woods
Planix, Inc. <woods@planix.com>; Secrets Of The Weird <woods@weird.com>