From owner-freebsd-hackers@FreeBSD.ORG Sat May 21 10:49:39 2005 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6A3A216A4CE for ; Sat, 21 May 2005 10:49:39 +0000 (GMT) Received: from web15509.mail.cnb.yahoo.com (web15509.mail.cnb.yahoo.com [202.165.102.38]) by mx1.FreeBSD.org (Postfix) with SMTP id 4983543D9C for ; Sat, 21 May 2005 10:49:38 +0000 (GMT) (envelope-from shiner_chen@yahoo.com.cn) Message-ID: <20050521104937.70622.qmail@web15509.mail.cnb.yahoo.com> Received: from [61.187.12.146] by web15509.mail.cnb.yahoo.com via HTTP; Sat, 21 May 2005 18:49:36 CST Date: Sat, 21 May 2005 18:49:36 +0800 (CST) From: shiner chen To: freebsd-hackers@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=gb2312 Content-Transfer-Encoding: 8bit X-Content-Filtered-By: Mailman/MimeDel 2.1.1 Subject: how to get the status of cpu in kernel? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 May 2005 10:49:39 -0000 In order to implement a dispacthing policy I want to get the status of cpu. I have read the code of top command and i find it get the status of cpu by the function : int sysctlbyname(const char *, void *, size_t *, void *, size_t); I search the code of kernel ,then I consider that i can get the status of cpu through the funciton: int kernel_sysctlbyname(struct thread *td, char *name, void *old, size_t *oldlenp, void *new, size_t newlen, size_t *retval); I try to get the status of cpu by that function ,but it does not work! who can tell me the problem? How do i get the status of cpu? How do i use it if the funcion is right? what's the mean of the function's arguments ? thanks ! shiner_chen May 21th 2005 --------------------------------- Do You Yahoo!? 注册世界一流品质的雅虎免费电邮