From a20cb9936132fd3e16f6b8b12d4af2bd0577d929 Mon Sep 17 00:00:00 2001 From: Hiram Clawson Date: Mon, 4 Nov 2002 04:06:06 +0000 Subject: [PATCH] *** empty log message *** svn path=/trunk/boinc/; revision=565 --- client/hostinfo_unix.C | 15 ++++++++++++++- client/speed_stats.C | 4 ++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/client/hostinfo_unix.C b/client/hostinfo_unix.C index 95949e6654..5bc35117d1 100644 --- a/client/hostinfo_unix.C +++ b/client/hostinfo_unix.C @@ -214,8 +214,21 @@ int get_host_info(HOST_INFO& host) { sysinfo(SI_RELEASE, host.os_version, sizeof(host.os_version)); sysinfo(SI_HW_SERIAL, host.serialnum, sizeof(host.serialnum)); host.p_ncpus = sysconf(_SC_NPROCESSORS_ONLN); + +/* There can be a variety of methods to obtain amount of + * usable memory. You will have to check your sysconf() + * defines, probably in unistd.h + * - 2002-11-03 hiram@users.sourceforge.net + */ +#if defined(_SC_USEABLE_MEMORY) host.m_nbytes = (double)sysconf(_SC_PAGESIZE) - * (double)sysconf(_SC_PHYS_PAGES); + * (double)sysconf(_SC_USEABLE_MEMORY); /* UnixWare */ +#elif defined(_SC_PHYS_PAGES) + host.m_nbytes = (double)sysconf(_SC_PAGESIZE) + * (double)sysconf(_SC_PHYS_PAGES); /* Linux */ +#else +#error Need to specify a sysconf() define to obtain memory size +#endif swaptbl_t* s; n = swapctl(SC_GETNSWP, 0); diff --git a/client/speed_stats.C b/client/speed_stats.C index 8fcfbcf9d2..1af5775532 100644 --- a/client/speed_stats.C +++ b/client/speed_stats.C @@ -80,8 +80,8 @@ int check_cache_size(int mem_size) { fprintf(stderr, "error: check_cache_size: negative mem_size\n"); return ERR_NEG; } - logStride = (int)(log(STRIDE_MAX/STRIDE_MIN)/log(2))+1; - logCache = (int)(log(CACHE_MAX/CACHE_MIN)/log(2))+1; + logStride = (int)(log(STRIDE_MAX/STRIDE_MIN)/log(2.0))+1; + logCache = (int)(log(CACHE_MAX/CACHE_MIN)/log(2.0))+1; printf("Test will take about %.2f seconds.\n", SECS_PER_RUN*logStride*logCache); results = (double **)malloc(sizeof(double *)*logStride);