Matrix Science Mascot Parser toolkit
 
Loading...
Searching...
No Matches
ms_processors.hpp
1/*
2##############################################################################
3# file: ms_processors.hpp #
4# 'msparser' toolkit #
5# Use this class to retrieve current CPU configuration #
6##############################################################################
7# COPYRIGHT NOTICE #
8# Copyright 1998-2003 Matrix Science Limited All Rights Reserved. #
9# #
10##############################################################################
11# $Archive:: /Mowse/ms_mascotresfile/include/ms_processors.hpp $ #
12# $Author: dcreasy@matrixscience.com $ #
13# $Date: 2019-10-15 16:50:41 +0100 $ #
14# $Revision: 35b34891b5eee100f767f95780f54a007d0db4b5 | MSPARSER_REL_3_0_0-2024-09-24-0-g93ebaeb4f4 $ #
15# $NoKeywords:: $ #
16##############################################################################
17*/
18
19#ifndef MS_PROCESSORS_HPP
20#define MS_PROCESSORS_HPP
21
22#include <string>
23#include <vector>
24
25namespace msparser_internal {
26 class ms_processors_impl;
27}
28
29namespace matrix_science {
30
37
49 class MS_MASCOTRESFILE_API ms_processors: public ms_errors
50 {
51 public:
53
61 {
62 HT_NOT_CAPABLE = 0,
63 HT_ENABLED = 1,
64 HT_DISABLED = 2,
65 HT_SUPPORTED_NOT_ENABLED = 3,
66 HT_CANNOT_DETECT = 4
67 };
68
70
79 enum {
80 DEPRECATED_MAX_CORES_PER_LICENSE = 4
81 };
82
84 ms_processors(bool checkLinuxHT, int unused);
85
87 ms_processors(const ms_processors& src);
88
91
93 void copyFrom(const ms_processors* right);
94
95#ifndef SWIG
97 ms_processors& operator=(const ms_processors& right);
98#endif
100 int getNumOnSystem() const;
101
103 int getNumAvailableToProcess() const;
104
106 bool isProcessAffinitySupported() const;
107
109 bool isUseProcessesNotThreads() const;
110
112 UINT64 getWhichAvailableForMascot() const;
113
115 std::vector<int> getWhichAvailableForMascot2() const;
116
118 bool isLogicalCPUAvailableForMascot(const int cpu) const;
119
121 int getNumProcessorGroups() const;
122
124 int getNumPhysicalOnSystem() const;
125
127 HYPERTHREADING getHyperThreadingState() const;
128
130 int getNumLogicalPerPhysical(const int packageID = 0) const;
131
133 int getNumCores(const int packageID = -1) const;
134
136 int getPhysicalFromLogical(const int cpu) const;
137
139 std::string getProcessorName() const;
140
142 std::string getMultithreadedName() const;
143
145 UINT64 getHyperThreadedCPUsMask() const;
146
148 bool isPrimaryLogicalProcessor(const int cpu) const;
149
151 bool isThreadedLogicalProcessor(const int cpu) const;
152
154 int getCoreFromLogical(const int cpu) const;
155
157 int getHT_IDFromLogical(const int cpu) const;
158
160 int getAutoDetectNumThreads(const int numLicensed, const int numCoresPerCpuLicense) const;
161
163 bool setProcessAffinity(const std::vector<unsigned int> & vecCpu) const;
164
166 bool setProcessAffinity(const std::vector<int> & vecCpu) const;
167
169 bool setThreadAffinity(const int logicalCpu) const;
170
171 private:
172 msparser_internal::ms_processors_impl * pImpl_;
173 }; // class ms_processors // end of config_group
175} // namespace matrix_science
176
177#endif // MS_PROCESSORS_HPP
178
179/*------------------------------- End of File -------------------------------*/
180
This class is used as a base class for several Mascot Parser classes.
Definition: ms_errors.hpp:696
This class is designed to retrieve current CPU configuration on the computer and set affinity.
Definition: ms_processors.hpp:50
HYPERTHREADING
Hyper-threading status for the CPUs.
Definition: ms_processors.hpp:61