From owner-freebsd-hackers Fri Mar 29 9:26:53 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by hub.freebsd.org (Postfix) with ESMTP id 04BF037B41E for ; Fri, 29 Mar 2002 09:26:46 -0800 (PST) Received: from dan.emsphone.com (smmsp@localhost [127.0.0.1]) by dan.emsphone.com (8.12.2/8.12.2) with ESMTP id g2THQism018089; Fri, 29 Mar 2002 11:26:44 -0600 (CST) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.12.2/8.12.2/Submit) id g2THQioT018088; Fri, 29 Mar 2002 11:26:44 -0600 (CST) Date: Fri, 29 Mar 2002 11:26:44 -0600 From: Dan Nelson To: Russell Francis Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: determining context switching? Message-ID: <20020329172644.GD7197@dan.emsphone.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.3.28i X-OS: FreeBSD 5.0-CURRENT X-message-flag: Outlook Error Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG In the last episode (Mar 29), Russell Francis said: > I was wondering if there is a way to determine the context switching > rate? > > In /usr/include/sys/vmmeter.h the structure > > struct vmmeter { > u_int v_swtch; /* context switches */ > ... > } > > looks like what I want but I can't find a function which returns this > data to a user land application. Is this possible? If so how? Take a look at /usr/src/usr.sbin/vmstat.c. You'll want to use sysctl() to pull the vm.vmmeter data block, which is of type "struct vmmeter". -- Dan Nelson dnelson@allantgroup.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message