Also detect number of CPU cores and x64 support

This commit is contained in:
LoRd_MuldeR 2010-11-15 14:02:58 +01:00
parent 37a328b074
commit c543451f67
4 changed files with 22 additions and 2 deletions

View File

@ -25,7 +25,7 @@
#define VER_LAMEXP_MAJOR 4 #define VER_LAMEXP_MAJOR 4
#define VER_LAMEXP_MINOR_HI 0 #define VER_LAMEXP_MINOR_HI 0
#define VER_LAMEXP_MINOR_LO 0 #define VER_LAMEXP_MINOR_LO 0
#define VER_LAMEXP_BUILD 20 #define VER_LAMEXP_BUILD 21
#define VER_LAMEXP_SUFFIX TechPreview #define VER_LAMEXP_SUFFIX TechPreview
/* /*

View File

@ -246,6 +246,22 @@ lamexp_cpu_t lamexp_detect_cpu_features(void)
} }
strcpy_s(features.brand, 0x40, CPUBrandString); strcpy_s(features.brand, 0x40, CPUBrandString);
#if defined(_M_X64 ) || defined(_M_IA64)
features.x64 = true;
#else
BOOL x64 = FALSE;
if(IsWow64Process(GetCurrentProcess(), &x64))
{
features.x64 = x64;
}
#endif
SYSTEM_INFO systemInfo;
memset(&systemInfo, 0, sizeof(SYSTEM_INFO));
GetNativeSystemInfo(&systemInfo);
features.count = systemInfo.dwNumberOfProcessors;
return features; return features;
} }

View File

@ -42,6 +42,8 @@ typedef struct
int family; int family;
int model; int model;
int stepping; int stepping;
int count;
bool x64;
bool mmx; bool mmx;
bool sse; bool sse;
bool sse2; bool sse2;
@ -85,6 +87,7 @@ SIZE_T lamexp_dbg_private_bytes(void);
#define LAMEXP_CLOSE(HANDLE) if(HANDLE != NULL && HANDLE != INVALID_HANDLE_VALUE) { CloseHandle(HANDLE); HANDLE = NULL; } #define LAMEXP_CLOSE(HANDLE) if(HANDLE != NULL && HANDLE != INVALID_HANDLE_VALUE) { CloseHandle(HANDLE); HANDLE = NULL; }
#define QWCHAR(STR) reinterpret_cast<const wchar_t*>(STR.utf16()) #define QWCHAR(STR) reinterpret_cast<const wchar_t*>(STR.utf16())
#define LAMEXP_DYNCAST(OUT,CLASS,SRC) try { OUT = dynamic_cast<CLASS>(SRC); } catch(std::bad_cast) { OUT = NULL; } #define LAMEXP_DYNCAST(OUT,CLASS,SRC) try { OUT = dynamic_cast<CLASS>(SRC); } catch(std::bad_cast) { OUT = NULL; }
#define LAMEXP_BOOL(X) (X ? "1" : "0")
//Check for debug build //Check for debug build
#if defined(_DEBUG) || defined(QT_DEBUG) || !defined(NDEBUG) || !defined(QT_NODEBUG) #if defined(_DEBUG) || defined(QT_DEBUG) || !defined(NDEBUG) || !defined(QT_NODEBUG)

View File

@ -60,7 +60,8 @@ int lamexp_main(int argc, char* argv[])
lamexp_cpu_t cpuFeatures = lamexp_detect_cpu_features(); lamexp_cpu_t cpuFeatures = lamexp_detect_cpu_features();
qDebug("CPU brand string: %s", cpuFeatures.brand); qDebug("CPU brand string: %s", cpuFeatures.brand);
qDebug("CPU signature: Family: %d, Model: %d, Stepping: %d", cpuFeatures.family, cpuFeatures.model, cpuFeatures.stepping); qDebug("CPU signature: Family: %d, Model: %d, Stepping: %d", cpuFeatures.family, cpuFeatures.model, cpuFeatures.stepping);
qDebug("CPU capabilities: MMX: %s, SSE: %s, SSE2: %s, SSE3: %s, SSSE3: %s\n", (cpuFeatures.mmx ? "Yes" : "No"), (cpuFeatures.sse ? "Yes" : "No"), (cpuFeatures.sse2 ? "Yes" : "No"), (cpuFeatures.sse3 ? "Yes" : "No"), (cpuFeatures.ssse3 ? "Yes" : "No")); qDebug("CPU capabilities: MMX: %s, SSE: %s, SSE2: %s, SSE3: %s, SSSE3: %s, x64: %s", LAMEXP_BOOL(cpuFeatures.mmx), LAMEXP_BOOL(cpuFeatures.sse), LAMEXP_BOOL(cpuFeatures.sse2), LAMEXP_BOOL(cpuFeatures.sse3), LAMEXP_BOOL(cpuFeatures.ssse3), LAMEXP_BOOL(cpuFeatures.x64));
qDebug("CPU no. of cores: %d\n", cpuFeatures.count);
//Initialize Qt //Initialize Qt
lamexp_init_qt(argc, argv); lamexp_init_qt(argc, argv);