cpuinfo: Rename SDL_GetCPUCount to SDL_GetNumLogicalCPUCores

This was the only API that broke the "GetNumThings" convention
used elsewhere, so renaming it helps with consistency.
Adding "logical cores" to the name also makes it a bit
more immediately obvious what the count actually represents.
This commit is contained in:
Carl Åstholm
2024-09-14 00:06:38 +02:00
committed by Sam Lantinga
parent 93bf534268
commit 1f3fd65c4c
11 changed files with 32 additions and 24 deletions

View File

@@ -120,7 +120,7 @@ static int SDLCALL platform_testEndianessAndSwap(void *arg)
/**
* Tests SDL_GetXYZ() functions
* \sa SDL_GetPlatform
* \sa SDL_GetCPUCount
* \sa SDL_GetNumLogicalCPUCores
* \sa SDL_GetRevision
* \sa SDL_GetCPUCacheLineSize
*/
@@ -142,10 +142,10 @@ static int SDLCALL platform_testGetFunctions(void *arg)
(int)len);
}
ret = SDL_GetCPUCount();
SDLTest_AssertPass("SDL_GetCPUCount()");
ret = SDL_GetNumLogicalCPUCores();
SDLTest_AssertPass("SDL_GetNumLogicalCPUCores()");
SDLTest_AssertCheck(ret > 0,
"SDL_GetCPUCount(): expected count > 0, was: %i",
"SDL_GetNumLogicalCPUCores(): expected count > 0, was: %i",
ret);
ret = SDL_GetCPUCacheLineSize();

View File

@@ -476,7 +476,7 @@ static AVCodecContext *OpenVideoStream(AVFormatContext *ic, int stream, const AV
context->strict_std_compliance = -2;
/* Enable threaded decoding, VVC decode is slow */
context->thread_count = SDL_GetCPUCount();
context->thread_count = SDL_GetNumLogicalCPUCores();
context->thread_type = (FF_THREAD_FRAME | FF_THREAD_SLICE);
}

View File

@@ -389,7 +389,7 @@ static int Test64Bit(SDL_bool verbose)
static int TestCPUInfo(SDL_bool verbose)
{
if (verbose) {
SDL_Log("CPU count: %d\n", SDL_GetCPUCount());
SDL_Log("Number of logical CPU cores: %d\n", SDL_GetNumLogicalCPUCores());
SDL_Log("CPU cache line size: %d\n", SDL_GetCPUCacheLineSize());
SDL_Log("AltiVec %s\n", SDL_HasAltiVec() ? "detected" : "not detected");
SDL_Log("MMX %s\n", SDL_HasMMX() ? "detected" : "not detected");