Commit 29601c28 authored by Sam Lantinga's avatar Sam Lantinga

Added SDL_GetCPUCount() to see how many cores are available.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404328
parent 3f0f9188
......@@ -207,7 +207,7 @@ if test x$enable_libc = xyes; then
AC_DEFINE(HAVE_MPROTECT)
]),
)
AC_CHECK_FUNCS(malloc calloc realloc free getenv putenv unsetenv qsort abs bcopy memset memcpy memmove strlen strlcpy strlcat strdup _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp sscanf snprintf vsnprintf sigaction setjmp nanosleep)
AC_CHECK_FUNCS(malloc calloc realloc free getenv putenv unsetenv qsort abs bcopy memset memcpy memmove strlen strlcpy strlcat strdup _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp sscanf snprintf vsnprintf sigaction setjmp nanosleep sysctlbyname)
AC_CHECK_LIB(m, pow, [LIBS="$LIBS -lm"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm"])
AC_CHECK_FUNCS(ceil copysign cos cosf fabs floor log pow scalbn sin sinf sqrt)
......
......@@ -150,6 +150,7 @@
#undef HAVE_SIGACTION
#undef HAVE_SETJMP
#undef HAVE_NANOSLEEP
#undef HAVE_SYSCTLBYNAME
#undef HAVE_CLOCK_GETTIME
#undef HAVE_GETPAGESIZE
#undef HAVE_MPROTECT
......
......@@ -106,6 +106,7 @@ typedef unsigned long uintptr_t;
#define HAVE_SIGACTION 1
#define HAVE_SETJMP 1
#define HAVE_NANOSLEEP 1
#define HAVE_SYSCTLBYNAME 1
/* enable iPhone version of Core Audio driver */
#define SDL_AUDIO_DRIVER_COREAUDIOIPHONE 1
......
......@@ -105,6 +105,7 @@
#define HAVE_SIGACTION 1
#define HAVE_SETJMP 1
#define HAVE_NANOSLEEP 1
#define HAVE_SYSCTLBYNAME 1
/* Enable various audio drivers */
#define SDL_AUDIO_DRIVER_COREAUDIO 1
......
......@@ -39,6 +39,11 @@ extern "C" {
/* *INDENT-ON* */
#endif
/**
* This function returns the number of CPU cores available.
*/
extern DECLSPEC int SDLCALL SDL_GetCPUCount(void);
/**
* This function returns true if the CPU has the RDTSC instruction.
*/
......
This diff is collapsed.
......@@ -49,4 +49,5 @@ extern void SDL_SYS_SetupThread(void);
extern void SDL_SYS_WaitThread(SDL_Thread * thread);
#endif /* _SDL_systhread_h */
/* vi: set ts=4 sw=4 expandtab: */
......@@ -155,6 +155,7 @@ int test_platform (void)
"big"
#endif
);
SDL_ATprintVerbose( 1, "CPU count: %d\n", SDL_GetCPUCount());
SDL_ATprintVerbose( 1, "Available extensions:\n" );
SDL_ATprintVerbose( 1, " RDTSC %s\n", SDL_HasRDTSC()? "detected" : "not detected" );
SDL_ATprintVerbose( 1, " MMX %s\n", SDL_HasMMX()? "detected" : "not detected" );
......
......@@ -134,6 +134,7 @@ int
TestCPUInfo(SDL_bool verbose)
{
if (verbose) {
printf("CPU count: %d\n", SDL_GetCPUCount());
printf("RDTSC %s\n", SDL_HasRDTSC()? "detected" : "not detected");
printf("MMX %s\n", SDL_HasMMX()? "detected" : "not detected");
printf("MMX Ext %s\n", SDL_HasMMXExt()? "detected" : "not detected");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment