svn commit: r463480 - head/benchmarks/apib/files

Alexey Dokuchaev danfe at FreeBSD.org
Sat Mar 3 11:47:22 UTC 2018


Author: danfe
Date: Sat Mar  3 11:47:21 2018
New Revision: 463480
URL: https://svnweb.freebsd.org/changeset/ports/463480

Log:
  Adjust code comments and add one missing linefeed.

Modified:
  head/benchmarks/apib/files/patch-src_apib__cpu.c

Modified: head/benchmarks/apib/files/patch-src_apib__cpu.c
==============================================================================
--- head/benchmarks/apib/files/patch-src_apib__cpu.c	Sat Mar  3 11:24:57 2018	(r463479)
+++ head/benchmarks/apib/files/patch-src_apib__cpu.c	Sat Mar  3 11:47:21 2018	(r463480)
@@ -22,7 +22,7 @@
    apr_status_t s;
    apr_file_t* f;
    char buf[PROC_BUF_LEN];
-@@ -66,10 +74,19 @@ int cpu_Count(apr_pool_t* pool)
+@@ -66,10 +74,20 @@ int cpu_Count(apr_pool_t* pool)
      count = 1;
    }
    return count;
@@ -33,6 +33,7 @@
  {
 +#ifdef __FreeBSD__
 +  struct tms ticks;
++
 +  cpu->idle = times(&ticks);
 +  if (cpu->idle == -1)
 +    return 0;
@@ -42,7 +43,7 @@
    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)
+@@ -118,10 +136,12 @@ static int getTicks(CPUUsage* cpu, apr_pool_t* pool)
    }
  
    return 0;
@@ -55,7 +56,7 @@
    apr_status_t s;
    apr_file_t* proc;
    char buf[PROC_BUF_LEN];
-@@ -138,12 +157,36 @@ double cpu_GetMemoryUsage(apr_pool_t* pool)
+@@ -138,12 +158,36 @@ double cpu_GetMemoryUsage(apr_pool_t* pool)
    if (s != APR_SUCCESS) {
      return 0.0;
    }
@@ -67,7 +68,7 @@
    long cache = 0;
  
 +#ifdef __FreeBSD__
-+  /* Let's work with kilobytes. */
++  /* We work with kilobytes to match Linux' /proc/meminfo. */
 +  long pagesize = sysconf(_SC_PAGESIZE) / 1024;
 +  totalMem = sysconf(_SC_PHYS_PAGES) * pagesize;
 +
@@ -83,7 +84,7 @@
 +  sysctlbyname("vfs.bufspace", &buffers, &len, NULL, 0);
 +  buffers /= 1024;
 +
-+  /* `cache' is number of inactive pages since r309017. */
++  /* `cache' is based on number of inactive pages since r309017. */
 +  unsigned inact;
 +  len = sizeof(inact);
 +  sysctlbyname("vm.stats.vm.v_inactive_count", &inact, &len, NULL, 0);
@@ -92,7 +93,7 @@
    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)
+@@ -158,6 +202,7 @@ double cpu_GetMemoryUsage(apr_pool_t* pool)
        cache = atol(v);
      }
    }


More information about the svn-ports-all mailing list