mirror of https://github.com/PCSX2/pcsx2.git
* Added code to detect amount of physical ram installed on the host computer.
* Added logging of host operating system and physical ram to startup. * Removed "PhysicalCores" stuff from both x86emitter and startup logs -- physical cores is losing its relevance with all the new AMD and Intel chip designs. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4048 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
9f52e30c06
commit
21f75b58db
|
@ -251,5 +251,6 @@ namespace HostSys
|
||||||
extern void InitCPUTicks();
|
extern void InitCPUTicks();
|
||||||
extern u64 GetTickFrequency();
|
extern u64 GetTickFrequency();
|
||||||
extern u64 GetCPUTicks();
|
extern u64 GetCPUTicks();
|
||||||
|
extern u64 GetPhysicalMemory();
|
||||||
|
|
||||||
extern wxString GetOSVersionString();
|
extern wxString GetOSVersionString();
|
||||||
|
|
|
@ -31,8 +31,6 @@ class x86capabilities
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
bool isIdentified;
|
bool isIdentified;
|
||||||
u32 LogicalCoresPerPhysicalCPU;
|
|
||||||
u32 PhysicalCoresPerPhysicalCPU;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
x86VendorType VendorID;
|
x86VendorType VendorID;
|
||||||
|
@ -106,8 +104,6 @@ public:
|
||||||
{
|
{
|
||||||
isIdentified = false;
|
isIdentified = false;
|
||||||
VendorID = x86Vendor_Unknown;
|
VendorID = x86Vendor_Unknown;
|
||||||
LogicalCoresPerPhysicalCPU = 1;
|
|
||||||
PhysicalCoresPerPhysicalCPU = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Identify();
|
void Identify();
|
||||||
|
|
|
@ -20,11 +20,18 @@
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <wx/utils.h>
|
#include <wx/utils.h>
|
||||||
|
|
||||||
extern "C" __aligned16 u8 _xmm_backup[16*2];
|
// Returns 0 on failure (not supported by the operating system).
|
||||||
extern "C" __aligned16 u8 _mmx_backup[8*4];
|
u64 GetPhysicalMemory()
|
||||||
|
{
|
||||||
|
u64 pages = 0;
|
||||||
|
|
||||||
|
#ifdef _SC_PHYS_PAGES
|
||||||
|
pages = sysconf(_SC_PHYS_PAGES);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return pages * getpagesize();
|
||||||
|
}
|
||||||
|
|
||||||
u8 _xmm_backup[16*2];
|
|
||||||
u8 _mmx_backup[8*4];
|
|
||||||
|
|
||||||
void InitCPUTicks()
|
void InitCPUTicks()
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
#include <winnt.h>
|
#include <winnt.h>
|
||||||
|
|
||||||
|
|
||||||
int SysPageFaultExceptionFilter( EXCEPTION_POINTERS* eps )
|
int SysPageFaultExceptionFilter( EXCEPTION_POINTERS* eps )
|
||||||
{
|
{
|
||||||
if( eps->ExceptionRecord->ExceptionCode != EXCEPTION_ACCESS_VIOLATION )
|
if( eps->ExceptionRecord->ExceptionCode != EXCEPTION_ACCESS_VIOLATION )
|
||||||
|
|
|
@ -39,6 +39,14 @@ u64 GetCPUTicks()
|
||||||
return count.QuadPart;
|
return count.QuadPart;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
u64 GetPhysicalMemory()
|
||||||
|
{
|
||||||
|
MEMORYSTATUSEX status;
|
||||||
|
status.dwLength = sizeof(status);
|
||||||
|
GlobalMemoryStatusEx(&status);
|
||||||
|
return status.ullTotalPhys;
|
||||||
|
}
|
||||||
|
|
||||||
// Windows SDK 7 provides this but previous ones do not, so roll our own in those cases:
|
// Windows SDK 7 provides this but previous ones do not, so roll our own in those cases:
|
||||||
#ifndef VER_SUITE_WH_SERVER
|
#ifndef VER_SUITE_WH_SERVER
|
||||||
# define VER_SUITE_WH_SERVER 0x00008000
|
# define VER_SUITE_WH_SERVER 0x00008000
|
||||||
|
|
|
@ -21,19 +21,10 @@
|
||||||
// FreeBSD/OsX need something far more complicated (apparently)
|
// FreeBSD/OsX need something far more complicated (apparently)
|
||||||
void x86capabilities::CountLogicalCores()
|
void x86capabilities::CountLogicalCores()
|
||||||
{
|
{
|
||||||
const uint numCPU = sysconf( _SC_NPROCESSORS_ONLN );
|
// Note : GetCPUCount uses sysconf( _SC_NPROCESSORS_ONLN ) internally, which can return 1
|
||||||
if( numCPU > 0 )
|
// if sysconf info isn't available (a long standing linux bug). There are no fallbacks or
|
||||||
{
|
// alternatives, apparently.
|
||||||
//isMultiCore = numCPU > 1;
|
LogicalCores = wxThread::GetCPUCount();
|
||||||
LogicalCores = numCPU;
|
|
||||||
PhysicalCores = ( numCPU / LogicalCoresPerPhysicalCPU ) * PhysicalCoresPerPhysicalCPU;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Indeterminate?
|
|
||||||
LogicalCores = 1;
|
|
||||||
PhysicalCores = 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CanEmitShit()
|
bool CanEmitShit()
|
||||||
|
|
|
@ -37,10 +37,6 @@ void x86capabilities::CountLogicalCores()
|
||||||
}
|
}
|
||||||
|
|
||||||
LogicalCores = CPUs;
|
LogicalCores = CPUs;
|
||||||
if( LogicalCoresPerPhysicalCPU > CPUs) // for 1-socket HTT-disabled machines
|
|
||||||
LogicalCoresPerPhysicalCPU = CPUs;
|
|
||||||
|
|
||||||
PhysicalCores = ( CPUs / LogicalCoresPerPhysicalCPU ) * PhysicalCoresPerPhysicalCPU;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool _test_instruction( void* pfnCall )
|
bool _test_instruction( void* pfnCall )
|
||||||
|
|
|
@ -133,23 +133,6 @@ void x86capabilities::CountCores()
|
||||||
s32 regs[ 4 ];
|
s32 regs[ 4 ];
|
||||||
u32 cmds;
|
u32 cmds;
|
||||||
|
|
||||||
LogicalCoresPerPhysicalCPU = 0;
|
|
||||||
PhysicalCoresPerPhysicalCPU = 1;
|
|
||||||
|
|
||||||
// detect multicore for Intel cpu
|
|
||||||
|
|
||||||
__cpuid( regs, 0 );
|
|
||||||
cmds = regs[ 0 ];
|
|
||||||
|
|
||||||
if( cmds >= 0x00000001 )
|
|
||||||
LogicalCoresPerPhysicalCPU = ( regs[1] >> 16 ) & 0xff;
|
|
||||||
|
|
||||||
if ((cmds >= 0x00000004) && (VendorID == x86Vendor_Intel))
|
|
||||||
{
|
|
||||||
__cpuid( regs, 0x00000004 );
|
|
||||||
PhysicalCoresPerPhysicalCPU += ( regs[0] >> 26) & 0x3f;
|
|
||||||
}
|
|
||||||
|
|
||||||
__cpuid( regs, 0x80000000 );
|
__cpuid( regs, 0x80000000 );
|
||||||
cmds = regs[ 0 ];
|
cmds = regs[ 0 ];
|
||||||
|
|
||||||
|
@ -157,9 +140,6 @@ void x86capabilities::CountCores()
|
||||||
|
|
||||||
if ((cmds >= 0x80000008) && (VendorID == x86Vendor_AMD) )
|
if ((cmds >= 0x80000008) && (VendorID == x86Vendor_AMD) )
|
||||||
{
|
{
|
||||||
__cpuid( regs, 0x80000008 );
|
|
||||||
PhysicalCoresPerPhysicalCPU += ( regs[2] ) & 0xff;
|
|
||||||
|
|
||||||
// AMD note: they don't support hyperthreading, but they like to flag this true
|
// AMD note: they don't support hyperthreading, but they like to flag this true
|
||||||
// anyway. Let's force-unflag it until we come up with a better solution.
|
// anyway. Let's force-unflag it until we come up with a better solution.
|
||||||
// (note: seems to affect some Phenom II's only? -- Athlon X2's and PhenomI's do
|
// (note: seems to affect some Phenom II's only? -- Athlon X2's and PhenomI's do
|
||||||
|
@ -167,9 +147,6 @@ void x86capabilities::CountCores()
|
||||||
hasMultiThreading = 0;
|
hasMultiThreading = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !hasMultiThreading || LogicalCoresPerPhysicalCPU == 0 )
|
|
||||||
LogicalCoresPerPhysicalCPU = 1;
|
|
||||||
|
|
||||||
// This will assign values into LogicalCores and PhysicalCores
|
// This will assign values into LogicalCores and PhysicalCores
|
||||||
CountLogicalCores();
|
CountLogicalCores();
|
||||||
}
|
}
|
||||||
|
|
|
@ -201,30 +201,37 @@ TraceLogFilters& SetTraceConfig()
|
||||||
// This function should be called once during program execution.
|
// This function should be called once during program execution.
|
||||||
void SysLogMachineCaps()
|
void SysLogMachineCaps()
|
||||||
{
|
{
|
||||||
Console.WriteLn( Color_StrongGreen, "PCSX2 %u.%u.%u.r%d %s - compiled on " __DATE__, PCSX2_VersionHi, PCSX2_VersionMid, PCSX2_VersionLo,
|
Console.WriteLn( Color_StrongGreen, "PCSX2 %u.%u.%u.r%d %s - compiled on " __DATE__,
|
||||||
|
PCSX2_VersionHi, PCSX2_VersionMid, PCSX2_VersionLo,
|
||||||
SVN_REV, SVN_MODS ? "(modded)" : ""
|
SVN_REV, SVN_MODS ? "(modded)" : ""
|
||||||
);
|
);
|
||||||
|
|
||||||
Console.WriteLn( "Savestate version: 0x%x", g_SaveVersion);
|
Console.WriteLn( "Savestate version: 0x%x", g_SaveVersion);
|
||||||
Console.Newline();
|
Console.Newline();
|
||||||
|
|
||||||
Console.WriteLn( Color_StrongBlack, "x86-32 Init:" );
|
Console.WriteLn( Color_StrongBlack, "Host Machine Init:" );
|
||||||
|
|
||||||
|
Console.Indent().WriteLn(
|
||||||
|
L"Operating System = %s\n"
|
||||||
|
L"Physical RAM = %u MB",
|
||||||
|
|
||||||
|
GetOSVersionString().c_str(),
|
||||||
|
(u32)(GetPhysicalMemory() / _1mb)
|
||||||
|
);
|
||||||
|
|
||||||
u32 speed = x86caps.CalculateMHz();
|
u32 speed = x86caps.CalculateMHz();
|
||||||
|
|
||||||
Console.Indent().WriteLn(
|
Console.Indent().WriteLn(
|
||||||
L"CPU vendor name = %s\n"
|
L"CPU name = %s\n"
|
||||||
L"FamilyID = %x\n"
|
L"Vendor/Model = %s - stepping=%02X\n"
|
||||||
L"x86Family = %s\n"
|
L"CPU speed = %u.%03u ghz (%u logical thread%s)\n"
|
||||||
L"CPU speed = %d.%03d ghz\n"
|
|
||||||
L"Cores = %d physical [%d logical]\n"
|
|
||||||
L"x86PType = %s\n"
|
L"x86PType = %s\n"
|
||||||
L"x86Flags = %8.8x %8.8x\n"
|
L"x86Flags = %08x %08x\n"
|
||||||
L"x86EFlags = %8.8x",
|
L"x86EFlags = %08x",
|
||||||
fromUTF8( x86caps.VendorName ).c_str(), x86caps.StepID,
|
|
||||||
fromUTF8( x86caps.FamilyName ).Trim().Trim(false).c_str(),
|
fromUTF8( x86caps.FamilyName ).Trim().Trim(false).c_str(),
|
||||||
|
fromUTF8( x86caps.VendorName ).c_str(), x86caps.StepID,
|
||||||
speed / 1000, speed % 1000,
|
speed / 1000, speed % 1000,
|
||||||
x86caps.PhysicalCores, x86caps.LogicalCores,
|
x86caps.LogicalCores, (x86caps.LogicalCores==1) ? L"" : L"s",
|
||||||
x86caps.GetTypeName().c_str(),
|
x86caps.GetTypeName().c_str(),
|
||||||
x86caps.Flags, x86caps.Flags2,
|
x86caps.Flags, x86caps.Flags2,
|
||||||
x86caps.EFlags
|
x86caps.EFlags
|
||||||
|
|
Loading…
Reference in New Issue