From owner-svn-ports-head@FreeBSD.ORG Mon Nov 4 11:40:16 2013 Return-Path: Delivered-To: svn-ports-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id F1488C53; Mon, 4 Nov 2013 11:40:15 +0000 (UTC) (envelope-from bsam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id DE7282FCD; Mon, 4 Nov 2013 11:40:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rA4BeFje045092; Mon, 4 Nov 2013 11:40:15 GMT (envelope-from bsam@svn.freebsd.org) Received: (from bsam@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id rA4BeFMG045090; Mon, 4 Nov 2013 11:40:15 GMT (envelope-from bsam@svn.freebsd.org) Message-Id: <201311041140.rA4BeFMG045090@svn.freebsd.org> From: Boris Samorodov Date: Mon, 4 Nov 2013 11:40:15 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r332696 - in head/x11/fbpanel: . files X-SVN-Group: ports-head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the ports tree for head List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Nov 2013 11:40:16 -0000 Author: bsam Date: Mon Nov 4 11:40:15 2013 New Revision: 332696 URL: http://svnweb.freebsd.org/changeset/ports/332696 Log: . fix cpu plugin (core dumped without the fix); . bump PORTREVISION; . take maintainership. Submitted by: bsam (me, via e-mail) Approved by: nemysis (former maintainer) Modified: head/x11/fbpanel/Makefile head/x11/fbpanel/files/patch-plugins__cpu__cpu.c Modified: head/x11/fbpanel/Makefile ============================================================================== --- head/x11/fbpanel/Makefile Mon Nov 4 11:36:02 2013 (r332695) +++ head/x11/fbpanel/Makefile Mon Nov 4 11:40:15 2013 (r332696) @@ -3,13 +3,13 @@ PORTNAME= fbpanel PORTVERSION= 6.1 -PORTREVISION= 2 +PORTREVISION= 3 CATEGORIES= x11 MASTER_SITES= SF EXTRACT_SUFX= .tbz2 -MAINTAINER= nemysis@gmx.ch -COMMENT= Lightweight, NETWM compliant X11 desktop panel +MAINTAINER= bsam@FreeBSD.org +COMMENT= Lightweight, NEtWM compliant X11 desktop panel LICENSE= MIT Modified: head/x11/fbpanel/files/patch-plugins__cpu__cpu.c ============================================================================== --- head/x11/fbpanel/files/patch-plugins__cpu__cpu.c Mon Nov 4 11:36:02 2013 (r332695) +++ head/x11/fbpanel/files/patch-plugins__cpu__cpu.c Mon Nov 4 11:40:15 2013 (r332696) @@ -1,5 +1,5 @@ --- ./plugins/cpu/cpu.c.orig 2010-03-07 00:14:04.000000000 -0800 -+++ ./plugins/cpu/cpu.c 2010-11-17 11:06:07.000000000 -0800 ++++ ./plugins/cpu/cpu.c 2013-11-04 01:56:23.388313800 +0400 @@ -18,9 +18,20 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * @@ -22,24 +22,7 @@ #include "misc.h" #include "../chart/chart.h" -@@ -29,9 +40,16 @@ - #include "dbg.h" - - /* cpu.c */ -+#if defined __FreeBSD__ -+struct cpu_stat { -+ gulong u, n, s, i; // user, nice, system, idle -+}; -+#else - struct cpu_stat { - gulong u, n, s, i, w; // user, nice, system, idle, wait - }; -+#endif -+ - - typedef struct { - chart_priv chart; -@@ -84,6 +102,65 @@ +@@ -84,6 +102,59 @@ RET(TRUE); } @@ -47,11 +30,11 @@ +static int +cpu_get_load(cpu_priv * c) +{ -+ static int mib[2] = {-1, -1}, init = 0, j, realhz; ++ static int mib[2] = {-1, -1}, init = 0, j; + long ct[CPUSTATES]; + + gfloat a , b; -+ struct cpu_stat cpu, cpu_diff; ++ struct cpu_stat cpu; + float total; + gchar buf[40]; + @@ -59,19 +42,16 @@ + total = 0; + + if (init == 0) { -+ struct clockinfo ci; -+ j = sizeof(ci); -+ if (sysctlbyname("kern.clockrate", &ci, &j, NULL, 0) == -1) { -+ DBG("Couldn't get kern.clockrate"); -+ RET(FALSE); -+ } else -+ realhz = ci.stathz ? ci.stathz : ci.hz; -+ + j = 2; + if (sysctlnametomib("kern.cp_time", mib, &j) == -1) { + DBG("Couldn't get mib for kern.cp_time"); + RET(FALSE); + } ++ c->cpu_prev.u = 0; ++ c->cpu_prev.n = 0; ++ c->cpu_prev.s = 0; ++ c->cpu_prev.i = 0; ++ c->cpu_prev.w = 0; + init = 1; + j = sizeof(ct); + } @@ -79,20 +59,17 @@ + DBG("Couldn't get cpu stats"); + RET(FALSE); + } -+ cpu.u = ct[CP_USER] / realhz; -+ cpu.n = ct[CP_NICE] / realhz; -+ cpu.s = ct[CP_SYS] / realhz; -+ cpu.i = ct[CP_IDLE] / realhz; -+ -+ cpu_diff.u = cpu.u - c->cpu_prev.u; -+ cpu_diff.n = cpu.n - c->cpu_prev.n; -+ cpu_diff.s = cpu.s - c->cpu_prev.s; -+ cpu_diff.i = cpu.i - c->cpu_prev.i; -+ c->cpu_prev = cpu; -+ -+ a = cpu_diff.u + cpu_diff.n + cpu_diff.s; -+ b = a + cpu_diff.i; -+ total = b ? a / b : 1.0; ++ ++ a = ct[CP_USER] + ct[CP_NICE] + ct[CP_SYS] + ct[CP_INTR] - ++ (c->cpu_prev.u + c->cpu_prev.n + c->cpu_prev.s + c->cpu_prev.i); ++ b = a + ct[CP_IDLE] - c->cpu_prev.w; ++ total = b ? (float)a / b : 1.0; ++ ++ c->cpu_prev.u = ct[CP_USER]; ++ c->cpu_prev.n = ct[CP_NICE]; ++ c->cpu_prev.s = ct[CP_SYS] ; ++ c->cpu_prev.i = ct[CP_INTR]; ++ c->cpu_prev.w = ct[CP_IDLE]; + +end: + DBG("total=%f a=%f b=%f\n", total, a, b);