26 # include <CoreServices/CoreServices.h>
112 LARGE_INTEGER m_counterFrequency;
114 struct timeval m_start;
122 SInt32 m_OSXCPUSpeed;
123 double m_secondsPerNS;
252 static void*
malloc(
size_t bytes);
254 static void*
calloc(
size_t n,
size_t x);
259 static void*
realloc(
void* block,
size_t bytes);
278 static void free(
void* p);
294 static void memcpy(
void* dst,
const void* src,
size_t numBytes);
327 static const std::string&
build();
403 static void setEnv(
const std::string& name,
const std::string&
value);
406 static const char*
getEnv(
const std::string& name);
452 static std::string
findDataFile(
const std::string& full,
bool exceptionIfNotFound =
true,
bool caseSensitive =
491 QueryPerformanceCounter(&now);
497 #elif defined(G3D_LINUX)
502 __asm__ __volatile__ (
511 #elif defined(G3D_OSX)
519 return (
uint64) UnsignedWideToUInt64(UpTime());
534 AbsoluteTime end = UpTime();
536 AbsoluteDeltaToNanoseconds(end, UInt64ToUnsignedWide(cycleCount));
539 (
double) UnsignedWideToUInt64(diffNS) *
instance().m_secondsPerNS);
static void cpuid(CPUIDFunction func, uint32 &areg, uint32 &breg, uint32 &creg, uint32 &dreg)
Definition: System.cpp:1704
static bool consoleKeyPressed()
Definition: System.cpp:846
OutOfMemoryCallback m_outOfMemoryCallback
Definition: System.h:118
static void setEnv(const std::string &name, const std::string &value)
Definition: System.cpp:1566
void getStandardProcessorExtensions()
Definition: System.cpp:555
static void memset(void *dst, uint8 value, size_t numBytes)
Definition: System.cpp:695
bool(* OutOfMemoryCallback)(size_t size, bool recoverable)
Definition: System.h:83
RealTime m_realWorldGetTickTime0
Definition: System.h:127
static void beginCycleCount(uint64 &cycleCount)
Definition: System.h:525
static std::string currentDateString()
Definition: System.cpp:1673
static int cpuSpeedMHz()
Definition: System.h:174
CPUIDFunction
Definition: System.h:142
static void memcpy(void *dst, const void *src, size_t numBytes)
Definition: System.cpp:643
static void setOutOfMemoryCallback(OutOfMemoryCallback c)
Definition: System.h:383
static bool has3DNow()
Definition: System.h:208
void init()
Definition: System.cpp:128
static const std::string & cpuVendor()
Definition: System.h:212
std::string m_operatingSystem
Definition: System.h:107
uint32 m_highestCPUIDFunction
Definition: System.h:129
static System & instance()
The singleton instance.
Definition: System.cpp:96
System()
Used for the singleton instance only.
Definition: System.cpp:102
static std::string & appName()
Definition: System.cpp:740
static const std::string & build()
The optimization status of the G3D library (not the program compiled against it)
Definition: System.cpp:524
uint64_t uint64
Definition: g3dmath.h:170
static uint64 getCycleCount()
bool m_has3DNOW
Definition: System.h:95
static void * realloc(void *block, size_t bytes)
Definition: System.cpp:1463
static void describeSystem(class TextOutput &t)
Definition: System.cpp:1610
static void alignedFree(void *ptr)
Definition: System.cpp:1546
static void sleep(RealTime t)
Definition: SystemImpl.cpp:14
static std::string currentTimeString()
Definition: System.cpp:1680
bool m_hasSSE
Definition: System.h:92
double RealTime
Definition: G3DGameUnits.h:27
#define bool
Definition: CascPort.h:16
static std::string currentProgramFilename()
Definition: System.cpp:746
int m_numCores
Definition: System.h:99
static void * malloc(size_t bytes)
Definition: System.cpp:1441
static bool hasRDTSC()
Definition: System.h:188
static bool hasMMX()
Definition: System.h:204
static bool hasSSE3()
Definition: System.h:200
static int consoleReadKey()
Definition: System.cpp:888
std::string m_version
Definition: System.h:117
static std::string findDataFile(const std::string &full, bool exceptionIfNotFound=true, bool caseSensitive=true)
Definition: System.cpp:365
G3DEndian m_machineEndian
Definition: System.h:105
static int numCores()
Definition: System.h:180
bool m_hasMMX
Definition: System.h:91
bool m_hasRDTSC
Definition: System.h:90
uint32_t uint32
Definition: Define.h:150
uint64_t uint64
Definition: Define.h:149
bool m_hasAMDMMX
Definition: System.h:97
static bool hasSSE2()
Definition: System.h:196
bool m_hasCPUID
Definition: System.h:89
G3DEndian
The order in which the bytes of an integer are stored on a machine.
Definition: System.h:48
Definition: TextOutput.h:60
std::string license()
Definition: license.cpp:15
static void * alignedMalloc(size_t bytes, size_t alignment)
Definition: System.cpp:1482
static void cleanup()
Definition: System.cpp:518
static void * calloc(size_t n, size_t x)
Definition: System.cpp:1450
struct timeval m_start
Definition: System.h:114
static G3DEndian machineEndian()
Definition: System.h:219
static void free(void *p)
Definition: System.cpp:1473
static const std::string & version()
Definition: System.h:317
uint8_t uint8
Definition: g3dmath.h:164
bool m_hasSSE3
Definition: System.h:94
static RealTime time()
Definition: System.cpp:934
static void resetMallocPerformanceCounters()
Definition: System.cpp:1418
bool m_has3DNOW2
Definition: System.h:96
void initTime()
Definition: System.cpp:899
static void consoleClearScreen()
Definition: System.cpp:837
static const std::string & cpuArchitecture()
Definition: System.h:229
static OutOfMemoryCallback outOfMemoryCallback()
Definition: System.h:398
bool m_hasSSE2
Definition: System.h:93
bool m_initialized
Definition: System.h:87
std::string m_cpuArch
Definition: System.h:106
std::string m_cpuVendor
Definition: System.h:98
std::string m_appDataDir
Definition: System.h:103
const FieldDescriptor value
Definition: descriptor.h:1522
uint32_t uint32
Definition: g3dmath.h:168
static std::string mallocPerformance()
Definition: System.cpp:1401
G3D::int16 x
Definition: Vector2int16.h:37
int m_cpuSpeed
Definition: System.h:88
static std::string mallocStatus()
Definition: System.cpp:1409
static bool hasSSE()
Definition: System.h:192
static void endCycleCount(uint64 &cycleCount)
Definition: System.h:530
static bool hasCPUID()
Definition: System.h:184
OS and processor abstraction.
Definition: System.h:71
static const std::string & operatingSystem()
Definition: System.h:224
static const char * getEnv(const std::string &name)
Definition: System.cpp:1577
static void setAppDataDir(const std::string &path)
Definition: System.cpp:509