From owner-freebsd-arch Sun Mar 31 17:28:11 2002 Delivered-To: freebsd-arch@freebsd.org Received: from wantadilla.lemis.com (wantadilla.lemis.com [192.109.197.80]) by hub.freebsd.org (Postfix) with ESMTP id 9C45537B416 for ; Sun, 31 Mar 2002 17:28:06 -0800 (PST) Received: by wantadilla.lemis.com (Postfix, from userid 1004) id 7E4E67830D; Mon, 1 Apr 2002 10:58:04 +0930 (CST) Date: Mon, 1 Apr 2002 10:58:04 +0930 From: Greg 'groggy' Lehey To: Dag-Erling Smorgrav Cc: arch@freebsd.org Subject: Re: mutex profiling Message-ID: <20020401105804.B26813@wantadilla.lemis.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.3.23i Organization: The FreeBSD Project Phone: +61-8-8388-8286 Fax: +61-8-8388-8725 Mobile: +61-418-838-708 WWW-Home-Page: http://www.FreeBSD.org/ X-PGP-Fingerprint: 6B 7B C3 8C 61 CD 54 AF 13 24 52 F8 6D A4 95 EF Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Monday, 1 April 2002 at 0:07:18 +0200, Dag-Erling Smorgrav wrote: > The attached patch (derived from patches by Eivind) adds code to > record statistics about MTX_DEF locks. It's currently i386-only as it > uses the TSC to measure the amount of time each mutex is held. Once > compiled in and enabled, statistics can be retrieved using sysctl(8). > The code records four numbers for each mutex (longest time held in one > go, total time held, number of acquisitions, average time held) and > returns a top-16 list for each. Each mutex is identified by the place > where it was first acquired, so multiple instances of the same type of > mutex (e.g. proc lock, filedesc lock) are counted as one. Here's a > sample listing (with some annotations): Excellent! Of course, it could be better :-) It would be nice to get a list by lock of each of the four parameters, something like: max total count average i386/i386/machdep.c:1715 10653798 5472784414 1127992 4852 (repeat for each lock) One of the things that I can't recall anybody looking at has been whether to spin or block on each kind of lock. This information would help make that decision. What units are the times in? If the average time spent in Giant is 4852 µs, I'd say it's definitely a waste of time to spin on it at all. If it's 4852 ns, it's probably the correct thing to do. Greg -- See complete headers for address and phone numbers To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message