From owner-svn-ports-all@freebsd.org Sun Feb 14 03:07:02 2016 Return-Path: Delivered-To: svn-ports-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 85F0FAA1805; Sun, 14 Feb 2016 03:07:02 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 456218F2; Sun, 14 Feb 2016 03:07:02 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u1E371lC068798; Sun, 14 Feb 2016 03:07:01 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u1E371UZ068796; Sun, 14 Feb 2016 03:07:01 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201602140307.u1E371UZ068796@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sun, 14 Feb 2016 03:07:01 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r408842 - in head/sysutils/htop: . 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-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Feb 2016 03:07:02 -0000 Author: cy Date: Sun Feb 14 03:07:00 2016 New Revision: 408842 URL: https://svnweb.freebsd.org/changeset/ports/408842 Log: Make CPU% display the same as ps and top do. MEM% displays 0.0. Fix that. PR: 207120 Modified: head/sysutils/htop/Makefile head/sysutils/htop/files/patch-freebsd__FreeBSDProcessList.c Modified: head/sysutils/htop/Makefile ============================================================================== --- head/sysutils/htop/Makefile Sun Feb 14 02:59:02 2016 (r408841) +++ head/sysutils/htop/Makefile Sun Feb 14 03:07:00 2016 (r408842) @@ -3,7 +3,7 @@ PORTNAME= htop PORTVERSION= 2.0.0 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= sysutils MAINTAINER= gaod@hychen.org Modified: head/sysutils/htop/files/patch-freebsd__FreeBSDProcessList.c ============================================================================== --- head/sysutils/htop/files/patch-freebsd__FreeBSDProcessList.c Sun Feb 14 02:59:02 2016 (r408841) +++ head/sysutils/htop/files/patch-freebsd__FreeBSDProcessList.c Sun Feb 14 03:07:00 2016 (r408842) @@ -1,6 +1,24 @@ ---- freebsd/FreeBSDProcessList.c.orig 2016-02-13 00:37:56.160832000 +0800 -+++ freebsd/FreeBSDProcessList.c 2016-02-13 00:38:19.671290000 +0800 -@@ -477,8 +477,8 @@ +--- freebsd/FreeBSDProcessList.c.orig 2016-02-10 12:48:39.000000000 -0800 ++++ freebsd/FreeBSDProcessList.c 2016-02-13 13:42:40.759431578 -0800 +@@ -84,6 +84,8 @@ + static int MIB_kern_cp_times[2]; + static int kernelFScale; + ++// XXX hack ++static unsigned long long int Global_totalMem; + + ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidWhiteList, uid_t userId) { + FreeBSDProcessList* fpl = xCalloc(1, sizeof(FreeBSDProcessList)); +@@ -301,6 +303,8 @@ + //pl->totalMem *= pageSizeKb; + sysctl(MIB_hw_physmem, 2, &(pl->totalMem), &len, NULL, 0); + pl->totalMem /= 1024; ++ // XXX hack ++ Global_totalMem = pl->totalMem; + + sysctl(MIB_vm_stats_vm_v_active_count, 4, &(fpl->memActive), &len, NULL, 0); + fpl->memActive *= pageSizeKb; +@@ -477,8 +481,9 @@ } // from FreeBSD source /src/usr.bin/top/machine.c @@ -8,6 +26,17 @@ - proc->m_resident = kproc->ki_rssize * pageSizeKb; + proc->m_size = kproc->ki_size / 1024 / pageSizeKb; + proc->m_resident = kproc->ki_rssize; ++ proc->percent_mem = (proc->m_resident * PAGE_SIZE_KB) / (double)(Global_totalMem) * 100.0; proc->nlwp = kproc->ki_numthreads; proc->time = (kproc->ki_runtime + 5000) / 10000; +@@ -487,9 +492,6 @@ + // system idle process should own all CPU time left regardless of CPU count + if ( strcmp("idle", kproc->ki_comm) == 0 ) { + isIdleProcess = true; +- } else { +- if (cpus > 1) +- proc->percent_cpu = proc->percent_cpu / (double) cpus; + } + } + if (isIdleProcess == false && proc->percent_cpu >= 99.8) {