Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: bingmann/pmbw
base: pmbw-0.6
...
head fork: bingmann/pmbw
compare: pmbw-0.6.2
  • 12 commits
  • 5 files changed
  • 0 commit comments
  • 2 contributors
Showing with 360 additions and 39 deletions.
  1. +9 −0 .gitignore
  2. +20 −3 Makefile.in
  3. +210 −11 configure
  4. +30 −5 configure.ac
  5. +91 −20 pmbw.cc
View
9 .gitignore
@@ -0,0 +1,9 @@
+.deps/*
+*.o
+Makefile
+config.log
+config.status
+plots-*.pdf
+stats.txt
+pmbw
+stats2gnuplot
View
23 Makefile.in
@@ -50,14 +50,19 @@ POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
bin_PROGRAMS = pmbw$(EXEEXT) stats2gnuplot$(EXEEXT)
subdir = .
DIST_COMMON = $(am__configure_deps) $(srcdir)/Makefile.am \
- $(srcdir)/Makefile.in $(top_srcdir)/acscripts/depcomp \
+ $(srcdir)/Makefile.in $(top_srcdir)/acscripts/config.guess \
+ $(top_srcdir)/acscripts/config.sub \
+ $(top_srcdir)/acscripts/depcomp \
$(top_srcdir)/acscripts/install-sh \
$(top_srcdir)/acscripts/missing $(top_srcdir)/configure \
- AUTHORS COPYING acscripts/depcomp acscripts/install-sh \
- acscripts/missing
+ AUTHORS COPYING acscripts/config.guess acscripts/config.sub \
+ acscripts/depcomp acscripts/install-sh acscripts/missing
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
@@ -169,14 +174,22 @@ am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
+build = @build@
build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
+host = @host@
host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
@@ -196,7 +209,11 @@ sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
+target = @target@
target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
View
221 configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for pmbw 0.6.
+# Generated by GNU Autoconf 2.69 for pmbw 0.6.2.
#
#
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@@ -576,8 +576,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='pmbw'
PACKAGE_TARNAME='pmbw'
-PACKAGE_VERSION='0.6'
-PACKAGE_STRING='pmbw 0.6'
+PACKAGE_VERSION='0.6.2'
+PACKAGE_STRING='pmbw 0.6.2'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''
@@ -629,6 +629,18 @@ am__isrc
INSTALL_DATA
INSTALL_SCRIPT
INSTALL_PROGRAM
+target_os
+target_vendor
+target_cpu
+target
+host_os
+host_vendor
+host_cpu
+host
+build_os
+build_vendor
+build_cpu
+build
target_alias
host_alias
build_alias
@@ -1222,7 +1234,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures pmbw 0.6 to adapt to many kinds of systems.
+\`configure' configures pmbw 0.6.2 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1283,12 +1295,17 @@ Program names:
--program-prefix=PREFIX prepend PREFIX to installed program names
--program-suffix=SUFFIX append SUFFIX to installed program names
--program-transform-name=PROGRAM run sed PROGRAM on installed program names
+
+System types:
+ --build=BUILD configure for building on BUILD [guessed]
+ --host=HOST cross-compile to build programs to run on HOST [BUILD]
+ --target=TARGET configure for building compilers for TARGET [HOST]
_ACEOF
fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of pmbw 0.6:";;
+ short | recursive ) echo "Configuration of pmbw 0.6.2:";;
esac
cat <<\_ACEOF
@@ -1379,7 +1396,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-pmbw configure 0.6
+pmbw configure 0.6.2
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1480,7 +1497,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by pmbw $as_me 0.6, which was
+It was created by pmbw $as_me 0.6.2, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -1859,6 +1876,117 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
+# Make sure we can run config.sub.
+$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
+ as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
+$as_echo_n "checking build system type... " >&6; }
+if ${ac_cv_build+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_build_alias=$build_alias
+test "x$ac_build_alias" = x &&
+ ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
+test "x$ac_build_alias" = x &&
+ as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5
+ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
+ as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5
+$as_echo "$ac_cv_build" >&6; }
+case $ac_cv_build in
+*-*-*) ;;
+*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;;
+esac
+build=$ac_cv_build
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_build
+shift
+build_cpu=$1
+build_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+build_os=$*
+IFS=$ac_save_IFS
+case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
+$as_echo_n "checking host system type... " >&6; }
+if ${ac_cv_host+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "x$host_alias" = x; then
+ ac_cv_host=$ac_cv_build
+else
+ ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
+ as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5
+$as_echo "$ac_cv_host" >&6; }
+case $ac_cv_host in
+*-*-*) ;;
+*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;;
+esac
+host=$ac_cv_host
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_host
+shift
+host_cpu=$1
+host_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+host_os=$*
+IFS=$ac_save_IFS
+case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking target system type" >&5
+$as_echo_n "checking target system type... " >&6; }
+if ${ac_cv_target+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "x$target_alias" = x; then
+ ac_cv_target=$ac_cv_host
+else
+ ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` ||
+ as_fn_error $? "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_target" >&5
+$as_echo "$ac_cv_target" >&6; }
+case $ac_cv_target in
+*-*-*) ;;
+*) as_fn_error $? "invalid value of canonical target" "$LINENO" 5;;
+esac
+target=$ac_cv_target
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_target
+shift
+target_cpu=$1
+target_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+target_os=$*
+IFS=$ac_save_IFS
+case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac
+
+
+# The aliases save the names the user supplied, while $host etc.
+# will get canonicalized.
+test -n "$target_alias" &&
+ test "$program_prefix$program_suffix$program_transform_name" = \
+ NONENONEs,x,x, &&
+ program_prefix=${target_alias}-
+
am__api_version='1.12'
# Find a good install program. We prefer a C program (faster),
@@ -2306,7 +2434,7 @@ fi
# Define the identity of the package.
PACKAGE='pmbw'
- VERSION='0.6'
+ VERSION='0.6.2'
cat >>confdefs.h <<_ACEOF
@@ -2376,6 +2504,27 @@ fi
+# Check for Windows system and set compilation flag.
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking building for Windows" >&5
+$as_echo_n "checking building for Windows... " >&6; }
+case "$target_os" in
+ *cygwin* | *mingw32*)
+ ON_WINDOWS=true
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ ;;
+ *)
+ ON_WINDOWS=false
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ ;;
+esac
+cat >>confdefs.h <<_ACEOF
+#define ON_WINDOWS $ON_WINDOWS
+_ACEOF
+
+
# set debug info flag if no optimization flags are set.
if test "$CXXFLAGS" == ""; then
@@ -3163,7 +3312,9 @@ else
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for clock_gettime in -lrt" >&5
+if ! "$ON_WINDOWS" ; then
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for clock_gettime in -lrt" >&5
$as_echo_n "checking for clock_gettime in -lrt... " >&6; }
if ${ac_cv_lib_rt_clock_gettime+:} false; then :
$as_echo_n "(cached) " >&6
@@ -3207,6 +3358,54 @@ else
fi
+fi
+
+HAVE_POSIX_MEMALIGN=0
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for posix_memalign in -lc" >&5
+$as_echo_n "checking for posix_memalign in -lc... " >&6; }
+if ${ac_cv_lib_c_posix_memalign+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lc $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char posix_memalign ();
+int
+main ()
+{
+return posix_memalign ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+ ac_cv_lib_c_posix_memalign=yes
+else
+ ac_cv_lib_c_posix_memalign=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_posix_memalign" >&5
+$as_echo "$ac_cv_lib_c_posix_memalign" >&6; }
+if test "x$ac_cv_lib_c_posix_memalign" = xyes; then :
+ HAVE_POSIX_MEMALIGN=1
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_POSIX_MEMALIGN $HAVE_POSIX_MEMALIGN
+_ACEOF
+
+
# transform Makefiles
ac_config_files="$ac_config_files Makefile"
@@ -3781,7 +3980,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by pmbw $as_me 0.6, which was
+This file was extended by pmbw $as_me 0.6.2, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -3838,7 +4037,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-pmbw config.status 0.6
+pmbw config.status 0.6.2
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
View
35 configure.ac
@@ -2,13 +2,30 @@
AC_PREREQ(2.69)
-AC_INIT(pmbw, 0.6)
+AC_INIT(pmbw, 0.6.2)
AC_CONFIG_SRCDIR(pmbw.cc)
AC_CONFIG_AUX_DIR(acscripts)
+AC_CANONICAL_TARGET
+
AM_INIT_AUTOMAKE(foreign)
AM_MAINTAINER_MODE
+# Check for Windows system and set compilation flag.
+
+AC_MSG_CHECKING(building for Windows)
+case "$target_os" in
+ *cygwin* | *mingw32*)
+ ON_WINDOWS=true
+ AC_MSG_RESULT(yes)
+ ;;
+ *)
+ ON_WINDOWS=false
+ AC_MSG_RESULT(no)
+ ;;
+esac
+AC_DEFINE_UNQUOTED(ON_WINDOWS, $ON_WINDOWS)
+
# set debug info flag if no optimization flags are set.
if test "$CXXFLAGS" == ""; then
@@ -37,10 +54,18 @@ AC_CHECK_LIB(pthread, pthread_mutex_init,
[AC_MSG_ERROR(pthread library needed!)]
)
-AC_CHECK_LIB(rt, clock_gettime,
- [LIBS="$LIBS -lrt"],
- [AC_MSG_ERROR(rt library needed!)]
-)
+if [ ! "$ON_WINDOWS" ]; then
+
+ AC_CHECK_LIB(rt, clock_gettime,
+ [LIBS="$LIBS -lrt"],
+ [AC_MSG_ERROR(rt library needed!)]
+ )
+
+fi
+
+HAVE_POSIX_MEMALIGN=0
+AC_CHECK_LIB(c, posix_memalign, [HAVE_POSIX_MEMALIGN=1])
+AC_DEFINE_UNQUOTED(HAVE_POSIX_MEMALIGN, $HAVE_POSIX_MEMALIGN)
# transform Makefiles
View
111 pmbw.cc
@@ -41,14 +41,25 @@
#include <pthread.h>
#include <malloc.h>
+#if ON_WINDOWS
+#include <windows.h>
+#endif
+
// -----------------------------------------------------------------------------
// --- Global Settings and Variables
+// minimum duration of test, if smaller re-run
+double g_min_time = 1.0;
+
+// target average duration of test
+double g_avg_time = 1.5;
+
// filter of functions to run, set by command line
std::vector<const char*> gopt_funcfilter;
-// set default size limit: 4 GiB
-uint64_t gopt_sizelimit = 4*1024*1024*1024LLU;
+// set default size limit: 0 -- 4 GiB
+uint64_t gopt_sizelimit_min = 0;
+uint64_t gopt_sizelimit_max = 4*1024*1024*1024LLU;
// set memory limit
uint64_t gopt_memlimit = 0;
@@ -145,7 +156,17 @@ TestFunction::TestFunction(const char* n, testfunc_type f,const char* cf,
// -----------------------------------------------------------------------------
// --- Test CPU Features via CPUID
-// gcc inline assembly
+#if __arm__
+static void cpuid_detect()
+{
+ // replace functions with dummys
+}
+bool TestFunction::is_supported() const
+{
+ return true;
+}
+#else
+// gcc inline assembly for CPUID instruction
static inline void cpuid(int op, int out[4])
{
asm volatile("cpuid"
@@ -196,6 +217,7 @@ bool TestFunction::is_supported() const
if (strcmp(cpufeat,"avx") == 0) return cpuid_avx();
return false;
}
+#endif
// -----------------------------------------------------------------------------
// --- Some Simple Subroutines
@@ -406,9 +428,14 @@ void* thread_master(void* cookie)
for (const uint64_t* areasize = areasize_list; *areasize; ++areasize)
{
- if (*areasize > gopt_sizelimit && gopt_sizelimit != 0) {
+ if (*areasize < gopt_sizelimit_min && gopt_sizelimit_min != 0) {
+ ERR("Skipping " << g_func->name << " test with " << *areasize
+ << " minimum array size due to -s " << gopt_sizelimit_min << ".");
+ continue;
+ }
+ if (*areasize > gopt_sizelimit_max && gopt_sizelimit_max != 0) {
ERR("Skipping " << g_func->name << " test with " << *areasize
- << " array size due to -s <size limit>.");
+ << " maximum array size due to -S " << gopt_sizelimit_max << ".");
continue;
}
@@ -479,11 +506,11 @@ void* thread_master(void* cookie)
runtime = ts2 - ts1;
}
- if ( runtime < 1.0 )
+ if ( runtime < g_min_time )
{
// test ran for less than one second, repeat test and scale
// repeat factor
- factor = g_thrsize * g_repeats * 3/2 / runtime;
+ factor = g_thrsize * g_repeats * g_avg_time / runtime;
ERR("run time = " << runtime << " -> rerunning test with repeat factor=" << factor);
--round; // redo this areasize
@@ -491,9 +518,9 @@ void* thread_master(void* cookie)
else
{
// adapt repeat factor to observed memory bandwidth, so that
- // next test will take approximately 1.5 sec
+ // next test will take approximately g_avg_time sec
- factor = g_thrsize * g_repeats * 3/2 / runtime;
+ factor = g_thrsize * g_repeats * g_avg_time / runtime;
ERR("run time = " << runtime << " -> next test with repeat factor=" << factor);
std::ostringstream result;
@@ -507,7 +534,12 @@ void* thread_master(void* cookie)
result << "datetime=" << datetime << '\t';
char hostname[256];
+#if !ON_WINDOWS
gethostname(hostname, sizeof(hostname));
+#else
+ DWORD hostnameSize = sizeof(hostname);
+ GetComputerName(hostname, &hostnameSize);
+#endif
result << "host=" << hostname << '\t';
result << "version=" << PACKAGE_VERSION << '\t'
@@ -630,11 +662,12 @@ void print_usage(const char* prog)
ERR("Usage: " << prog << " [options]" << std::endl
<< "Options:" << std::endl
<< " -f <match> Run only benchmarks containing this substring, can be used multile times. Try \"list\"." << std::endl
- << " -M <size> Limit the maximum amount of memory allocated at startup." << std::endl
+ << " -M <size> Limit the maximum amount of memory allocated at startup [byte]." << std::endl
<< " -p <nthrs> Run benchmarks with at least this thread count." << std::endl
<< " -P <nthrs> Run benchmarks with at most this thread count (overrides detected processor count)." << std::endl
<< " -Q Run benchmarks with quadratically increasing thread count." << std::endl
- << " -s <size> Limit the maximum test array size. Set to 0 for no limit." << std::endl
+ << " -s <size> Limit the _minimum_ test array size [byte]. Set to 0 for no limit." << std::endl
+ << " -S <size> Limit the _maximum_ test array size [byte]. Set to 0 for no limit." << std::endl
);
}
@@ -644,7 +677,7 @@ int main(int argc, char* argv[])
int opt;
- while ( (opt = getopt(argc, argv, "hf:M:p:P:Qs:")) != -1 )
+ while ( (opt = getopt(argc, argv, "hf:M:p:P:Qs:S:")) != -1 )
{
switch (opt) {
default:
@@ -713,15 +746,28 @@ int main(int argc, char* argv[])
break;
case 's':
- if (!parse_uint64t(optarg, gopt_sizelimit)) {
- ERR("Invalid parameter for -s <size limit>.");
+ if (!parse_uint64t(optarg, gopt_sizelimit_min)) {
+ ERR("Invalid parameter for -s <minimum size limit>.");
+ exit(EXIT_FAILURE);
+ }
+ else if (gopt_sizelimit_min == 0) {
+ ERR("Running benchmarks with no lower array size limit.");
+ }
+ else {
+ ERR("Running benchmarks with array size at least " << gopt_sizelimit_min << ".");
+ }
+ break;
+
+ case 'S':
+ if (!parse_uint64t(optarg, gopt_sizelimit_max)) {
+ ERR("Invalid parameter for -S <maximum size limit>.");
exit(EXIT_FAILURE);
}
- else if (gopt_sizelimit == 0) {
- ERR("Running benchmarks with no array size limit.");
+ else if (gopt_sizelimit_max == 0) {
+ ERR("Running benchmarks with no upper array size limit.");
}
else {
- ERR("Running benchmarks with array size up to " << gopt_sizelimit << ".");
+ ERR("Running benchmarks with array size up to " << gopt_sizelimit_max << ".");
}
break;
}
@@ -732,9 +778,28 @@ int main(int argc, char* argv[])
// *** allocate memory for tests
+#if !ON_WINDOWS
+
size_t physical_mem = sysconf(_SC_PHYS_PAGES) * (size_t)sysconf(_SC_PAGESIZE);
g_physical_cpus = sysconf(_SC_NPROCESSORS_ONLN);
+#else
+
+ MEMORYSTATUSEX memstx;
+ memstx.dwLength = sizeof(memstx);
+ GlobalMemoryStatusEx(&memstx);
+
+ size_t physical_mem = memstx.ullTotalPhys;
+
+ SYSTEM_INFO sysinfo;
+ GetSystemInfo( &sysinfo );
+
+ g_physical_cpus = sysinfo.dwNumberOfProcessors;
+
+#endif
+
+ ERR("Detected " << physical_mem / 1024/1024 << " MiB physical RAM and " << g_physical_cpus << " CPUs. " << std::endl);
+
// limit allocated memory via command line
if (gopt_memlimit && gopt_memlimit < physical_mem)
physical_mem = gopt_memlimit;
@@ -745,17 +810,23 @@ int main(int argc, char* argv[])
// due to roundup in loop to next cache-line size, add one extra cache-line per thread
g_memsize += g_physical_cpus * 256;
- ERR("Detected " << physical_mem / 1024/1024 << " MiB physical RAM and " << g_physical_cpus << " CPUs. " << std::endl
- << "Allocating " << g_memsize / 1024/1024 << " MiB for testing.");
+ ERR("Allocating " << g_memsize / 1024/1024 << " MiB for testing.");
// allocate memory area
- //g_memarea = (char*)malloc(g_memsize);
+
+#if HAVE_POSIX_MEMALIGN
if (posix_memalign((void**)&g_memarea, 32, g_memsize) != 0) {
ERR("Error allocating memory.");
return -1;
}
+#else
+
+ g_memarea = (char*)malloc(g_memsize);
+
+#endif
+
// fill memory with junk, but this allocates physical memory
memset(g_memarea, 1, g_memsize);

No commit comments for this range

Something went wrong with that request. Please try again.