From owner-svn-ports-head@freebsd.org Sat Mar 3 09:54:22 2018 Return-Path: Delivered-To: svn-ports-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 425FDF2BF5E; Sat, 3 Mar 2018 09:54:22 +0000 (UTC) (envelope-from danfe@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E7500780F0; Sat, 3 Mar 2018 09:54:21 +0000 (UTC) (envelope-from danfe@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E21EE24BE5; Sat, 3 Mar 2018 09:54:21 +0000 (UTC) (envelope-from danfe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w239sLJH010663; Sat, 3 Mar 2018 09:54:21 GMT (envelope-from danfe@FreeBSD.org) Received: (from danfe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w239sLbP010660; Sat, 3 Mar 2018 09:54:21 GMT (envelope-from danfe@FreeBSD.org) Message-Id: <201803030954.w239sLbP010660@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: danfe set sender to danfe@FreeBSD.org using -f From: Alexey Dokuchaev Date: Sat, 3 Mar 2018 09:54:21 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r463478 - in head/benchmarks/apib: . files X-SVN-Group: ports-head X-SVN-Commit-Author: danfe X-SVN-Commit-Paths: in head/benchmarks/apib: . files X-SVN-Commit-Revision: 463478 X-SVN-Commit-Repository: ports 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.25 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: Sat, 03 Mar 2018 09:54:22 -0000 Author: danfe Date: Sat Mar 3 09:54:21 2018 New Revision: 463478 URL: https://svnweb.freebsd.org/changeset/ports/463478 Log: - Collect CPU and memory statistics originally missing on FreeBSD - Adjust COMMENT and port description text for better readability Added: head/benchmarks/apib/files/ head/benchmarks/apib/files/patch-src_apib__cpu.c (contents, props changed) Modified: head/benchmarks/apib/Makefile head/benchmarks/apib/pkg-descr Modified: head/benchmarks/apib/Makefile ============================================================================== --- head/benchmarks/apib/Makefile Sat Mar 3 09:53:42 2018 (r463477) +++ head/benchmarks/apib/Makefile Sat Mar 3 09:54:21 2018 (r463478) @@ -3,10 +3,11 @@ PORTNAME= apib PORTVERSION= 1.0 +PORTREVISION= 1 CATEGORIES= benchmarks www MAINTAINER= danfe@FreeBSD.org -COMMENT= Simple, fast HTTP performance-testing tool +COMMENT= Simple and fast HTTP performance testing tool LICENSE= APACHE20 Added: head/benchmarks/apib/files/patch-src_apib__cpu.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/benchmarks/apib/files/patch-src_apib__cpu.c Sat Mar 3 09:54:21 2018 (r463478) @@ -0,0 +1,102 @@ +--- src/apib_cpu.c.orig 2017-08-28 22:38:37 UTC ++++ src/apib_cpu.c +@@ -14,6 +14,11 @@ + limitations under the License. + */ + ++#ifdef __FreeBSD__ ++#include ++#include ++#include ++#endif + #include + #include + #include +@@ -35,6 +40,9 @@ static double TicksPerSecond; + * for hyperthreading, etc. */ + int cpu_Count(apr_pool_t* pool) + { ++#ifdef _SC_NPROCESSORS_ONLN ++ return (int)sysconf(_SC_NPROCESSORS_ONLN); ++#else + apr_status_t s; + apr_file_t* f; + char buf[PROC_BUF_LEN]; +@@ -66,10 +74,19 @@ int cpu_Count(apr_pool_t* pool) + count = 1; + } + return count; ++#endif + } + + static int getTicks(CPUUsage* cpu, apr_pool_t* pool) + { ++#ifdef __FreeBSD__ ++ struct tms ticks; ++ cpu->idle = times(&ticks); ++ if (cpu->idle == -1) ++ return 0; ++ cpu->nonIdle = ticks.tms_utime + ticks.tms_stime; ++ return 1; ++#else + apr_status_t s; + apr_file_t* proc; + char buf[PROC_BUF_LEN]; +@@ -118,10 +135,12 @@ static int getTicks(CPUUsage* cpu, apr_pool_t* pool) + } + + return 0; ++#endif + } + + double cpu_GetMemoryUsage(apr_pool_t* pool) + { ++#ifdef __linux__ + apr_status_t s; + apr_file_t* proc; + char buf[PROC_BUF_LEN]; +@@ -138,12 +157,36 @@ double cpu_GetMemoryUsage(apr_pool_t* pool) + if (s != APR_SUCCESS) { + return 0.0; + } ++#endif + + long totalMem = 0; + long freeMem = 0; + long buffers = 0; + long cache = 0; + ++#ifdef __FreeBSD__ ++ /* Let's work with kilobytes. */ ++ long pagesize = sysconf(_SC_PAGESIZE) / 1024; ++ totalMem = sysconf(_SC_PHYS_PAGES) * pagesize; ++ ++ size_t len; ++ ++ unsigned free; ++ len = sizeof(free); ++ sysctlbyname("vm.stats.vm.v_free_count", &free, &len, NULL, 0); ++ freeMem = free * pagesize; ++ ++ /* `buffers' is of expected type (long), no need for another variable. */ ++ len = sizeof(buffers); ++ sysctlbyname("vfs.bufspace", &buffers, &len, NULL, 0); ++ buffers /= 1024; ++ ++ /* `cache' is number of inactive pages since r309017. */ ++ unsigned inact; ++ len = sizeof(inact); ++ sysctlbyname("vm.stats.vm.v_inactive_count", &inact, &len, NULL, 0); ++ cache = inact * pagesize; ++#else + while (linep_NextLine(&line)) { + char* n = linep_NextToken(&line, " "); + char* v = linep_NextToken(&line, " "); +@@ -158,6 +201,7 @@ double cpu_GetMemoryUsage(apr_pool_t* pool) + cache = atol(v); + } + } ++#endif + + if ((totalMem <= 0) || (freeMem <= 0)) { + return 0.0; Modified: head/benchmarks/apib/pkg-descr ============================================================================== --- head/benchmarks/apib/pkg-descr Sat Mar 3 09:53:42 2018 (r463477) +++ head/benchmarks/apib/pkg-descr Sat Mar 3 09:54:21 2018 (r463478) @@ -2,7 +2,7 @@ apib is a tool that makes it easy to test API servers. on Unix systems that include the Apache Portable Runtime and OpenSSL. apib has most of the features of Apache Bench (ab), but is also intended -to be a more modern replacement. In particular, it supports: +to be a more modern replacement. In particular, it offers: - Proper HTTP 1.1 support including keep-alives and chunked encoding - Ability to spawn multiple I/O threads to take advantage of multiple