FPL provides a couple of functions for getting hardware functions, such as CPU & memory Infos, etc.
Get number of CPU-Cores
You can retrieve the number of processor cores by calling fplCPUGetCoreCount() .
fpl_platform_api size_t fplCPUGetCoreCount()
Retrieves the total number of processor cores.
- Note
- Hyperthreads will be included as well, so on a typical 4-core HT CPU, this function will return eight cores.
Get CPU architecture
You can query the CPU architecture type by calling fplCPUGetArchitecture() . This will return a fplCPUArchType value, which you can use test for different architecture types.
Use fplCPUGetArchName() to convert a fplCPUArchType into a string.
}
fpl_common_api void fplConsoleFormatOut(const char *format,...)
Writes the given formatted text to the standard output console buffer.
fpl_common_api const char * fplCPUGetArchName(const fplCPUArchType type)
Gets the string representation of the given architecture type.
fplCPUArchType
An enumeration of architecture types.
fpl_platform_api fplCPUArchType fplCPUGetArchitecture()
Gets the processor architecture type.
@ fplCPUArchType_Arm64
ARM64 architecture.
Get the CPU Name
You can query the CPU name by calling fplCPUGetName() .
char nameBuffer[1024];
fpl_common_api size_t fplCPUGetName(char *destBuffer, const size_t maxDestBufferLen)
Retrieves the name of the processor.
#define fplArrayCount(arr)
Returns the element count from a static array. This should ideally produce a compile error when passi...
Query memory state
With fplMemoryGetInfos() you can query the current memory state.
This includes the size of the physical memory, the current memory usage, and more.
See fplMemoryInfos for more details.
}
#define fplZeroInit
Initializes a struct to zero.
fpl_platform_api bool fplMemoryGetInfos(fplMemoryInfos *outInfos)
Retrieves the current system memory usage.
A structure that contains informations about current memory usage.
uint64_t totalPhysicalSize
Total size of physical memory in bytes (May be less than size of installed physical memory,...
uint64_t freePhysicalSize
Available physical memory in bytes.
Query CPU Capabilities
Use the fplCPUGetCapabilities() to retrieve a full set of available processor capabilities, like MMX/SSE/AVX support, etc.
}
}
fpl_common_api bool fplCPUGetCapabilities(fplCPUCapabilities *outCaps)
Gets the capabilities of the processor.
A structure that containing the processor capabilities, like MMX,SSE,AVX etc.
fpl_b32 hasSSE2
Is SSE-2 supported.