Date: Fri, 09 Jul 2004 00:24:00 +0200 From: des@des.no (=?iso-8859-1?q?Dag-Erling_Sm=F8rgrav?=) To: Giorgos Keramidas <keramida@freebsd.org> Cc: current@freebsd.org Subject: Re: RFC: Sorting in top -m io Message-ID: <xzpwu1e3zpb.fsf@dwp.des.no> In-Reply-To: <20040707124751.GA66588@orion.daedalusnetworks.priv> (Giorgos Keramidas's message of "Wed, 7 Jul 2004 15:47:51 %2B0300") References: <20040707124751.GA66588@orion.daedalusnetworks.priv>
next in thread | previous in thread | raw e-mail | index | archive | help
Giorgos Keramidas <keramida@freebsd.org> writes: > What do you all think of this patch to top(1)? extremely inefficient; get_io_stats() is an expensive function and you really don't want to call it approximately log(n) per process while sorting, especially when it returns the same values every time. an ugly trick to get around this is to have get_process_info() store io stats in ki_spare[] or some other unused kinfo_proc field, so you never need to call get_io_stats() outside get_process_info(). you should also do secondary sort orders like the existing compare_*() functions do, since qsort() is unstable, so processes with identical stats will jump around if they aren't also sorted by name or some other secondary criterion. DES --=20 Dag-Erling Sm=F8rgrav - des@des.no
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?xzpwu1e3zpb.fsf>