From eb4691098767935c1ffd10f7da46796c11eefcfa Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Mon, 28 Jun 2010 15:57:54 -0600 Subject: Use sched_getaffinity() rather than sysconf(_SC_NPROCESSORS_ONLN). Also, abstract cpu counting into dedicated dmnsn_ncpus() function. --- libdimension/platform.h | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 libdimension/platform.h (limited to 'libdimension/platform.h') diff --git a/libdimension/platform.h b/libdimension/platform.h new file mode 100644 index 0000000..bda83dd --- /dev/null +++ b/libdimension/platform.h @@ -0,0 +1,29 @@ +/************************************************************************* + * Copyright (C) 2010 Tavian Barnes * + * * + * This file is part of The Dimension Library. * + * * + * The Dimension Library is free software; you can redistribute it and/ * + * or modify it under the terms of the GNU Lesser General Public License * + * as published by the Free Software Foundation; either version 3 of the * + * License, or (at your option) any later version. * + * * + * The Dimension Library is distributed in the hope that it will be * + * useful, but WITHOUT ANY WARRANTY; without even the implied warranty * + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this program. If not, see * + * . * + *************************************************************************/ + +#ifndef DIMENSION_IMPL_UTILITIES_H +#define DIMENSION_IMPL_UTILITIES_H + +#include + +/* Return the number of CPUs available to dimension */ +size_t dmnsn_ncpus(); + +#endif /* DIMENSION_IMPL_UTILITIES_H */ -- cgit v1.2.3