From owner-svn-src-all@FreeBSD.ORG Thu Jun 25 01:32:00 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0E3CE106566C; Thu, 25 Jun 2009 01:32:00 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D5F7A8FC19; Thu, 25 Jun 2009 01:31:59 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5P1Vxd2036300; Thu, 25 Jun 2009 01:31:59 GMT (envelope-from jeff@svn.freebsd.org) Received: (from jeff@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5P1VxnP036297; Thu, 25 Jun 2009 01:31:59 GMT (envelope-from jeff@svn.freebsd.org) Message-Id: <200906250131.n5P1VxnP036297@svn.freebsd.org> From: Jeff Roberson Date: Thu, 25 Jun 2009 01:31:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194935 - in head/sys: kern sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 01:32:00 -0000 Author: jeff Date: Thu Jun 25 01:31:59 2009 New Revision: 194935 URL: http://svn.freebsd.org/changeset/base/194935 Log: - Add a sysctl_dpcpu_long to support long typed pcpu stats. - Remove the #ifndef SMP case as the SMP code works on UP as well. Reviewed by: sam Modified: head/sys/kern/subr_pcpu.c head/sys/sys/sysctl.h Modified: head/sys/kern/subr_pcpu.c ============================================================================== --- head/sys/kern/subr_pcpu.c Thu Jun 25 00:28:43 2009 (r194934) +++ head/sys/kern/subr_pcpu.c Thu Jun 25 01:31:59 2009 (r194935) @@ -264,9 +264,8 @@ pcpu_find(u_int cpuid) int sysctl_dpcpu_quad(SYSCTL_HANDLER_ARGS) { - int64_t count; -#ifdef SMP uintptr_t dpcpu; + int64_t count; int i; count = 0; @@ -276,18 +275,31 @@ sysctl_dpcpu_quad(SYSCTL_HANDLER_ARGS) continue; count += *(int64_t *)(dpcpu + (uintptr_t)arg1); } -#else - count = *(int64_t *)(dpcpu_off[0] + (uintptr_t)arg1); -#endif + return (SYSCTL_OUT(req, &count, sizeof(count))); +} + +int +sysctl_dpcpu_long(SYSCTL_HANDLER_ARGS) +{ + uintptr_t dpcpu; + long count; + int i; + + count = 0; + for (i = 0; i < mp_ncpus; ++i) { + dpcpu = dpcpu_off[i]; + if (dpcpu == 0) + continue; + count += *(long *)(dpcpu + (uintptr_t)arg1); + } return (SYSCTL_OUT(req, &count, sizeof(count))); } int sysctl_dpcpu_int(SYSCTL_HANDLER_ARGS) { - int count; -#ifdef SMP uintptr_t dpcpu; + int count; int i; count = 0; @@ -297,9 +309,6 @@ sysctl_dpcpu_int(SYSCTL_HANDLER_ARGS) continue; count += *(int *)(dpcpu + (uintptr_t)arg1); } -#else - count = *(int *)(dpcpu_off[0] + (uintptr_t)arg1); -#endif return (SYSCTL_OUT(req, &count, sizeof(count))); } Modified: head/sys/sys/sysctl.h ============================================================================== --- head/sys/sys/sysctl.h Thu Jun 25 00:28:43 2009 (r194934) +++ head/sys/sys/sysctl.h Thu Jun 25 01:31:59 2009 (r194935) @@ -179,6 +179,7 @@ int sysctl_handle_string(SYSCTL_HANDLER_ int sysctl_handle_opaque(SYSCTL_HANDLER_ARGS); int sysctl_dpcpu_int(SYSCTL_HANDLER_ARGS); +int sysctl_dpcpu_long(SYSCTL_HANDLER_ARGS); int sysctl_dpcpu_quad(SYSCTL_HANDLER_ARGS); #ifdef VIMAGE