Skip to content

Query Hardware information

Finalspace edited this page May 29, 2026 · 2 revisions

Table of Contents

FPL provides a couple of functions for retrieving hardware information, such as CPU & memory infos, etc.

Get number of CPU-Cores

You can retrieve the number of processor cores by calling fplCPUGetCoreCount() .

size_t coreCount = ();
// Do something with the core count

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 to test for different architecture types. Use fplCPUGetArchName() to convert a fplCPUArchType into a string.

 cpuArch = ();
if (cpuArch == ) {
    // Do something on a ARM-64 CPU
}

// or just print it out
const char *cpuArchString = (cpuArch);
("CPU Architecture: %s\n", cpuArchString);

Get the CPU Name

You can query the CPU name by calling fplCPUGetName() .

// Print out the CPU-Name
char nameBuffer[1024];
(nameBuffer, (nameBuffer));
("CPU Name: %s\n", nameBuffer);

Query memory state

With fplMemoryGetUsage() 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.

 memInfos = ;
if ((&memInfos)) {
    ("%llu of %llu physical memory is available.\n", memInfos., memInfos.);
}

Query CPU Capabilities

Use the fplCPUGetCapabilities() to retrieve a full set of available processor capabilities, like MMX/SSE/AVX support, etc.

 caps = ;
if ((&caps)) {
    if (caps..) {
        // Do something when the x86 CPU supports SSE2 - this should be true, on most modern x86 CPUs.
    }
}

Final Platform Layer

Pages

Topics

Data Structures

Clone this wiki locally