SYNOPSIS
#include <agar/core.h>
DESCRIPTION
The agar
AG_CPUInfo interface provides some information about the current architecture and
architecture extensions.
INTERFACE
The AG_GetCPUInfo() function returns CPU information into an existing info structure.
STRUCTURE DATA
For the
AG_CPUInfo structure:
| const char *arch | A string describing the architecture (e.g., "alpha", "i386", etc). |
| char vendorID[13] | A vendor ID string (architecture-specific). |
| Uint32 ext | A list of architecture extensions that have some relevance to user applications (see ARCHITECTURE EXTENSIONS below). |
ARCHITECTURE EXTENSIONS
The
ext field can contain the following flags:
| AG_EXT_CPUID | The i386 CPUID instruction is supported. |
| AG_EXT_MMX | MMX instructions are available. |
| AG_EXT_MMX_EXT | AMD extensions to MMX are available. |
| AG_EXT_3DNOW | 3dNow! is supported. |
| AG_EXT_3DNOW_EXT | Extended 3dNow! is supported. |
| AG_EXT_ALTIVEC | AltiVec instructions are supported. |
| AG_EXT_SSE | Streaming SIMD extensions are supported. |
| AG_EXT_SSE2 | SSE2 extensions are supported. |
| AG_EXT_SSE3 | SSE3 (PNI) extensions are supported. |
| AG_EXT_LONG_MODE | Long mode is available. |
| AG_EXT_RDTSCP | The RDTSCP instruction exists. |
| AG_EXT_FXSR | Fast FXSAVE/FXSTOR is available. |
| AG_EXT_PAGE_NX | The per-page no-execute bit (W^X) is supported. |
| AG_EXT_SSE5A | SSE5A extensions are available. |
| AG_EXT_3DNOW_PREFETCH | The PREFETCH and PREFETCHW instructions for 3dNow! are available. |
| AG_EXT_SSE_MISALIGNED | Misaligned SSE mode is supported. |
| AG_EXT_SSE4A | SSE4A extensions are available. |
| AG_EXT_ONCHIP_FPU | The floating point unit is on-chip. |
| AG_EXT_TSC | The Time Stamp Counter is available. |
| AG_EXT_CMOV | The CMOV (Conditional Move) instruction exists. |
| AG_EXT_CLFLUSH | The CLFLUSH (Cache Line Flush) instruction exists. |
| AG_EXT_HTT | Hyper-Threading technology is supported. |
| AG_EXT_MON | MONITOR and MWAIT instructions exist. |
| AG_EXT_VMX | Virtual Machine Extensions are available. |
| AG_EXT_SSSE3 | SSSE3 extensions are available. |
| AG_EXT_SSE41 | SSE4.1 extensions are available. |
| AG_EXT_SSE42 | SSE4.2 extensions are available. |
EXAMPLES
The following code prints architecture information:
AG_CPUInfo cpu;
AG_GetCPUInfo(&cpu);
AG_Verbose("Architecture: %s\n", cpu.arch);
AG_Verbose("Vendor ID: %s\n", cpu.vendorID);
AG_Verbose("AltiVec: %s\n", (cpu.ext & AG_EXT_ALTIVEC) ? "Yes" : "No");
AG_Verbose("SSE: %s\n", (cpu.ext & AG_EXT_SSE) ? "Yes" : "No");
SEE ALSO
HISTORY
The
AG_CPUInfo interface first appeared in
Agar 1.3.4.