ClanLib  2.3.7
List of all members
CL_System Class Reference

General system helper functions. More...

#include <system.h>

Static Public Member Functions

Operations
static void * aligned_alloc (size_t size, size_t alignment=16)
 Allocates aligned memory. More...
 
static void aligned_free (void *ptr)
 Frees aligned memory. More...
 
static int capture_stack_trace (int frames_to_skip, int max_frames, void **out_frames, unsigned int *out_hash=0)
 Captures a stack back trace by walking up the stack and recording the information for each frame. More...
 
static std::vector< CL_Stringget_stack_frames_text (void **frames, int num_frames)
 Returns the function names and lines for the specified stack frame addresses. More...
 
static void sleep (int millis)
 Sleep for 'millis' milliseconds. More...
 
static void pause (int millis)
 Pause for 'millis' milliseconds. More...
 
static CL_String get_exe_path ()
 Returns the full dirname of the executable that started this. More...
 
template<typename T >
static void call_constructor (T *memory)
 Calls the constructor of a class. More...
 
template<typename T , typename P1 >
static void call_constructor (T *memory, P1 p1)
 
template<typename T , typename P1 , typename P2 >
static void call_constructor (T *memory, P1 p1, P2 p2)
 
template<typename T , typename P1 , typename P2 , typename P3 >
static void call_constructor (T *memory, P1 p1, P2 p2, P3 p3)
 
template<typename T , typename P1 , typename P2 , typename P3 , typename P4 >
static void call_constructor (T *memory, P1 p1, P2 p2, P3 p3, P4 p4)
 
template<typename T , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 >
static void call_constructor (T *memory, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5)
 
template<typename T , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 , typename P6 >
static void call_constructor (T *memory, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6)
 
template<typename T , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 , typename P6 , typename P7 >
static void call_constructor (T *memory, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7)
 
template<typename T >
static void call_destructor (T *memory)
 Calls the destructor of a class. More...
 

Attributes

enum  CL_CPU_ExtensionX86 {
  mmx, mmx_ex, _3d_now, _3d_now_ex,
  sse, sse2, sse3, ssse3,
  sse4_a, sse4_1, sse4_2, xop,
  avx, aes, fma3, fma4
}
 
enum  CL_CPU_ExtensionPPC { altivec }
 
static unsigned int get_time ()
 Get the current time (since system boot), in milliseconds. More...
 
static cl_ubyte64 get_microseconds ()
 Get the current time microseconds. More...
 
static bool detect_cpu_extension (CL_CPU_ExtensionX86 ext)
 
static bool detect_cpu_extension (CL_CPU_ExtensionPPC ext)
 
static CL_Mutexget_sharedptr_mutex ()
 Returns the mutex used by CL_SharedPtr. More...
 
static int get_num_cores ()
 Return the number of CPU cores. More...
 

Detailed Description

General system helper functions.

Member Enumeration Documentation

Enumerator
altivec 
Enumerator
mmx 
mmx_ex 
_3d_now 
_3d_now_ex 
sse 
sse2 
sse3 
ssse3 
sse4_a 
sse4_1 
sse4_2 
xop 
avx 
aes 
fma3 
fma4 

Member Function Documentation

static void* CL_System::aligned_alloc ( size_t  size,
size_t  alignment = 16 
)
static

Allocates aligned memory.

static void CL_System::aligned_free ( void *  ptr)
static

Frees aligned memory.

template<typename T >
static void CL_System::call_constructor ( T *  memory)
inlinestatic

Calls the constructor of a class.

template<typename T , typename P1 >
static void CL_System::call_constructor ( T *  memory,
P1  p1 
)
inlinestatic
template<typename T , typename P1 , typename P2 >
static void CL_System::call_constructor ( T *  memory,
P1  p1,
P2  p2 
)
inlinestatic
template<typename T , typename P1 , typename P2 , typename P3 >
static void CL_System::call_constructor ( T *  memory,
P1  p1,
P2  p2,
P3  p3 
)
inlinestatic
template<typename T , typename P1 , typename P2 , typename P3 , typename P4 >
static void CL_System::call_constructor ( T *  memory,
P1  p1,
P2  p2,
P3  p3,
P4  p4 
)
inlinestatic
template<typename T , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 >
static void CL_System::call_constructor ( T *  memory,
P1  p1,
P2  p2,
P3  p3,
P4  p4,
P5  p5 
)
inlinestatic
template<typename T , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 , typename P6 >
static void CL_System::call_constructor ( T *  memory,
P1  p1,
P2  p2,
P3  p3,
P4  p4,
P5  p5,
P6  p6 
)
inlinestatic
template<typename T , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 , typename P6 , typename P7 >
static void CL_System::call_constructor ( T *  memory,
P1  p1,
P2  p2,
P3  p3,
P4  p4,
P5  p5,
P6  p6,
P7  p7 
)
inlinestatic
template<typename T >
static void CL_System::call_destructor ( T *  memory)
inlinestatic

Calls the destructor of a class.

Referenced by CL_BlockAllocator::delete_obj().

static int CL_System::capture_stack_trace ( int  frames_to_skip,
int  max_frames,
void **  out_frames,
unsigned int *  out_hash = 0 
)
static

Captures a stack back trace by walking up the stack and recording the information for each frame.

static bool CL_System::detect_cpu_extension ( CL_CPU_ExtensionX86  ext)
static
static bool CL_System::detect_cpu_extension ( CL_CPU_ExtensionPPC  ext)
static
static CL_String CL_System::get_exe_path ( )
static

Returns the full dirname of the executable that started this.

process (aka argv[0])

This is necessary since when programms are started from the PATH there is no clean and simple way to figure out the location of the data files, thus information is read from /proc/self/exe under GNU/Linux and from GetModuleFileName() on Win32.

Returns
full dirname of the executable, trailing slash is included
static cl_ubyte64 CL_System::get_microseconds ( )
static

Get the current time microseconds.

static int CL_System::get_num_cores ( )
static

Return the number of CPU cores.

static CL_Mutex* CL_System::get_sharedptr_mutex ( )
static

Returns the mutex used by CL_SharedPtr.

static std::vector<CL_String> CL_System::get_stack_frames_text ( void **  frames,
int  num_frames 
)
static

Returns the function names and lines for the specified stack frame addresses.

On Linux, to obtain function names, remember to link with the -rdynamic flag

static unsigned int CL_System::get_time ( )
static

Get the current time (since system boot), in milliseconds.

static void CL_System::pause ( int  millis)
static

Pause for 'millis' milliseconds.

This function acts as sleep, but the function "may" perform a spinlock on some operating systems to give a more accurate pause. This may have a side effect of causing 100% cpu usage. If you do not require an accurate pause, use sleep instead.

static void CL_System::sleep ( int  millis)
static

Sleep for 'millis' milliseconds.

It is possible for this function to sleep for more than millis, depending on the OS scheduler. If you require a more accurate sleep, consider pause.


The documentation for this class was generated from the following file: