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_LOONGARCH64) || defined(DOXYGEN)
98 @property (class, readonly, nonatomic) bool supportsLSX;
99 @property (class, readonly, nonatomic) bool supportsLASX;
100 # endif
101 # if defined(OF_WINDOWS) || defined(DOXYGEN)
102 @property (class, readonly, nonatomic, getter=isWindowsNT) bool windowsNT;
103 # endif
104 #endif
105 
111 + (size_t)pageSize;
112 
122 + (size_t)numberOfCPUs;
123 
130 
136 + (unsigned short)ObjFWVersionMajor;
137 
143 + (unsigned short)ObjFWVersionMinor;
144 
151 + (nullable OFString *)operatingSystemName;
152 
159 + (nullable OFString *)operatingSystemVersion;
160 
161 #if defined(OF_WINDOWS) || defined(DOXYGEN)
162 
171 + (nullable OFString *)wineVersion;
172 #endif
173 
185 + (nullable OFIRI *)userDataIRI;
186 
200 + (nullable OFIRI *)userConfigIRI;
201 
218 + (nullable OFIRI *)temporaryDirectoryIRI;
219 
227 + (nullable OFString *)CPUVendor;
228 
236 + (nullable OFString *)CPUModel;
237 
238 #if defined(OF_AMD64) || defined(OF_X86) || defined(DOXYGEN)
239 
246 + (bool)supportsMMX;
247 
255 + (bool)supports3DNow;
256 
264 + (bool)supportsEnhanced3DNow;
265 
273 + (bool)supportsSSE;
274 
282 + (bool)supportsSSE2;
283 
291 + (bool)supportsSSE3;
292 
300 + (bool)supportsSSSE3;
301 
309 + (bool)supportsSSE41;
310 
318 + (bool)supportsSSE42;
319 
327 + (bool)supportsAVX;
328 
336 + (bool)supportsAVX2;
337 
345 + (bool)supportsAESNI;
346 
354 + (bool)supportsSHAExtensions;
355 
364 
372 + (bool)supportsF16C;
373 
382 
393 
404 
413 
423 
434 
444 
454 
465 
476 
487 
498 
507 
516 
525 #endif
526 
527 #if defined(OF_POWERPC) || defined(OF_POWERPC64) || defined(DOXYGEN)
528 
535 + (bool)supportsAltiVec;
536 #endif
537 
538 #if defined(OF_LOONGARCH64) || defined(DOXYGEN)
539 
546 + (bool)supportsLSX;
547 
555 + (bool)supportsLASX;
556 #endif
557 
558 #if defined(OF_WINDOWS) || defined(DOXYGEN)
559 
566 + (bool)isWindowsNT;
567 #endif
568 
569 + (instancetype)alloc OF_UNAVAILABLE;
570 - (instancetype)init OF_UNAVAILABLE;
571 @end
572 
573 OF_ASSUME_NONNULL_END
574 
575 #ifdef OF_HAVE_SOCKETS
576 # import "OFSystemInfo+NetworkInterfaces.h"
577 #endif
bool supportsAVX512Float16Instructions()
Returns whether the CPU and OS support AVX-512 Float16 Instructions.
bool supportsAESNI()
Returns whether the CPU supports AES-NI.
bool supportsMMX()
Returns whether the CPU supports MMX.
A class for querying information about the system.
Definition: OFSystemInfo.h:34
size_t pageSize()
Returns the size of a page.
Definition: OFSystemInfo.m:449
bool supportsAVX512PrefetchInstructions()
Returns whether the CPU and OS support AVX-512 Prefetch Instructions.
bool supportsSSE41()
Returns whether the CPU supports SSE4.1.
bool supportsAVX512VectorByteManipulationInstructions2()
Returns whether the CPU and OS support AVX-512 Vector Byte Manipulation Instructions 2...
bool supportsSSE42()
Returns whether the CPU supports SSE4.2.
nullable OFIRI * userDataIRI()
Returns the path where user data for the application can be stored.
Definition: OFSystemInfo.m:501
The root class for all other classes inside ObjFW.
Definition: OFObject.h:690
bool supportsLSX()
Returns whether the CPU and OS support LSX.
bool supportsAVX512VectorNeuralNetworkInstructions()
Returns whether the CPU and OS support AVX-512 Vector Neural Network Instructions.
bool supportsSSSE3()
Returns whether the CPU supports SSSE3.
bool supportsAVX2()
Returns whether the CPU and OS support AVX2.
bool supportsSHAExtensions()
Returns whether the CPU supports Intel SHA Extensions.
A class for handling strings.
Definition: OFString.h:142
bool supportsSSE2()
Returns whether the CPU supports SSE2.
An abstract class for storing objects in a dictionary.
Definition: OFDictionary.h:82
OFString * ObjFWVersion()
The version of ObjFW.
Definition: OFSystemInfo.m:459
bool supportsAVX512ByteAndWordInstructions()
Returns whether the CPU and OS support AVX-512 Byte and Word Instructions.
bool supportsF16C()
Returns whether the CPU supports F16C.
bool supportsAVX512VectorPopulationCountInstruction()
Returns whether the CPU and OS support the AVX-512 Vector Population Count Instruction.
nullable OFIRI * temporaryDirectoryIRI()
Returns a path where temporary files for can be stored.
Definition: OFSystemInfo.m:677
instancetype init()
Initializes an already allocated object.
Definition: OFObject.m:696
bool supportsAVX512BitAlgorithms()
Returns whether the CPU and OS support AVX-512 Bit Algorithms.
unsigned short ObjFWVersionMajor()
The major version of ObjFW.
Definition: OFSystemInfo.m:464
bool supportsAVX512VectorByteManipulationInstructions()
Returns whether the CPU and OS support AVX-512 Vector Byte Manipulation Instructions.
bool supportsFusedMultiplyAdd()
Returns whether the CPU supports fused multiply-add.
instancetype alloc()
Allocates memory for an instance of the class and sets up the memory pool for the object...
Definition: OFObject.m:548
bool supportsAVX512BFloat16Instructions()
Returns whether the CPU and OS support AVX-512 BFloat16 Instructions.
bool supportsAVX512IntegerFusedMultiplyAdd()
Returns whether the CPU and OS support AVX-512 Integer Fused Multiply-Add.
bool supportsAVX()
Returns whether the CPU and OS support AVX.
bool supportsEnhanced3DNow()
Returns whether the CPU supports enhanced 3DNow!.
A class for representing IRIs, URIs, URLs and URNs, for parsing them as well as accessing parts of th...
Definition: OFIRI.h:39
bool isWindowsNT()
Returns whether the application is running on Windows NT.
nullable OFString * operatingSystemName()
Returns the name of the operating system the application is running on.
Definition: OFSystemInfo.m:474
nullable OFString * CPUModel()
Returns the model of the CPU.
Definition: OFSystemInfo.m:782
size_t numberOfCPUs()
Returns the number of CPUs installed in the system.
Definition: OFSystemInfo.m:454
bool supportsLASX()
Returns whether the CPU and OS support LASX.
bool supportsAVX512ConflictDetectionInstructions()
Returns whether the CPU and OS support AVX-512 Conflict Detection Instructions.
nullable OFString * CPUVendor()
Returns the vendor of the CPU.
Definition: OFSystemInfo.m:759
bool supportsSSE()
Returns whether the CPU supports SSE.
nullable OFString * operatingSystemVersion()
Returns the version of the operating system the application is running on.
Definition: OFSystemInfo.m:482
bool supportsAVX512Foundation()
Returns whether the CPU and OS support AVX-512 Foundation.
nullable OFIRI * userConfigIRI()
Returns the path where user configuration for the application can be stored.
Definition: OFSystemInfo.m:593
bool supportsAVX512VectorLengthExtensions()
Returns whether the CPU and OS support AVX-512 Vector Length Extensions.
bool supportsSSE3()
Returns whether the CPU supports SSE3.
unsigned short ObjFWVersionMinor()
The minor version of ObjFW.
Definition: OFSystemInfo.m:469
bool supports3DNow()
Returns whether the CPU supports 3DNow!.
bool supportsAVX512DoublewordAndQuadwordInstructions()
Returns whether the CPU and OS support AVX-512 Doubleword and Quadword Instructions.
bool supportsAltiVec()
Returns whether the CPU and OS support AltiVec.
bool supportsAVX512ExponentialAndReciprocalInstructions()
Returns whether the CPU and OS support AVX-512 Exponential and Reciprocal Instructions.
nullable OFString * wineVersion()
Returns the version of Wine the application is running on, or nil if not running on Wine (e...