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_SSE41 = 0x040U;
58  static const quint32 FLAG_SSE42 = 0x080U;
59  static const quint32 FLAG_AVX = 0x100U;
60  static const quint32 FLAG_AVX2 = 0x200U;
61  static const quint32 FLAG_FMA3 = 0x400U;
62  static const quint32 FLAG_LZCNT = 0x800U;
63 
67  typedef struct _cpu_info_t
68  {
69  quint32 family;
70  quint32 model;
71  quint32 stepping;
72  quint32 count;
73  quint32 features;
74  bool x64;
75  quint8 vendor;
76  char idstr[13];
77  char brand[48];
78  }
79  cpu_info_t;
80 
88  MUTILS_API cpu_info_t detect(void);
89  }
90 }
quint32 family
CPU family indicator, which specifies the processor "generation" to which the CPU belongs...
Definition: CPUFeatures.h:69
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:71
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:73
static const quint32 FLAG_AVX2
CPU feature flag.
Definition: CPUFeatures.h:60
Struct to hold information about the CPU. See _cpu_info_t for details!
Definition: CPUFeatures.h:67
quint32 count
The number of available (logical) processors.
Definition: CPUFeatures.h:72
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:75
static const quint32 FLAG_SSE41
CPU feature flag.
Definition: CPUFeatures.h:57
static const quint32 FLAG_LZCNT
CPU feature flag.
Definition: CPUFeatures.h:62
MUTILS_API cpu_info_t detect(void)
Detect processor information.
static const quint32 FLAG_FMA3
CPU feature flag.
Definition: CPUFeatures.h:61
bool x64
Indicates that the processor and the operating system support 64-Bit (AMD64/EM64T) ...
Definition: CPUFeatures.h:74
char brand[48]
CPU brand string, up to 48 characters (e.g. "Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz") ...
Definition: CPUFeatures.h:77
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:76
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:70