if possible, detect the number of online CPUs in the system and use that

2006-07-14  Mukund Sivaraman  <muks@mukund.org>

	* app/config/gimpbaseconfig.c: if possible, detect the number of
	online CPUs in the system and use that instead of the default value
	of 2 for the number of pixel processors. Also made the default value
	1 where it's not possible to detect the number of CPUs. Uses twice
	the number for development versions.
This commit is contained in:
Mukund Sivaraman
2006-07-14 13:13:37 +00:00
committed by Mukund Sivaraman
parent 2882579207
commit 2711e79a93
2 changed files with 27 additions and 1 deletions

View File

@ -1,3 +1,11 @@
2006-07-14 Mukund Sivaraman <muks@mukund.org>
* app/config/gimpbaseconfig.c: if possible, detect the number of
online CPUs in the system and use that instead of the default value
of 2 for the number of pixel processors. Also made the default value
1 where it's not possible to detect the number of CPUs. Uses twice
the number for development versions.
2006-07-13 Sven Neumann <sven@gimp.org>
* app/display/gimpstatusbar.c (gimp_statusbar_set_cursor): set the

View File

@ -21,6 +21,10 @@
#include "config.h"
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <glib-object.h>
#include "libgimpbase/gimpbase.h"
@ -35,6 +39,8 @@
#include "gimp-intl.h"
#define NUM_PROCESSORS_DEFAULT 1
enum
{
@ -69,6 +75,7 @@ static void
gimp_base_config_class_init (GimpBaseConfigClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
gint num_processors;
object_class->finalize = gimp_base_config_finalize;
object_class->set_property = gimp_base_config_set_property;
@ -86,9 +93,20 @@ gimp_base_config_class_init (GimpBaseConfigClass *klass)
"${gimp_dir}",
GIMP_PARAM_STATIC_STRINGS |
GIMP_CONFIG_PARAM_RESTART);
#if defined(HAVE_UNISTD_H) && defined(_SC_NPROCESSORS_ONLN)
num_processors = sysconf (_SC_NPROCESSORS_ONLN);
#else
num_processors = NUM_PROCESSORS_DEFAULT;
#endif
#ifdef GIMP_UNSTABLE
num_processors = num_processors * 2;
#endif
GIMP_CONFIG_INSTALL_PROP_UINT (object_class, PROP_NUM_PROCESSORS,
"num-processors", NUM_PROCESSORS_BLURB,
1, GIMP_MAX_NUM_THREADS, 2,
1, GIMP_MAX_NUM_THREADS, num_processors,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_MEMSIZE (object_class, PROP_TILE_CACHE_SIZE,
"tile-cache-size", TILE_CACHE_SIZE_BLURB,