MuldeR's Utilities for Qt
MUtilities
CPUFeatures.h
Go to the documentation of this file.
1 // MuldeR's Utilities for Qt
3 // Copyright (C) 2004-2016 LoRd_MuldeR <MuldeR2@GMX.de>
4 //
5 // This library is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation; either
8 // version 2.1 of the License, or (at your option) any later version.
9 //
10 // This library is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public
16 // License along with this library; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 //
19 // http://www.gnu.org/licenses/lgpl-2.1.txt
21 
29 #pragma once
30 
31 //MUtils
32 #include <MUtils/Global.h>
33 
34 //Qt
35 #include <QStringList>
36 
37 namespace MUtils
38 {
44  namespace CPUFetaures
45  {
46  // CPU vendor flag
47  static const quint8 VENDOR_INTEL = 0x01U;
48  static const quint8 VENDOR_AMD = 0x02U;
49 
50  // CPU feature flag
51  static const quint32 FLAG_CMOV = 0x001U;
52  static const quint32 FLAG_MMX = 0x002U;
53  static const quint32 FLAG_SSE = 0x004U;
54  static const quint32 FLAG_SSE2 = 0x008U;
55  static const quint32 FLAG_SSE3 = 0x010U;
56  static const quint32 FLAG_SSSE3 = 0x020U;
57  static const quint32 FLAG_SSE4 = 0x030U;
58  static const quint32 FLAG_SSE42 = 0x080U;
59  static const quint32 FLAG_AVX = 0x100U;
60 
64  typedef struct _cpu_info_t
65  {
66  quint32 family;
67  quint32 model;
68  quint32 stepping;
69  quint32 count;
70  quint32 features;
71  bool x64;
72  quint8 vendor;
73  char idstr[13];
74  char brand[48];
75  }
76  cpu_info_t;
77 
85  MUTILS_API cpu_info_t detect(void);
86  }
87 }
quint32 family
CPU family indicator, which specifies the processor "generation" to which the CPU belongs...
Definition: CPUFeatures.h:66
static const quint32 FLAG_SSE4
CPU feature flag.
Definition: CPUFeatures.h:57
This file contains miscellaneous functions that are generally useful for Qt-based applications...
quint32 stepping
CPU stepping indicator, which is used to distinguish "revisions" of a certain processor model...
Definition: CPUFeatures.h:68
static const quint32 FLAG_SSE
CPU feature flag.
Definition: CPUFeatures.h:53
quint32 features
CPU feature flags, indicating suppoprt for extended instruction sets; all flags are OR-combined...
Definition: CPUFeatures.h:70
Struct to hold information about the CPU. See _cpu_info_t for details!
Definition: CPUFeatures.h:64
quint32 count
The number of available (logical) processors.
Definition: CPUFeatures.h:69
static const quint32 FLAG_SSE3
CPU feature flag.
Definition: CPUFeatures.h:55
static const quint32 FLAG_SSSE3
CPU feature flag.
Definition: CPUFeatures.h:56
static const quint8 VENDOR_AMD
CPU vendor flag.
Definition: CPUFeatures.h:48
struct MUtils::CPUFetaures::_cpu_info_t cpu_info_t
Struct to hold information about the CPU. See _cpu_info_t for details!
static const quint32 FLAG_SSE42
CPU feature flag.
Definition: CPUFeatures.h:58
quint8 vendor
CPU vendor flag; might be zero, if vendor is unknown.
Definition: CPUFeatures.h:72
MUTILS_API cpu_info_t detect(void)
Detect processor information.
bool x64
Indicates that the processor and the operating system support 64-Bit (AMD64/EM64T) ...
Definition: CPUFeatures.h:71
char brand[48]
CPU brand string, up to 48 characters (e.g. "Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz") ...
Definition: CPUFeatures.h:74
static const quint8 VENDOR_INTEL
CPU vendor flag.
Definition: CPUFeatures.h:47
static const quint32 FLAG_CMOV
CPU feature flag.
Definition: CPUFeatures.h:51
Global MUtils namespace.
Definition: CPUFeatures.h:37
char idstr[13]
CPU identifier string, exactly 12 characters (e.g. "GenuineIntel" or "AuthenticAMD") ...
Definition: CPUFeatures.h:73
static const quint32 FLAG_SSE2
CPU feature flag.
Definition: CPUFeatures.h:54
static const quint32 FLAG_MMX
CPU feature flag.
Definition: CPUFeatures.h:52
static const quint32 FLAG_AVX
CPU feature flag.
Definition: CPUFeatures.h:59
quint32 model
CPU model indicator, which is used to distinguish processor "variants" within a generation.
Definition: CPUFeatures.h:67