From owner-freebsd-hackers@FreeBSD.ORG Thu Feb 19 03:07:49 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A580F106564A for ; Thu, 19 Feb 2009 03:07:49 +0000 (UTC) (envelope-from joseph.koshy@gmail.com) Received: from wf-out-1314.google.com (wf-out-1314.google.com [209.85.200.172]) by mx1.freebsd.org (Postfix) with ESMTP id 78CAD8FC0A for ; Thu, 19 Feb 2009 03:07:49 +0000 (UTC) (envelope-from joseph.koshy@gmail.com) Received: by wf-out-1314.google.com with SMTP id 27so216278wfd.7 for ; Wed, 18 Feb 2009 19:07:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=ABVsHrGwtB48bUiEn6JhpxddgohhSpE3d625BZlu/Jg=; b=qlOKbqmbiabMJeaecnSuIInV+vU7FgJYFF4gnt8yt/NItD8+ctxUkjET4wpOcgbLbu ox4rh4sdSEI6BOexnSGZuCJ3me0BZ4SdeDOrpY7kaM2bR41aTySTyL636OCNbi3d9mxF F7X4cwhPzGLF1+ZgomJvrwVyAlIc4JU19qYLg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=RYs2iebt7txXFbVNMSfupvdmnCOj0voiSqDA5+41vvTKiFbi8CuF6rt8+E2rfGnx2v 3KNwq+s7l9WgvASlteNY8J8MOUfxgJ9xiaeM4mf84tjw0m7tcmSNo1Otoey1cDVKN/Zc 5RLSTwDzJ8tMjEOAHqsEZr99uMZj6Gl7XnJlw= MIME-Version: 1.0 Received: by 10.142.186.15 with SMTP id j15mr4003325wff.271.1235011614453; Wed, 18 Feb 2009 18:46:54 -0800 (PST) In-Reply-To: References: Date: Thu, 19 Feb 2009 08:16:54 +0530 Message-ID: <84dead720902181846o7c1ca09fx93fa156d262cc610@mail.gmail.com> From: Joseph Koshy To: =?ISO-8859-2?Q?Nikola_Kne=BEevi=E6?= Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@freebsd.org Subject: Re: Obtaining l2 misses and cpu utilization in a module X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Feb 2009 03:07:49 -0000 > I would like to obtain fore mentioned data from within my module. I need > these performance metrics to see how certain code executes, and make > decisions during the runtime. pmc(3) seems complete, but it also seems to be > intended for use in the userland. > > How to use pmc from modules? Is there any other way? Also, module is amd64 > only, so I don't care about portability. At this point of time there isn't an in-kernel API for using hwpmc(4) (but it is on the task list, see: http://code.google.com/p/pmctools/issues/detail?id=17). For now, you could configure hwpmc(4) to not touch specific PMC registers using the OP_PMCADMIN request (i.e., use pmccontrol -d). After this you can use those registers from your kernel module without interference from hwpmc. Koshy