Pyrogenesis  13997
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions
wcpu.cpp File Reference
#include "precompiled.h"
#include "lib/sysdep/os/win/wcpu.h"
#include "lib/sysdep/os_cpu.h"
#include "lib/bits.h"
#include "lib/alignment.h"
#include "lib/module_init.h"
#include "lib/sysdep/os/win/wutil.h"
#include "lib/sysdep/arch/x86_x64/x86_x64.h"

Go to the source code of this file.

Functions

uintptr_t os_cpu_ProcessorMask ()
 
size_t os_cpu_NumProcessors ()
 
Status wcpu_ReadFrequencyFromRegistry (u32 &freqMhz)
 
size_t os_cpu_PageSize ()
 
size_t os_cpu_LargePageSize ()
 
static void GetMemoryStatus (MEMORYSTATUSEX &mse)
 
size_t os_cpu_QueryMemorySize ()
 
size_t os_cpu_MemoryAvailable ()
 
DWORD_PTR wcpu_AffinityFromProcessorMask (DWORD_PTR processAffinity, uintptr_t processorMask)
 
uintptr_t wcpu_ProcessorMaskFromAffinity (DWORD_PTR processAffinity, DWORD_PTR affinity)
 
static void VerifyRunningOnCorrectProcessors (DWORD_PTR affinity)
 
uintptr_t os_cpu_SetThreadAffinityMask (uintptr_t processorMask)
 restrict the current thread to a set of processors. More...
 
Status os_cpu_CallByEachCPU (OsCpuCallback cb, uintptr_t cbData)
 execute the specified function once on each processor. More...
 

Function Documentation

static void GetMemoryStatus ( MEMORYSTATUSEX &  mse)
static

Definition at line 133 of file wcpu.cpp.

Status os_cpu_CallByEachCPU ( OsCpuCallback  cb,
uintptr_t  cbData 
)

execute the specified function once on each processor.

this proceeds serially (the callback is never reentered) in increasing order of processor ID. fails if process affinity prevents running on all processors.

Definition at line 255 of file wcpu.cpp.

size_t os_cpu_LargePageSize ( )
Returns
the size [bytes] of a large MMU page (4 MiB on most IA-32 systems) or zero if they are not supported.

Definition at line 110 of file wcpu.cpp.

size_t os_cpu_MemoryAvailable ( )
Returns
the current amount [MB] of available memory.

Definition at line 159 of file wcpu.cpp.

size_t os_cpu_NumProcessors ( )
Returns
the number of processors available to this process.

note: this function is necessary because POSIX sysconf _SC_NPROCESSORS_CONF is not suppored on MacOSX, else we would use that.

Definition at line 56 of file wcpu.cpp.

size_t os_cpu_PageSize ( )
Returns
the size [bytes] of a MMU page (4096 on most IA-32 systems)

Definition at line 95 of file wcpu.cpp.

uintptr_t os_cpu_ProcessorMask ( )
Returns
bit mask of processors that exist and are available to this process. its population count is by definition equal to os_cpu_NumProcessors().

Definition at line 38 of file wcpu.cpp.

size_t os_cpu_QueryMemorySize ( )
Returns
the size [MB] of physical memory as reported by the OS; no caching/validation is performed.

Definition at line 143 of file wcpu.cpp.

uintptr_t os_cpu_SetThreadAffinityMask ( uintptr_t  processorMask)

restrict the current thread to a set of processors.

Parameters
processorMaska bit mask of acceptable processors (bit index i corresponds to processor i)
Returns
the previous mask

Definition at line 234 of file wcpu.cpp.

static void VerifyRunningOnCorrectProcessors ( DWORD_PTR  affinity)
static

Definition at line 211 of file wcpu.cpp.

DWORD_PTR wcpu_AffinityFromProcessorMask ( DWORD_PTR  processAffinity,
uintptr_t  processorMask 
)

Definition at line 170 of file wcpu.cpp.

uintptr_t wcpu_ProcessorMaskFromAffinity ( DWORD_PTR  processAffinity,
DWORD_PTR  affinity 
)

Definition at line 189 of file wcpu.cpp.

Status wcpu_ReadFrequencyFromRegistry ( u32 freqMhz)

Definition at line 77 of file wcpu.cpp.