From owner-freebsd-current@FreeBSD.ORG Fri Apr 30 02:42:39 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 947CB16A4CE; Fri, 30 Apr 2004 02:42:39 -0700 (PDT) Received: from mail005.syd.optusnet.com.au (mail005.syd.optusnet.com.au [211.29.132.54]) by mx1.FreeBSD.org (Postfix) with ESMTP id 06D0143D64; Fri, 30 Apr 2004 02:42:38 -0700 (PDT) (envelope-from PeterJeremy@optushome.com.au) Received: from cirb503493.alcatel.com.au (c211-30-75-229.belrs2.nsw.optusnet.com.au [211.30.75.229]) i3U9gZw07427; Fri, 30 Apr 2004 19:42:35 +1000 Received: from cirb503493.alcatel.com.au (localhost.alcatel.com.au [127.0.0.1])i3U9gZcj026338; Fri, 30 Apr 2004 19:42:35 +1000 (EST) (envelope-from jeremyp@cirb503493.alcatel.com.au) Received: (from jeremyp@localhost)i3U9gY05026337; Fri, 30 Apr 2004 19:42:34 +1000 (EST) (envelope-from jeremyp) Date: Fri, 30 Apr 2004 19:42:34 +1000 From: Peter Jeremy To: Brian Fundakowski Feldman Message-ID: <20040430094234.GC6481@cirb503493.alcatel.com.au> References: <200404291120.39967.jhb@FreeBSD.org> <200404291855.i3TItUTr048530@green.homeunix.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200404291855.i3TItUTr048530@green.homeunix.org> User-Agent: Mutt/1.4.2i cc: freebsd-current@freebsd.org Subject: Re: code cleanup X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Apr 2004 09:42:39 -0000 On Thu, 2004-Apr-29 14:55:30 -0400, Brian Fundakowski Feldman wrote: >For what it's worth, I don't think it is good to hide things as much as >FOREACH_PROC_IN_SYSTEM() -- this specific instance -- does, but grep is not >a good tool for a tree as large as FreeBSD's. Try using cscope instead. My personal favourite is id-utils. It is much faster to rebuild its database and the database is an order of magnitude smaller (times are with pre-loaded disk cache on a 4.x /usr/src/sys & system): server# time mkid 3.514u 0.304s 0:03.83 99.4% 61+14307k 0+44io 0pf+0w server# time cscope -qRb 13.185u 1.587s 0:15.16 97.3% 225+1449k 0+2347io 0pf+0w server# ls -l ID cscope.* -rw-r--r-- 1 root wheel 5578214 Apr 30 19:13 ID -rw-r--r-- 1 root wheel 4813824 Apr 30 19:14 cscope.in.out -rw-r--r-- 1 root wheel 33824567 Apr 30 19:14 cscope.out -rw-r--r-- 1 root wheel 26077716 Apr 30 19:14 cscope.po.out server# It saves space by just storing a bit-array of filenames vs identifier names and using a builtin grep to pick lines out of the files. It can parse a variety of languages but doesn't distinguish definitions, declarations or references. On the plus side, it can search by numeric value, independent of the base (it knows 10, 012, 00012, 0x0a etc are all equivalent). My favourite is "less -p `lid IDENTIFIER`" to browse code that includes references to IDENTIFIER. -- Peter Jeremy