41 #if defined(NCBI_OS_DARWIN)
42 #import <Foundation/Foundation.h>
43 #import <Foundation/NSProcessInfo.h>
44 #include <CoreServices/CoreServices.h>
46 void GetOperatingSystemVersion(
unsigned &major,
unsigned &minor,
unsigned &patch)
48 NSOperatingSystemVersion versionObj = [NSProcessInfo processInfo].operatingSystemVersion;
50 major = (unsigned)versionObj.majorVersion;
51 minor = (
unsigned)versionObj.minorVersion;
52 patch = (unsigned)versionObj.patchVersion;
83 #if defined(NCBI_OS_MSWIN)
89 OSVERSIONINFOEXW osinfo;
90 memset(&osinfo, 0,
sizeof(osinfo));
91 osinfo.dwOSVersionInfoSize =
sizeof(osinfo);
93 typedef LONG(WINAPI *PRtlGetVersion)(LPOSVERSIONINFOEXW);
94 PRtlGetVersion pRtlGetVersion = (PRtlGetVersion)GetProcAddress(GetModuleHandle(TEXT(
"ntdll.dll")),
"RtlGetVersion");
97 status = pRtlGetVersion(&osinfo);
100 memset(&osinfo, 0,
sizeof(osinfo));
101 osinfo.dwOSVersionInfoSize =
sizeof(osinfo);
104 #pragma warning(push)
105 #pragma warning(disable:4996)
107 GetVersionExW((LPOSVERSIONINFOW)&osinfo);
114 switch( osinfo.dwMajorVersion ){
123 switch( osinfo.dwMinorVersion ){
143 switch( osinfo.dwMinorVersion ){
161 switch( osinfo.dwMinorVersion ){
165 (osinfo.wProductType == VER_NT_WORKSTATION)
173 (osinfo.wProductType == VER_NT_WORKSTATION)
180 (osinfo.wProductType == VER_NT_WORKSTATION)
187 (osinfo.wProductType == VER_NT_WORKSTATION)
196 (osinfo.wProductType == VER_NT_WORKSTATION)
207 memset(&sysinfo, 0,
sizeof(sysinfo));
209 typedef void (WINAPI *PGetSysInfo)(SYSTEM_INFO*);
211 PGetSysInfo pGetSysInfo = (PGetSysInfo) GetProcAddress( GetModuleHandle(TEXT(
"kernel32.dll")),
"GetNativeSystemInfo" );
212 if( pGetSysInfo !=
NULL ){
213 pGetSysInfo( &sysinfo );
215 GetSystemInfo( &sysinfo );
217 switch( sysinfo.wProcessorArchitecture ){
218 case PROCESSOR_ARCHITECTURE_UNKNOWN:
224 case PROCESSOR_ARCHITECTURE_INTEL:
228 case PROCESSOR_ARCHITECTURE_AMD64:
232 case PROCESSOR_ARCHITECTURE_IA64:
240 #elif defined(NCBI_OS_DARWIN)
249 GetOperatingSystemVersion(vers_maj, vers_min, vers_patch);
299 #elif defined(NCBI_OS_UNIX)
379 os_name =
"Windows 95";
382 os_name =
"Windows 98";
385 os_name =
"Windows ME";
388 os_name =
"Windows NT 3.51";
391 os_name =
"Windows NT 4.0";
394 os_name =
"Windows 2000";
397 os_name =
"Windows XP";
400 os_name =
"Windows 2003";
403 os_name =
"Windows 2003 R2";
406 os_name =
"Windows Vista";
409 os_name =
"Windows 2008";
412 os_name =
"Windows 2008 R2";
415 os_name =
"Windows 7";
418 os_name =
"Windows Server 2012";
421 os_name =
"Windows 8.0";
424 os_name =
"Windows Server 2012 R2";
427 os_name =
"Windows 8.1";
430 os_name =
"Windows Server 2016";
433 os_name =
"Windows 10";
439 os_name =
"MacOS X 10.1";
442 os_name =
"MacOS X 10.2";
445 os_name =
"MacOS X 10.3";
448 os_name =
"MacOS X 10.4";
451 os_name =
"MacOS X 10.5";
454 os_name =
"MacOS X 10.6";
457 os_name =
"MacOS X 10.7";
460 os_name =
"MacOS X 10.8 Mountain Lion";
463 os_name =
"MacOS X 10.9 Mavericks";
466 os_name =
"MacOS X 10.10 Yosemite";
469 os_name =
"MacOS X 10.11 El Capitan";
472 os_name =
"MacOS X 10.12 Sierra";
475 os_name =
"MacOS X 10.13 High Sierra";
478 os_name =
"MacOS X 10.14 Mojave";
481 os_name =
"MacOS X 10.15 Catalina";
488 os_name =
"Unix/Linux";
491 os_name =
"Unix/Solaris 9";
494 os_name =
"Unix/Solaris 10";
510 const char* arch_name =
"";
513 arch_name =
" Intel-x32";
516 arch_name =
" AMD-x64";
519 arch_name =
" Intel-x64";
522 arch_name =
" PowerPC";
525 arch_name =
" Sparc";
531 arch_name =
" Alpha";
bool operator<(const CGBenchVersionInfo &v1, const CGBenchVersionInfo &v2)
User-defined methods of the data storage class.
User-defined methods of the data storage class.
CTime AsCTime(CTime::ETimeZone tz=CTime::eLocal) const
void GetOsString(string *str) const
void AddOsString(string *str) const
void GetVersionString(string *str) const
retrieve just the version info
static void Initialize(size_t ver_major, size_t ver_minor, size_t ver_patch_level)
Forced to make this method public as far as friend declaration does not work on Linux.
void AddVersionString(string *str) const
void GetLabel(string *str) const
Format a label for this version.
~CGBenchVersionInfo(void)
static const char * str(char *buf, int n)
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static string IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
string AsString(const CTimeFormat &format=kEmptyStr, TSeconds out_tz=eCurrentTimeZone) const
Transform time to string.
TVer_major GetVer_major(void) const
Get the Ver_major member data.
TVer_minor & SetVer_minor(void)
Assign a value to Ver_minor data member.
const TBuild_date & GetBuild_date(void) const
Get the Build_date member data.
TVer_major & SetVer_major(void)
Assign a value to Ver_major data member.
TVer_patch & SetVer_patch(void)
Assign a value to Ver_patch data member.
TOs_ver & SetOs_ver(void)
Assign a value to Os_ver data member.
TVer_minor GetVer_minor(void) const
Get the Ver_minor member data.
TVer_patch GetVer_patch(void) const
Get the Ver_patch member data.
bool IsSetBuild_date(void) const
Check if a value has been assigned to Build_date data member.
TOs_ver GetOs_ver(void) const
Get the Os_ver member data.
@ eOS_Ver_cpu_generic
CPU attributes general mask (0xff000000)
@ eOS_Ver_ppc
any powerpc (0x04000000)
@ eOS_Ver_sparc
any sparc (0x05000000)
@ eOS_Ver_macosx_10_7
0x700
@ eOS_Ver_intel_x64
any intel x64 (0x03000000)
@ eOS_Ver_macosx_10_15
0xF00
@ eOS_Ver_windows_2003
0x8
@ eOS_Ver_windows_2008
0xb
@ eOS_Ver_macosx_10_9
0x900
@ eOS_Ver_alpha
any alpha (0x07000000)
@ eOS_Ver_amd_x64
any amd x64 (0x02000000)
@ eOS_Ver_windows_generic
bitmaks covering all Windows versions this corresponds to 0xff
@ eOS_Ver_unix_solaris_9
0x20000
@ eOS_Ver_unix_generic
bitmask for all linux and unix flavors this corresponds to 0xff0000
@ eOS_Ver_mips
any mips (0x06000000)
@ eOS_Ver_macosx_generic
bitmask covering all MacOS X versions this corresponds to 0xff00
@ eOS_Ver_macosx_10_14
0xE00
@ eOS_Ver_unix_solaris_10
0x30000
@ eOS_Ver_macosx_10_2
0x200
@ eOS_Ver_windows_2000
0x6
@ eOS_Ver_windows_eight
0xf
@ eOS_Ver_macosx_10_6
0x600
@ eOS_Ver_macosx_10_3
0x300
@ eOS_Ver_windows_seven
0xd
@ eOS_Ver_windows_2016
0x12
@ eOS_Ver_macosx_10_1
specific MacOS X versions 0x100
@ eOS_Ver_macosx_10_11
0xB00
@ eOS_Ver_windows_95
specific windows versions 0x1
@ eOS_Ver_macosx_10_8
0x800
@ eOS_Ver_macosx_10_13
0xD00
@ eOS_Ver_macosx_10_4
0x400
@ eOS_Ver_windows_eight_one
0x11
@ eOS_Ver_macosx_10_5
0x500
@ eOS_Ver_windows_vista
0xa
@ eOS_Ver_windows_ten
0x13
@ eOS_Ver_windows_2012_R2
0x10
@ eOS_Ver_macosx_10_12
0xC00
@ eOS_Ver_unix_linux
specific supported versions 0x10000
@ eOS_Ver_windows_2012
0xe
@ eOS_Ver_windows_2003_R2
0x9
@ eOS_Ver_windows_2008_R2
0xc
@ eOS_Ver_macosx_10_10
0xA00
@ eOS_Ver_intel_x32
any intel x32 (0x01000000)
unsigned int
A callback function used to compare two keys in a database.