app/base/base-utils.c New files, with just one function so far,
2007-11-01 Tor Lillqvist <tml@novell.com> * app/base/base-utils.c * app/base/base-utils.h: New files, with just one function so far, get_number_of_processors(). Include implementation also for Win32. * app/base/Makefile.am (libappbase_a_SOURCES): Add new files. * app/config/gimpbaseconfig.c (gimp_base_config_class_init): Use get_number_of_processors(). svn path=/trunk/; revision=24028
This commit is contained in:

committed by
Tor Lillqvist

parent
07ab51f88c
commit
fab5330de2
11
ChangeLog
11
ChangeLog
@ -1,3 +1,14 @@
|
|||||||
|
2007-11-01 Tor Lillqvist <tml@novell.com>
|
||||||
|
|
||||||
|
* app/base/base-utils.c
|
||||||
|
* app/base/base-utils.h: New files, with just one function so far,
|
||||||
|
get_number_of_processors(). Include implementation also for Win32.
|
||||||
|
|
||||||
|
* app/base/Makefile.am (libappbase_a_SOURCES): Add new files.
|
||||||
|
|
||||||
|
* app/config/gimpbaseconfig.c (gimp_base_config_class_init): Use
|
||||||
|
get_number_of_processors().
|
||||||
|
|
||||||
2007-11-01 Manish Singh <yosh@gimp.org>
|
2007-11-01 Manish Singh <yosh@gimp.org>
|
||||||
|
|
||||||
* app/core/gimpcontainer-filter.c
|
* app/core/gimpcontainer-filter.c
|
||||||
|
@ -8,6 +8,8 @@ libappbase_a_SOURCES = \
|
|||||||
base-enums.c \
|
base-enums.c \
|
||||||
base-enums.h \
|
base-enums.h \
|
||||||
base-types.h \
|
base-types.h \
|
||||||
|
base-utils.c \
|
||||||
|
base-utils.h \
|
||||||
boundary.c \
|
boundary.c \
|
||||||
boundary.h \
|
boundary.h \
|
||||||
color-balance.c \
|
color-balance.c \
|
||||||
|
56
app/base/base-utils.c
Normal file
56
app/base/base-utils.c
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
/* GIMP - The GNU Image Manipulation Program
|
||||||
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program 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 General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
#ifdef HAVE_UNISTD_H
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <glib.h>
|
||||||
|
|
||||||
|
#ifdef G_OS_WIN32
|
||||||
|
#include <windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "base-utils.h"
|
||||||
|
|
||||||
|
#define NUM_PROCESSORS_DEFAULT 1
|
||||||
|
|
||||||
|
/* public functions */
|
||||||
|
|
||||||
|
gint
|
||||||
|
get_number_of_processors (void)
|
||||||
|
{
|
||||||
|
gint retval = NUM_PROCESSORS_DEFAULT;
|
||||||
|
|
||||||
|
#ifdef G_OS_UNIX
|
||||||
|
#if defined(HAVE_UNISTD_H) && defined(_SC_NPROCESSORS_ONLN)
|
||||||
|
retval = sysconf (_SC_NPROCESSORS_ONLN);
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#ifdef G_OS_WIN32
|
||||||
|
SYSTEM_INFO system_info;
|
||||||
|
|
||||||
|
GetSystemInfo (&system_info);
|
||||||
|
|
||||||
|
retval = system_info.dwNumberOfProcessors;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return retval;
|
||||||
|
}
|
24
app/base/base-utils.h
Normal file
24
app/base/base-utils.h
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
/* GIMP - The GNU Image Manipulation Program
|
||||||
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program 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 General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __BASE_H__
|
||||||
|
#define __BASE_H__
|
||||||
|
|
||||||
|
gint get_number_of_processors (void);
|
||||||
|
|
||||||
|
#endif /* __BASE_H__ */
|
@ -32,6 +32,7 @@
|
|||||||
|
|
||||||
#include "config-types.h"
|
#include "config-types.h"
|
||||||
|
|
||||||
|
#include "base/base-utils.h"
|
||||||
#include "base/pixel-processor.h"
|
#include "base/pixel-processor.h"
|
||||||
|
|
||||||
#include "gimprc-blurbs.h"
|
#include "gimprc-blurbs.h"
|
||||||
@ -39,8 +40,6 @@
|
|||||||
|
|
||||||
#include "gimp-intl.h"
|
#include "gimp-intl.h"
|
||||||
|
|
||||||
#define NUM_PROCESSORS_DEFAULT 1
|
|
||||||
|
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
@ -94,11 +93,7 @@ gimp_base_config_class_init (GimpBaseConfigClass *klass)
|
|||||||
GIMP_PARAM_STATIC_STRINGS |
|
GIMP_PARAM_STATIC_STRINGS |
|
||||||
GIMP_CONFIG_PARAM_RESTART);
|
GIMP_CONFIG_PARAM_RESTART);
|
||||||
|
|
||||||
#if defined(HAVE_UNISTD_H) && defined(_SC_NPROCESSORS_ONLN)
|
num_processors = get_number_of_processors ();
|
||||||
num_processors = sysconf (_SC_NPROCESSORS_ONLN);
|
|
||||||
#else
|
|
||||||
num_processors = NUM_PROCESSORS_DEFAULT;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef GIMP_UNSTABLE
|
#ifdef GIMP_UNSTABLE
|
||||||
num_processors = num_processors * 2;
|
num_processors = num_processors * 2;
|
||||||
|
Reference in New Issue
Block a user