This commit is contained in:
Steve Checkoway
2006-01-15 23:20:13 +00:00
parent e23bebcfa3
commit f4f0d604b3
@@ -57,11 +57,11 @@ ArchHooks_darwin::ArchHooks_darwin()
{ {
CrashHandler::CrashHandlerHandleArgs( g_argc, g_argv ); CrashHandler::CrashHandlerHandleArgs( g_argc, g_argv );
/* First, handle non-fatal termination signals. */ /* First, handle non-fatal termination signals. */
SignalHandler::OnClose( DoCleanShutdown ); SignalHandler::OnClose( DoCleanShutdown );
SignalHandler::OnClose( DoCrashSignalHandler ); SignalHandler::OnClose( DoCrashSignalHandler );
//TimeCritMutex = new RageMutex("TimeCritMutex"); //TimeCritMutex = new RageMutex("TimeCritMutex");
// CF*Copy* functions' return values need to be released, CF*Get* functions' do not. // CF*Copy* functions' return values need to be released, CF*Get* functions' do not.
CFStringRef key = CFSTR( "ApplicationBundlePath" ); CFStringRef key = CFSTR( "ApplicationBundlePath" );
@@ -83,7 +83,7 @@ ArchHooks_darwin::ArchHooks_darwin()
if( !old ) if( !old )
{ {
newDict = CFDictionaryCreateMutable( kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, newDict = CFDictionaryCreateMutable( kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks,
&kCFTypeDictionaryValueCallBacks ); &kCFTypeDictionaryValueCallBacks );
CFDictionaryAddValue( newDict, version, value ); CFDictionaryAddValue( newDict, version, value );
} }
else else
@@ -118,48 +118,48 @@ ArchHooks_darwin::~ArchHooks_darwin()
void ArchHooks_darwin::DumpDebugInfo() void ArchHooks_darwin::DumpDebugInfo()
{ {
CString systemVersion; CString systemVersion;
OSErr err; OSErr err;
long code; long code;
/* Get system version */ /* Get system version */
err = Gestalt( gestaltSystemVersion, &code ); err = Gestalt( gestaltSystemVersion, &code );
if( err == noErr ) if( err == noErr )
{ {
int major = ( (code >> 12) & 0xF ) * 10 + (code >> 8) & 0xF; int major = ( (code >> 12) & 0xF ) * 10 + (code >> 8) & 0xF;
int minor = (code >> 4) & 0xF; int minor = (code >> 4) & 0xF;
int revision = code & 0xF; int revision = code & 0xF;
systemVersion = ssprintf( "Mac OS X %d.%d.%d", major, minor, revision ); systemVersion = ssprintf( "Mac OS X %d.%d.%d", major, minor, revision );
} }
else else
systemVersion = "Unknown system version"; systemVersion = "Unknown system version";
/* Get memory */ /* Get memory */
long ram; long ram;
long vRam; long vRam;
err = Gestalt( gestaltLogicalRAMSize, &vRam ); err = Gestalt( gestaltLogicalRAMSize, &vRam );
if (err != noErr) if (err != noErr)
vRam = 0; vRam = 0;
err = Gestalt( gestaltPhysicalRAMSize, &ram ); err = Gestalt( gestaltPhysicalRAMSize, &ram );
if( err == noErr ) if( err == noErr )
{ {
vRam -= ram; vRam -= ram;
if( vRam < 0 ) if( vRam < 0 )
vRam = 0; vRam = 0;
ram >>= 20; ram >>= 20;
vRam >>= 20; vRam >>= 20;
} }
else else
{ {
ram = 0; ram = 0;
vRam = 0; vRam = 0;
} }
/* Get processor information */ /* Get processor information */
CString processor; CString processor;
int numProcessors; int numProcessors;
struct host_basic_info info; struct host_basic_info info;
mach_port_t host = mach_host_self(); mach_port_t host = mach_host_self();
mach_msg_type_number_t size = HOST_BASIC_INFO_COUNT; mach_msg_type_number_t size = HOST_BASIC_INFO_COUNT;
@@ -181,8 +181,8 @@ void ArchHooks_darwin::DumpDebugInfo()
/* Get processor speed */ /* Get processor speed */
err = Gestalt( gestaltProcClkSpeed, &code ); err = Gestalt( gestaltProcClkSpeed, &code );
if( err != noErr ) if( err != noErr )
code = 0; code = 0;
float speed; float speed;
char power; char power;
@@ -198,11 +198,11 @@ void ArchHooks_darwin::DumpDebugInfo()
power = 'M'; power = 'M';
} }
/* Send all of the information to the log */ /* Send all of the information to the log */
LOG->Info( "Processor: %s (%d)", processor.c_str(), numProcessors ); LOG->Info( "Processor: %s (%d)", processor.c_str(), numProcessors );
LOG->Info( "Clock speed %.2f %cHz", speed, power ); LOG->Info( "Clock speed %.2f %cHz", speed, power );
LOG->Info( "%s", systemVersion.c_str()); LOG->Info( "%s", systemVersion.c_str());
LOG->Info( "Memory: %ld MB total, %ld MB swap", ram, vRam ); LOG->Info( "Memory: %ld MB total, %ld MB swap", ram, vRam );
} }
// In archutils/darwin/PreferredLanguage.m // In archutils/darwin/PreferredLanguage.m