From owner-freebsd-performance@FreeBSD.ORG Tue Jan 3 08:21:12 2012 Return-Path: Delivered-To: freebsd-performance@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 171351065677 for ; Tue, 3 Jan 2012 08:21:12 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-tul01m020-f182.google.com (mail-tul01m020-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id D6E828FC0C for ; Tue, 3 Jan 2012 08:21:11 +0000 (UTC) Received: by obbwd18 with SMTP id wd18so18297520obb.13 for ; Tue, 03 Jan 2012 00:21:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=4FlWYbJc/szY//NcNQfD9tJRgdtR1ONn1G3ZUJDLoJk=; b=efeOZZp7DiSzsuxTzcSjuPQ0wGtN3t6cCDy8UyP9/qwDXNtskI6/rwdRQ8WkY2dBKY p9mlVxgxMVcmVb5y/BHd6YNKZJDtjFqZrJ6C213EG44M6czCsU1UWXWzSk4/DQTwYZWW s5pexBDqTshANp41CQ6V8EPovJ7bs7poeRtco= MIME-Version: 1.0 Received: by 10.182.1.67 with SMTP id 3mr44120134obk.31.1325578870547; Tue, 03 Jan 2012 00:21:10 -0800 (PST) Received: by 10.182.152.6 with HTTP; Tue, 3 Jan 2012 00:21:10 -0800 (PST) In-Reply-To: <20120103073736.218240@gmx.com> References: <20120103073736.218240@gmx.com> Date: Tue, 3 Jan 2012 00:21:10 -0800 Message-ID: From: Garrett Cooper To: Dieter BSD Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: freebsd-performance@freebsd.org Subject: Re: cmp(1) has a bottleneck, but where? X-BeenThere: freebsd-performance@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Performance/tuning List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Jan 2012 08:21:12 -0000 On Mon, Jan 2, 2012 at 11:37 PM, Dieter BSD wrote: >>>>> Task: cp(1) a several-GB file from one drive to another, >>>>> then run cmp(1) to verify. Cp runs as expected, but >>>>> cmp runs slower than expected. Neither the disks >>>>> nor the cpu is maxed out. Local drives, no network >>>>> involved. Machine is otherwise idle. >>>> >>>> 1. How are you running cmp? >>>> 2. Why do you claim cmp is the bottleneck? Is it spinning the CPU? >>> >>> cmp big_file /other_disk/big_file >>> >>> Cmp is running slower than it should. It isn't cpu bound ( 67.5%Idle ) >>> but it isn't disk bound either. Seems like it should be one or the >>> other. >> >> =A0 =A0What gets output on the console when you do CTRL-T? > > load: 0.59 =A0cmd: cmp 93304 [vnread] 56.99r 8.50u 3.80s 23% 720k > load: 0.59 =A0cmd: cmp 93304 [vnread] 57.68r 8.60u 3.85s 22% 720k > load: 0.54 =A0cmd: cmp 93304 [vnread] 60.69r 9.03u 4.12s 22% 780k > load: 0.54 =A0cmd: cmp 93304 [runnable] 63.79r 9.58u 4.26s 22% 720k > load: 0.58 =A0cmd: cmp 93304 [runnable] 68.33r 10.28u 4.62s 21% 788k > load: 0.53 =A0cmd: cmp 93304 [runnable] 71.92r 10.78u 4.94s 23% 720k > load: 0.53 =A0cmd: cmp 93304 [vnread] 72.31r 10.84u 4.96s 21% 780k > load: 0.44 =A0cmd: cmp 93304 [vnread] 198.84r 30.64u 14.36s 23% 720k Here's a pastebin to the gprof output for cmp of two almost identical files (I added a byte at the end of the file): http://pastebin.com/Rw355d8G . Here's the time output of the process: $ /usr/bin/time -l /usr/obj/usr/src/usr.bin/cmp/cmp /scratch/foo.iso* 99.48 real 27.35 user 33.32 sys 5820 maximum resident set size 251 average shared memory size 2083 average unshared data size 127 average unshared stack size 1310 page reclaims 1569083 page faults 0 swaps 49325 block input operations 88 block output operations 0 messages sent 0 messages received 0 signals received 396 voluntary context switches 13514 involuntary context switches $ uname -a FreeBSD streetfighter.ixsystems.com 10.0-CURRENT FreeBSD 10.0-CURRENT #0 r227801: Mon Nov 21 14:04:39 PST 2011 root@streetfighter.ixsystems.com:/usr/obj/usr/src/sys/STREETFIGHTER amd64 The file is 3.0GB in size. Look at all those page faults though! Thanks! -Garrett