From owner-freebsd-current@FreeBSD.ORG Mon Dec 14 12:49:03 2009 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BABBF1065676 for ; Mon, 14 Dec 2009 12:49:03 +0000 (UTC) (envelope-from sson@FreeBSD.org) Received: from ns1.son.org (son.org [65.48.68.179]) by mx1.freebsd.org (Postfix) with ESMTP id 82AC68FC23 for ; Mon, 14 Dec 2009 12:49:03 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by ns1.son.org (Postfix) with ESMTP id 9314D197F30; Mon, 14 Dec 2009 06:33:52 -0600 (CST) X-Virus-Scanned: amavisd-new at son.org Received: from ns1.son.org ([127.0.0.1]) by localhost (ns1.dev-random.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id NO8BP+mc2Oko; Mon, 14 Dec 2009 06:33:47 -0600 (CST) Received: from nextstepng.son.org (unknown [99.157.26.76]) by ns1.son.org (Postfix) with ESMTP id 35F73197F29; Mon, 14 Dec 2009 06:33:47 -0600 (CST) Mime-Version: 1.0 (Apple Message framework v1077) Content-Type: text/plain; charset=us-ascii From: Stacey Son In-Reply-To: <4B25D32B.70306@elischer.org> Date: Mon, 14 Dec 2009 06:33:45 -0600 Content-Transfer-Encoding: quoted-printable Message-Id: <3498D1C3-3330-463E-9D9E-2A487185F46C@FreeBSD.org> References: <4B25D32B.70306@elischer.org> To: Julian Elischer X-Mailer: Apple Mail (2.1077) Cc: FreeBSD Current Subject: Re: profiling kernel modules. X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 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: Mon, 14 Dec 2009 12:49:03 -0000 On Dec 13, 2009, at 11:54 PM, Julian Elischer wrote: > It's been a few years since I last profiled the kernel, (probably a = decade :-) but it was always a monolithic compiled kernel. Now I want = to profile a module, but I'm not finding a lot of specific instructions = as to how to do this, For example how to get the loaded addresses for = the modules taken into account, or what arguments need to be added to = the compile of the module to make sure it has any code stubs that may be = needed, etc. >=20 > if you know anything about these subjects, or related (e.g. usin > the performance counters in the kernel/modules I'd love to get your = inpout and maybe turn out a doc on how to do this. >=20 > This would be for -current (9) or 8.0R. Hi Julian: You might want to take a look at using the 'lockstat' command, in = particular its '-I' option (see = http://docs.sun.com/app/docs/doc/816-5212/6mbcdgk0m?a=3Dview or = lockstat(1)). lockstat depends on the dtrace and the pseudo driver = ksyms bits in the kernel. The ksyms driver provides lockstat with a = complete symbol table (including all the symbols of any loaded kernel = modules). See http://people.freebsd.org/~sson/ksyms/ksyms.4.txt or = ksyms(4). See http://wiki.freebsd.org/DTrace for adding the dtrace bits and add = 'device ksyms' to your kernel config file. You will need to load both = the 'dtraceall' and 'ksyms' kernel modules before you can successfully = use the 'lockstat' command. Best Regards, -stacey.