From owner-freebsd-stable@FreeBSD.ORG Wed Oct 8 07:42:54 2008 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9CB8C106568B for ; Wed, 8 Oct 2008 07:42:54 +0000 (UTC) (envelope-from smithi@nimnet.asn.au) Received: from sola.nimnet.asn.au (paqi.nimnet.asn.au [220.233.188.227]) by mx1.freebsd.org (Postfix) with ESMTP id 1D6128FC22 for ; Wed, 8 Oct 2008 07:42:53 +0000 (UTC) (envelope-from smithi@nimnet.asn.au) Received: from localhost (localhost [127.0.0.1]) by sola.nimnet.asn.au (8.14.2/8.14.2) with ESMTP id m987gqsB001679; Wed, 8 Oct 2008 18:42:52 +1100 (EST) (envelope-from smithi@nimnet.asn.au) Date: Wed, 8 Oct 2008 18:42:52 +1100 (EST) From: Ian Smith To: lhmwzy In-Reply-To: <78fb9d960810080019j3b73e3ffidc189c716fb7a1de@mail.gmail.com> Message-ID: <20081008183552.W16723@sola.nimnet.asn.au> References: <200810071314.45922.max@love2party.net> <48EB5ADD.2090900@modulus.org> <78fb9d960810072118k47a64097yaa486ef5179efb1@mail.gmail.com> <20081008165835.C16723@sola.nimnet.asn.au> <78fb9d960810080019j3b73e3ffidc189c716fb7a1de@mail.gmail.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Cc: freebsd-stable@freebsd.org Subject: Re: zfs quota question X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Oct 2008 07:42:54 -0000 On Wed, 8 Oct 2008, lhmwzy wrote: > OK.It's my mistake. > Improve it again: > > #!/bin/sh > find $1 -type f -ls | awk '{j += $7} END {printf("%.2fM\n",j/1024/1024)}' Sure. Here it runs about 7% faster precalculating one division: $ time find . -type f -ls | awk '{j += $7} END {printf("%.2fM\n",j/1048576)}' 2.69 real 0.64 user 1.21 sys 6586.34M > > $ du -d0 . > > 6781976 . > > > > Took 1.5 seconds, and comes to 69447434424, ie bytes allocated for those And my mistake, transcribing from the calculator: should be 6944743424. cheers, Ian