changed to get_physical_memory_size() and added an implementation for

2007-11-17  Sven Neumann  <sven@gimp.org>

	* app/base/base-utils.[ch]: changed to 
get_physical_memory_size()
	and added an implementation for POSIX.2 platforms.


svn path=/trunk/; revision=24180
This commit is contained in:
Sven Neumann
2007-11-17 13:13:11 +00:00
committed by Sven Neumann
parent 7cef521c8b
commit 287cc39898
3 changed files with 18 additions and 9 deletions

View File

@ -1,3 +1,8 @@
2007-11-17 Sven Neumann <sven@gimp.org>
* app/base/base-utils.[ch]: changed to get_physical_memory_size()
and added an implementation for POSIX.2 platforms.
2007-11-17 Tor Lillqvist <tml@novell.com>
* tools/gimptool.c: Ignore --msvc-syntax unless on Windows. Put

View File

@ -56,21 +56,23 @@ get_number_of_processors (void)
return retval;
}
gint
get_physical_memory_size_megabytes (void)
guint64
get_physical_memory_size (void)
{
gint retval = 0;
#ifdef G_OS_UNIX
/* ??? */
#if defined(HAVE_UNISTD_H) && defined(_SC_PHYS_PAGES) && defined (_SC_PAGE_SIZE)
return sysconf (_SC_PHYS_PAGES) * sysconf (_SC_PAGE_SIZE);
#endif
#endif
#ifdef G_OS_WIN32
MEMORYSTATUSEX memory_status;
memory_status.dwLength = sizeof (memory_status);
if (GlobalMemoryStatusEx (&memory_status))
retval = memory_status.ullTotalPhys / (1024*1024);
return memory_status.ullTotalPhys;
#endif
return retval;
return 0;
}

View File

@ -19,7 +19,9 @@
#ifndef __BASE_H__
#define __BASE_H__
gint get_number_of_processors (void);
gint get_physical_memory_size_megabytes (void);
gint get_number_of_processors (void);
guint64 get_physical_memory_size (void);
#endif /* __BASE_H__ */