Overview
Comment: | OFSystemInfo: Add +[CPUModel] |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
2447bb29679d18951f0c1e362ebfccd0 |
User & Date: | js on 2019-04-23 00:12:17 |
Other Links: | manifest | tags |
Context
2019-05-01
| ||
20:40 | .travis.yml: Re-enable Amiga as amiga-gcc is fixed check-in: 04de9d53bc user: js tags: trunk | |
2019-04-23
| ||
00:12 | OFSystemInfo: Add +[CPUModel] check-in: 2447bb2967 user: js tags: trunk | |
2019-04-22
| ||
16:53 | OFString_UTF8: Improved range checks check-in: 0b962df002 user: js tags: trunk | |
Changes
Modified src/OFSystemInfo.h from [6c13d1654b] to [e2aaa262d3].
︙ | ︙ | |||
36 37 38 39 40 41 42 43 44 45 46 47 48 49 | @property (class, readonly, nullable, nonatomic) OFString *operatingSystemVersion; # ifdef OF_HAVE_FILES @property (class, readonly, nullable, nonatomic) OFString *userDataPath; @property (class, readonly, nullable, nonatomic) OFString *userConfigPath; # endif @property (class, readonly, nullable, nonatomic) OFString *CPUVendor; # if defined(OF_X86_64) || defined(OF_X86) || defined(DOXYGEN) @property (class, readonly, nonatomic) bool supportsMMX; @property (class, readonly, nonatomic) bool supportsSSE; @property (class, readonly, nonatomic) bool supportsSSE2; @property (class, readonly, nonatomic) bool supportsSSE3; @property (class, readonly, nonatomic) bool supportsSSSE3; @property (class, readonly, nonatomic) bool supportsSSE41; | > | 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | @property (class, readonly, nullable, nonatomic) OFString *operatingSystemVersion; # ifdef OF_HAVE_FILES @property (class, readonly, nullable, nonatomic) OFString *userDataPath; @property (class, readonly, nullable, nonatomic) OFString *userConfigPath; # endif @property (class, readonly, nullable, nonatomic) OFString *CPUVendor; @property (class, readonly, nullable, nonatomic) OFString *CPUModel; # if defined(OF_X86_64) || defined(OF_X86) || defined(DOXYGEN) @property (class, readonly, nonatomic) bool supportsMMX; @property (class, readonly, nonatomic) bool supportsSSE; @property (class, readonly, nonatomic) bool supportsSSE2; @property (class, readonly, nonatomic) bool supportsSSE3; @property (class, readonly, nonatomic) bool supportsSSSE3; @property (class, readonly, nonatomic) bool supportsSSE41; |
︙ | ︙ | |||
142 143 144 145 146 147 148 149 150 151 152 153 154 155 | * * If the vendor could not be determined, `nil` is returned instead. * * @return The vendor of the CPU */ + (nullable OFString *)CPUVendor; #if defined(OF_X86_64) || defined(OF_X86) || defined(DOXYGEN) /*! * @brief Returns whether the CPU supports MMX. * * @note This method is only available on x86 and x86_64. * * @return Whether the CPU supports MMX | > > > > > > > > > | 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | * * If the vendor could not be determined, `nil` is returned instead. * * @return The vendor of the CPU */ + (nullable OFString *)CPUVendor; /*! * @brief Returns the model of the CPU. * * If the model could not be determined, `nil` is returned instead. * * @return The model of the CPU */ + (nullable OFString *)CPUModel; #if defined(OF_X86_64) || defined(OF_X86) || defined(DOXYGEN) /*! * @brief Returns whether the CPU supports MMX. * * @note This method is only available on x86 and x86_64. * * @return Whether the CPU supports MMX |
︙ | ︙ |
Modified src/OFSystemInfo.m from [10db3a92d5] to [9a78967309].
︙ | ︙ | |||
24 25 26 27 28 29 30 | #include "unistd_wrapper.h" #include "platform.h" #ifdef HAVE_SYS_UTSNAME_H # include <sys/utsname.h> #endif | | | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | #include "unistd_wrapper.h" #include "platform.h" #ifdef HAVE_SYS_UTSNAME_H # include <sys/utsname.h> #endif #if defined(OF_MACOS) || defined(OF_NETBSD) # include <sys/sysctl.h> #endif #if defined(OF_AMIGAOS4) # define __USE_INLINE__ # define __NOLIBBASE__ # define __NOGLOBALIFACE__ |
︙ | ︙ | |||
566 567 568 569 570 571 572 573 574 575 576 577 578 579 | memcpy(buffer + 4, ®s.edx, 4); memcpy(buffer + 8, ®s.ecx, 4); return [OFString stringWithCString: buffer encoding: OF_STRING_ENCODING_ASCII length: 12]; #else return nil; #endif } #if defined(OF_X86_64) || defined(OF_X86) + (bool)supportsMMX { | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 | memcpy(buffer + 4, ®s.edx, 4); memcpy(buffer + 8, ®s.ecx, 4); return [OFString stringWithCString: buffer encoding: OF_STRING_ENCODING_ASCII length: 12]; #else return nil; #endif } + (OFString *)CPUModel { #if defined(OF_MACOS) || defined(OF_NETBSD) char value[256]; size_t length = sizeof(value); # if defined(OF_MACOS) if (sysctlbyname("machdep.cpu.brand_string", # elif defined(OF_NETBSD) if (sysctlbyname("machdep.cpu_brand", # endif &value, &length, NULL, 0) != 0) return nil; return [OFString stringWithCString: value encoding: OF_STRING_ENCODING_ASCII]; #elif defined(OF_AMIGAOS4) CONST_STRPTR model, version; GetCPUInfoTags(GCIT_ModelString, &model, GCIT_VersionString, &version, TAG_END); if (version != NULL) return [OFString stringWithFormat: @"%s V%s", model, version]; else return [OFString stringWithCString: model encoding: OF_STRING_ENCODING_ASCII]; #else return nil; #endif } #if defined(OF_X86_64) || defined(OF_X86) + (bool)supportsMMX { |
︙ | ︙ |
Modified tests/OFSystemInfoTests.m from [5857cdc712] to [98cec1ab7b].
︙ | ︙ | |||
60 61 62 63 64 65 66 67 68 69 70 71 72 73 | } @catch (OFNotImplementedException *e) { userDataPath = @"Not implemented"; } PRINT(GREEN, @"User data path: %@", userDataPath); #endif PRINT(GREEN, @"CPU vendor: %@", [OFSystemInfo CPUVendor]); #if defined(OF_X86_64) || defined(OF_X86) PRINT(GREEN, @"Supports MMX: %d", [OFSystemInfo supportsMMX]); PRINT(GREEN, @"Supports SSE: %d", [OFSystemInfo supportsSSE]); PRINT(GREEN, @"Supports SSE2: %d", [OFSystemInfo supportsSSE2]); | > > | 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | } @catch (OFNotImplementedException *e) { userDataPath = @"Not implemented"; } PRINT(GREEN, @"User data path: %@", userDataPath); #endif PRINT(GREEN, @"CPU vendor: %@", [OFSystemInfo CPUVendor]); PRINT(GREEN, @"CPU model: %@", [OFSystemInfo CPUModel]); #if defined(OF_X86_64) || defined(OF_X86) PRINT(GREEN, @"Supports MMX: %d", [OFSystemInfo supportsMMX]); PRINT(GREEN, @"Supports SSE: %d", [OFSystemInfo supportsSSE]); PRINT(GREEN, @"Supports SSE2: %d", [OFSystemInfo supportsSSE2]); |
︙ | ︙ |