ObjFW
OFSystemInfo.h
1 /*
2  * Copyright (c) 2008-2024 Jonathan Schleifer <js@nil.im>
3  *
4  * All rights reserved.
5  *
6  * This program is free software: you can redistribute it and/or modify it
7  * under the terms of the GNU Lesser General Public License version 3.0 only,
8  * as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
13  * version 3.0 for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * version 3.0 along with this program. If not, see
17  * <https://www.gnu.org/licenses/>.
18  */
19 
20 #import "OFObject.h"
21 #import "OFString.h"
22 
23 OF_ASSUME_NONNULL_BEGIN
24 
25 @class OFDictionary OF_GENERIC(KeyType, ObjectType);
26 @class OFIRI;
27 
33 OF_SUBCLASSING_RESTRICTED
35 #ifdef OF_HAVE_CLASS_PROPERTIES
36 @property (class, readonly, nonatomic) size_t pageSize;
37 @property (class, readonly, nonatomic) size_t numberOfCPUs;
38 @property (class, readonly, nonatomic) OFString *ObjFWVersion;
39 @property (class, readonly, nonatomic) unsigned short ObjFWVersionMajor;
40 @property (class, readonly, nonatomic) unsigned short ObjFWVersionMinor;
41 @property (class, readonly, nullable, nonatomic) OFString *operatingSystemName;
42 @property (class, readonly, nullable, nonatomic)
44 #if defined(OF_WINDOWS) || defined(DOXYGEN)
45 @property (class, readonly, nullable, nonatomic) OFString *wineVersion;
46 #endif
47 @property (class, readonly, nullable, nonatomic) OFIRI *userDataIRI;
48 @property (class, readonly, nullable, nonatomic) OFIRI *userConfigIRI;
49 @property (class, readonly, nullable, nonatomic) OFIRI *temporaryDirectoryIRI;
50 @property (class, readonly, nullable, nonatomic) OFString *CPUVendor;
51 @property (class, readonly, nullable, nonatomic) OFString *CPUModel;
52 # if defined(OF_AMD64) || defined(OF_X86) || defined(DOXYGEN)
53 @property (class, readonly, nonatomic) bool supportsMMX;
54 @property (class, readonly, nonatomic) bool supports3DNow;
55 @property (class, readonly, nonatomic) bool supportsEnhanced3DNow;
56 @property (class, readonly, nonatomic) bool supportsSSE;
57 @property (class, readonly, nonatomic) bool supportsSSE2;
58 @property (class, readonly, nonatomic) bool supportsSSE3;
59 @property (class, readonly, nonatomic) bool supportsSSSE3;
60 @property (class, readonly, nonatomic) bool supportsSSE41;
61 @property (class, readonly, nonatomic) bool supportsSSE42;
62 @property (class, readonly, nonatomic) bool supportsAVX;
63 @property (class, readonly, nonatomic) bool supportsAVX2;
64 @property (class, readonly, nonatomic) bool supportsAESNI;
65 @property (class, readonly, nonatomic) bool supportsSHAExtensions;
66 @property (class, readonly, nonatomic) bool supportsFusedMultiplyAdd;
67 @property (class, readonly, nonatomic) bool supportsF16C;
68 @property (class, readonly, nonatomic) bool supportsAVX512Foundation;
69 @property (class, readonly, nonatomic)
71 @property (class, readonly, nonatomic)
73 @property (class, readonly, nonatomic) bool supportsAVX512PrefetchInstructions;
74 @property (class, readonly, nonatomic)
76 @property (class, readonly, nonatomic)
78 @property (class, readonly, nonatomic)
80 @property (class, readonly, nonatomic)
82 @property (class, readonly, nonatomic)
84 @property (class, readonly, nonatomic)
86 @property (class, readonly, nonatomic)
88 @property (class, readonly, nonatomic)
90 @property (class, readonly, nonatomic) bool supportsAVX512BitAlgorithms;
91 @property (class, readonly, nonatomic) bool supportsAVX512Float16Instructions;
92 @property (class, readonly, nonatomic) bool supportsAVX512BFloat16Instructions;
93 # endif
94 # if defined(OF_POWERPC) || defined(OF_POWERPC64) || defined(DOXYGEN)
95 @property (class, readonly, nonatomic) bool supportsAltiVec;
96 # endif
97 # if defined(OF_WINDOWS) || defined(DOXYGEN)
98 @property (class, readonly, nonatomic, getter=isWindowsNT) bool windowsNT;
99 # endif
100 #endif
101 
107 + (size_t)pageSize;
108 
118 + (size_t)numberOfCPUs;
119 
126 
132 + (unsigned short)ObjFWVersionMajor;
133 
139 + (unsigned short)ObjFWVersionMinor;
140 
147 + (nullable OFString *)operatingSystemName;
148 
155 + (nullable OFString *)operatingSystemVersion;
156 
157 #if defined(OF_WINDOWS) || defined(DOXYGEN)
167 + (nullable OFString *)wineVersion;
168 #endif
169 
181 + (nullable OFIRI *)userDataIRI;
182 
196 + (nullable OFIRI *)userConfigIRI;
197 
214 + (nullable OFIRI *)temporaryDirectoryIRI;
215 
223 + (nullable OFString *)CPUVendor;
224 
232 + (nullable OFString *)CPUModel;
233 
234 #if defined(OF_AMD64) || defined(OF_X86) || defined(DOXYGEN)
242 + (bool)supportsMMX;
243 
251 + (bool)supports3DNow;
252 
260 + (bool)supportsEnhanced3DNow;
261 
269 + (bool)supportsSSE;
270 
278 + (bool)supportsSSE2;
279 
287 + (bool)supportsSSE3;
288 
296 + (bool)supportsSSSE3;
297 
305 + (bool)supportsSSE41;
306 
314 + (bool)supportsSSE42;
315 
323 + (bool)supportsAVX;
324 
332 + (bool)supportsAVX2;
333 
341 + (bool)supportsAESNI;
342 
350 + (bool)supportsSHAExtensions;
351 
360 
368 + (bool)supportsF16C;
369 
378 
389 
400 
409 
419 
430 
440 
450 
461 
472 
483 
494 
503 
512 
521 #endif
522 
523 #if defined(OF_POWERPC) || defined(OF_POWERPC64) || defined(DOXYGEN)
531 + (bool)supportsAltiVec;
532 #endif
533 
534 #if defined(OF_WINDOWS) || defined(DOXYGEN)
542 + (bool)isWindowsNT;
543 #endif
544 
545 + (instancetype)alloc OF_UNAVAILABLE;
546 - (instancetype)init OF_UNAVAILABLE;
547 @end
548 
549 OF_ASSUME_NONNULL_END
550 
551 #ifdef OF_HAVE_SOCKETS
552 # import "OFSystemInfo+NetworkInterfaces.h"
553 #endif
An abstract class for storing objects in a dictionary.
Definition: OFDictionary.h:84
A class for representing IRIs, URIs, URLs and URNs, for parsing them as well as accessing parts of th...
Definition: OFIRI.h:41
The root class for all other classes inside ObjFW.
Definition: OFObject.h:692
instancetype init()
Initializes an already allocated object.
Definition: OFObject.m:652
instancetype alloc()
Allocates memory for an instance of the class and sets up the memory pool for the object.
Definition: OFObject.m:504
A class for handling strings.
Definition: OFString.h:139
A class for querying information about the system.
Definition: OFSystemInfo.h:35
nullable OFString * CPUVendor()
Returns the vendor of the CPU.
Definition: OFSystemInfo.m:743
bool supportsAVX512Float16Instructions()
Returns whether the CPU and OS support AVX-512 Float16 Instructions.
bool supportsAVX()
Returns whether the CPU and OS support AVX.
size_t pageSize()
Returns the size of a page.
Definition: OFSystemInfo.m:433
bool supportsAVX512VectorNeuralNetworkInstructions()
Returns whether the CPU and OS support AVX-512 Vector Neural Network Instructions.
bool supportsAVX512PrefetchInstructions()
Returns whether the CPU and OS support AVX-512 Prefetch Instructions.
bool supportsSSE3()
Returns whether the CPU supports SSE3.
bool supportsAVX512VectorByteManipulationInstructions()
Returns whether the CPU and OS support AVX-512 Vector Byte Manipulation Instructions.
bool supports3DNow()
Returns whether the CPU supports 3DNow!.
bool supportsAVX512VectorPopulationCountInstruction()
Returns whether the CPU and OS support the AVX-512 Vector Population Count Instruction.
bool supportsAltiVec()
Returns whether the CPU and OS support AltiVec.
bool supportsAVX512Foundation()
Returns whether the CPU and OS support AVX-512 Foundation.
bool supportsEnhanced3DNow()
Returns whether the CPU supports enhanced 3DNow!.
bool supportsAVX512ExponentialAndReciprocalInstructions()
Returns whether the CPU and OS support AVX-512 Exponential and Reciprocal Instructions.
nullable OFIRI * userDataIRI()
Returns the path where user data for the application can be stored.
Definition: OFSystemInfo.m:485
nullable OFIRI * temporaryDirectoryIRI()
Returns a path where temporary files for can be stored.
Definition: OFSystemInfo.m:661
bool supportsAVX512IntegerFusedMultiplyAdd()
Returns whether the CPU and OS support AVX-512 Integer Fused Multiply-Add.
bool supportsFusedMultiplyAdd()
Returns whether the CPU supports fused multiply-add.
bool supportsAVX512DoublewordAndQuadwordInstructions()
Returns whether the CPU and OS support AVX-512 Doubleword and Quadword Instructions.
bool supportsAVX512BFloat16Instructions()
Returns whether the CPU and OS support AVX-512 BFloat16 Instructions.
bool supportsF16C()
Returns whether the CPU supports F16C.
bool supportsAVX512ByteAndWordInstructions()
Returns whether the CPU and OS support AVX-512 Byte and Word Instructions.
nullable OFString * operatingSystemName()
Returns the name of the operating system the application is running on.
Definition: OFSystemInfo.m:458
OFString * ObjFWVersion()
The version of ObjFW.
Definition: OFSystemInfo.m:443
bool supportsAVX512ConflictDetectionInstructions()
Returns whether the CPU and OS support AVX-512 Conflict Detection Instructions.
nullable OFString * operatingSystemVersion()
Returns the version of the operating system the application is running on.
Definition: OFSystemInfo.m:466
size_t numberOfCPUs()
Returns the number of CPUs installed in the system.
Definition: OFSystemInfo.m:438
nullable OFString * wineVersion()
Returns the version of Wine the application is running on, or nil if not running on Wine (e....
bool supportsAVX512VectorByteManipulationInstructions2()
Returns whether the CPU and OS support AVX-512 Vector Byte Manipulation Instructions 2.
nullable OFString * CPUModel()
Returns the model of the CPU.
Definition: OFSystemInfo.m:766
bool supportsSSE41()
Returns whether the CPU supports SSE4.1.
bool supportsSSSE3()
Returns whether the CPU supports SSSE3.
bool isWindowsNT()
Returns whether the application is running on Windows NT.
nullable OFIRI * userConfigIRI()
Returns the path where user configuration for the application can be stored.
Definition: OFSystemInfo.m:577
bool supportsSSE42()
Returns whether the CPU supports SSE4.2.
unsigned short ObjFWVersionMinor()
The minor version of ObjFW.
Definition: OFSystemInfo.m:453
bool supportsAVX512VectorLengthExtensions()
Returns whether the CPU and OS support AVX-512 Vector Length Extensions.
bool supportsAVX512BitAlgorithms()
Returns whether the CPU and OS support AVX-512 Bit Algorithms.
bool supportsAVX2()
Returns whether the CPU and OS support AVX2.
bool supportsAESNI()
Returns whether the CPU supports AES-NI.
bool supportsSSE()
Returns whether the CPU supports SSE.
bool supportsSHAExtensions()
Returns whether the CPU supports Intel SHA Extensions.
unsigned short ObjFWVersionMajor()
The major version of ObjFW.
Definition: OFSystemInfo.m:448
bool supportsSSE2()
Returns whether the CPU supports SSE2.
bool supportsMMX()
Returns whether the CPU supports MMX.