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-2018 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 }
MUtils::CPUFetaures::_cpu_info_t::family
quint32 family
CPU family indicator, which specifies the processor "generation" to which the CPU belongs...
Definition: CPUFeatures.h:69
Global.h
This file contains miscellaneous functions that are generally useful for Qt-based applications...
MUtils::CPUFetaures::_cpu_info_t::stepping
quint32 stepping
CPU stepping indicator, which is used to distinguish "revisions" of a certain processor model...
Definition: CPUFeatures.h:71
MUtils::CPUFetaures::FLAG_SSE
static const quint32 FLAG_SSE
CPU feature flag.
Definition: CPUFeatures.h:53
MUtils::CPUFetaures::_cpu_info_t::features
quint32 features
CPU feature flags, indicating suppoprt for extended instruction sets; all flags are OR-combined...
Definition: CPUFeatures.h:73
MUtils::CPUFetaures::FLAG_AVX2
static const quint32 FLAG_AVX2
CPU feature flag.
Definition: CPUFeatures.h:60
MUtils::CPUFetaures::_cpu_info_t
Struct to hold information about the CPU. See _cpu_info_t for details!
Definition: CPUFeatures.h:67
MUtils::CPUFetaures::_cpu_info_t::count
quint32 count
The number of available (logical) processors.
Definition: CPUFeatures.h:72
MUtils::CPUFetaures::FLAG_SSE3
static const quint32 FLAG_SSE3
CPU feature flag.
Definition: CPUFeatures.h:55
MUtils::CPUFetaures::FLAG_SSSE3
static const quint32 FLAG_SSSE3
CPU feature flag.
Definition: CPUFeatures.h:56
MUtils::CPUFetaures::VENDOR_AMD
static const quint8 VENDOR_AMD
CPU vendor flag.
Definition: CPUFeatures.h:48
MUtils::CPUFetaures::cpu_info_t
struct MUtils::CPUFetaures::_cpu_info_t cpu_info_t
Struct to hold information about the CPU. See _cpu_info_t for details!
MUtils::CPUFetaures::FLAG_SSE42
static const quint32 FLAG_SSE42
CPU feature flag.
Definition: CPUFeatures.h:58
MUtils::CPUFetaures::_cpu_info_t::vendor
quint8 vendor
CPU vendor flag; might be zero, if vendor is unknown.
Definition: CPUFeatures.h:75
MUtils::CPUFetaures::FLAG_SSE41
static const quint32 FLAG_SSE41
CPU feature flag.
Definition: CPUFeatures.h:57
MUtils::CPUFetaures::FLAG_LZCNT
static const quint32 FLAG_LZCNT
CPU feature flag.
Definition: CPUFeatures.h:62
MUtils::CPUFetaures::detect
MUTILS_API cpu_info_t detect(void)
Detect processor information.
MUtils::CPUFetaures::FLAG_FMA3
static const quint32 FLAG_FMA3
CPU feature flag.
Definition: CPUFeatures.h:61
MUtils::CPUFetaures::_cpu_info_t::x64
bool x64
Indicates that the processor and the operating system support 64-Bit (AMD64/EM64T) ...
Definition: CPUFeatures.h:74
MUtils::CPUFetaures::_cpu_info_t::brand
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
MUtils::CPUFetaures::VENDOR_INTEL
static const quint8 VENDOR_INTEL
CPU vendor flag.
Definition: CPUFeatures.h:47
MUtils::CPUFetaures::FLAG_CMOV
static const quint32 FLAG_CMOV
CPU feature flag.
Definition: CPUFeatures.h:51
MUtils
Global MUtils namespace.
Definition: CPUFeatures.h:37
MUtils::CPUFetaures::_cpu_info_t::idstr
char idstr[13]
CPU identifier string, exactly 12 characters (e.g. "GenuineIntel" or "AuthenticAMD") ...
Definition: CPUFeatures.h:76
MUtils::CPUFetaures::FLAG_SSE2
static const quint32 FLAG_SSE2
CPU feature flag.
Definition: CPUFeatures.h:54
MUtils::CPUFetaures::FLAG_MMX
static const quint32 FLAG_MMX
CPU feature flag.
Definition: CPUFeatures.h:52
MUtils::CPUFetaures::FLAG_AVX
static const quint32 FLAG_AVX
CPU feature flag.
Definition: CPUFeatures.h:59
MUtils::CPUFetaures::_cpu_info_t::model
quint32 model
CPU model indicator, which is used to distinguish processor "variants" within a generation.
Definition: CPUFeatures.h:70