diff options
author | danfe <danfe@FreeBSD.org> | 2018-03-03 19:47:21 +0800 |
---|---|---|
committer | danfe <danfe@FreeBSD.org> | 2018-03-03 19:47:21 +0800 |
commit | 11cfa225c786a7f7e0c9e57f4d11ad54ae591221 (patch) | |
tree | 6a4eb01cfe11fecaa424e730d6e44b67554e7ed3 /benchmarks/apib/files/patch-src_apib__cpu.c | |
parent | d094c6b043f3b3a4d828124ecd7a7e0a3bcbe42d (diff) | |
download | freebsd-ports-gnome-11cfa225c786a7f7e0c9e57f4d11ad54ae591221.tar.gz freebsd-ports-gnome-11cfa225c786a7f7e0c9e57f4d11ad54ae591221.tar.zst freebsd-ports-gnome-11cfa225c786a7f7e0c9e57f4d11ad54ae591221.zip |
Adjust code comments and add one missing linefeed.
Diffstat (limited to 'benchmarks/apib/files/patch-src_apib__cpu.c')
-rw-r--r-- | benchmarks/apib/files/patch-src_apib__cpu.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/benchmarks/apib/files/patch-src_apib__cpu.c b/benchmarks/apib/files/patch-src_apib__cpu.c index 5aa215d2a754..f0af2c4f6940 100644 --- a/benchmarks/apib/files/patch-src_apib__cpu.c +++ b/benchmarks/apib/files/patch-src_apib__cpu.c @@ -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); } } |