32 #ifndef VSMC_UTILITY_CPUID_HPP
33 #define VSMC_UTILITY_CPUID_HPP
42 #define VSMC_DEFINE_UTILITY_CPUID_FEATURE_INFO(feat, a, c, i, b) \
43 template <> struct CPUIDFeatureInfo<CPUIDFeature##feat> \
45 static std::string str () {return std::string(#feat);} \
46 static VSMC_CONSTEXPR const unsigned eax = a##U; \
47 static VSMC_CONSTEXPR const unsigned ecx = c##U; \
48 static VSMC_CONSTEXPR const unsigned bit = b##U; \
49 static VSMC_CONSTEXPR const std::size_t index = i; \
52 #define VSMC_DEFINE_UTILITY_CPUID_FEATURE_INFO_EXT(feat, a, c, i, b) \
53 template <> struct CPUIDFeatureInfo<CPUIDFeatureExt##feat> \
55 static std::string str () {return std::string(#feat);} \
56 static VSMC_CONSTEXPR const unsigned eax = 0x80000000U + a##U; \
57 static VSMC_CONSTEXPR const unsigned ecx = c##U; \
58 static VSMC_CONSTEXPR const unsigned bit = b##U; \
59 static VSMC_CONSTEXPR const std::size_t index = i; \
67 inline void cpuid (
unsigned eax,
unsigned ecx,
unsigned *reg)
70 __cpuidex(reinterpret_cast<int *>(reg),
71 static_cast<int>(eax), static_cast<int>(ecx));
78 :
"=a" (eax),
"=b" (ebx),
"=c" (ecx),
"=d" (edx)
79 :
"a" (eax),
"c" (ecx)
252 template <CPUIDFeature>
256 static std::string
str ();
433 level_(0), max_proc_sharing_(0), max_proc_physical_(0),
434 line_size_(0), partitions_(0), ways_(0), sets_(0),
435 self_initializing_(false), fully_associative_(false),
436 wbinvd_(false), inclusiveness_(false), complex_indexing_(false)
438 unsigned t = extract_bits<4, 0>(reg.
at<0>());
454 level_ = extract_bits<7, 5>(reg.
at<0>());
455 self_initializing_ = test_bit<8>(reg.
at<0>());
456 fully_associative_ = test_bit<9>(reg.
at<0>());
457 max_proc_sharing_ = extract_bits<25, 14>(reg.
at<0>()) + 1;
458 max_proc_physical_ = extract_bits<31, 26>(reg.
at<0>()) + 1;
460 line_size_ = extract_bits<11, 0>(reg.
at<1>()) + 1;
461 partitions_ = extract_bits<21, 12>(reg.
at<1>()) + 1;
462 ways_ = extract_bits<31, 22>(reg.
at<1>()) + 1;
463 sets_ = extract_bits<31, 0>(reg.
at<2>()) + 1;
464 size_ = line_size_ * partitions_ * ways_ * sets_;
466 wbinvd_ = test_bit<0>(reg.
at<3>());
467 inclusiveness_ = test_bit<1>(reg.
at<3>());
468 complex_indexing_ = test_bit<2>(reg.
at<3>());
475 unsigned level ()
const {
return level_;}
492 unsigned ways ()
const {
return ways_;}
495 unsigned sets ()
const {
return sets_;}
498 unsigned size ()
const {
return size_;}
520 unsigned max_proc_sharing_;
521 unsigned max_proc_physical_;
523 unsigned partitions_;
527 bool self_initializing_;
528 bool fully_associative_;
531 bool complex_indexing_;
535 template <
typename CharT,
typename Traits>
536 static std::basic_ostream<CharT, Traits> &
info (
537 std::basic_ostream<CharT, Traits> &os)
543 os <<
"Vendor ID " << vendor() <<
'\n';
544 if (max_eax_ext() >= ext0_ + 4U)
545 os <<
"Processor brand " << brand() <<
'\n';
546 if (max_eax() >= 0x16) {
547 os <<
"Base frequency (MHz) " << base_freq() <<
'\n';
548 os <<
"Maximum frequency (MHz) " << max_freq() <<
'\n';
549 os <<
"Bus frequency (MHz) " << bus_freq() <<
'\n';
551 if (max_eax() >= 0x04) {
553 os <<
"Deterministic cache parameters\n";
570 template <
unsigned EAX,
unsigned ECX>
573 static reg_type reg(info_dispatch<EAX, ECX>(
575 EAX == 0x00 || EAX == ext0_>(),
583 {
return info<0x00, 0x00>().at<0>();}
587 {
return info<ext0_, 0x00>().at<0>();}
592 reg_type reg(info<0x00, 0x00>());
593 const unsigned *uptr = reg.
data();
594 char str[
sizeof(unsigned) * 3 + 1] = {
'\0'};
595 std::memcpy(str +
sizeof(
unsigned) * 0, uptr + 1,
sizeof(
unsigned));
596 std::memcpy(str +
sizeof(
unsigned) * 1, uptr + 3,
sizeof(
unsigned));
597 std::memcpy(str +
sizeof(
unsigned) * 2, uptr + 2,
sizeof(
unsigned));
599 return std::string(str);
606 reg_type reg2(info<ext0_ + 2U, 0>());
607 reg_type reg3(info<ext0_ + 3U, 0>());
608 reg_type reg4(info<ext0_ + 4U, 0>());
609 const std::size_t reg_size =
sizeof(unsigned) * 4;
610 char str[reg_size * 3] = {
'\0'};
615 return std::string(str);
625 if (extract_bits<4, 0>(reg.
at<0>()) == 0)
647 {
return test_bit<1>(info<0x06, 0x00>().at<0>());}
651 {
return extract_bits<15, 0>(info<0x16, 0x00>().at<0>());}
655 {
return extract_bits<15, 0>(info<0x16, 0x00>().at<1>());}
659 {
return extract_bits<15, 0>(info<0x16, 0x00>().at<2>());}
662 template <CPUIDFeature Feat>
665 return test_bit<CPUIDFeatureInfo<Feat>::bit>(info<
674 template <
unsigned,
unsigned>
678 cpuid(0x00, 0x00, reg.data());
683 template <
unsigned,
unsigned>
687 cpuid(ext0_, 0x00, reg.data());
692 template <
unsigned EAX,
unsigned ECX,
bool Basic>
694 cxx11::integral_constant<bool, Basic>)
697 cxx11::integral_constant<bool, Basic>()));
699 if (EAX > reg.at<0>())
702 cpuid(EAX, ECX, reg.data());
707 template <
unsigned Hi,
unsigned Lo>
708 static unsigned extract_bits (
unsigned val)
709 {
return (val << (31U - Hi)) >> (31U - Hi + Lo);}
711 template <
unsigned Bit>
712 static bool test_bit (
unsigned val)
713 {
return (val & (1U << Bit)) != 0;}
715 template <
typename CharT,
typename Traits>
716 static void print_equal (std::basic_ostream<CharT, Traits> &os)
717 {os << std::string(90,
'=') <<
'\n';}
719 template <
typename CharT,
typename Traits>
720 static void print_dash (std::basic_ostream<CharT, Traits> &os)
721 {os << std::string(90,
'-') <<
'\n';}
723 template <
typename CharT,
typename Traits>
724 static void print_cache (std::basic_ostream<CharT, Traits> &os)
726 std::vector<cache_param_type> caches;
727 unsigned max_ecx = cache_param_num();
728 for (
unsigned ecx = 0x00; ecx != max_ecx; ++ecx)
729 caches.push_back(cache_param(ecx));
731 const std::size_t fix = 12;
732 std::stringstream ss;
734 os <<
"Cache level ";
735 for (std::size_t i = 0; i != caches.size(); ++i)
736 os << std::setw(fix) << caches[i].level();
740 for (std::size_t i = 0; i != caches.size(); ++i) {
741 switch (caches[i].
type()) {
745 os << std::setw(fix) <<
"Data";
748 os << std::setw(fix) <<
"Instruction";
751 os << std::setw(fix) <<
"Unified";
757 os <<
"Cache size (byte) ";
758 for (std::size_t i = 0; i != caches.size(); ++i) {
759 unsigned b = caches[i].size();
760 ss.str(std::string());
763 }
else if ((b /= 1024) < 1024) {
765 }
else if ((b /= 1024) < 1024) {
768 ss << b / 1024 <<
"G";
770 os << std::setw(fix) << ss.str();
774 os <<
"Maximum Proc sharing ";
775 for (std::size_t i = 0; i != caches.size(); ++i)
776 os << std::setw(fix) << caches[i].max_proc_sharing();
779 os <<
"Maximum Proc physical ";
780 for (std::size_t i = 0; i != caches.size(); ++i)
781 os << std::setw(fix) << caches[i].max_proc_physical();
784 os <<
"Coherency line size (byte) ";
785 for (std::size_t i = 0; i != caches.size(); ++i)
786 os << std::setw(fix) << caches[i].line_size();
789 os <<
"Physical line partitions ";
790 for (std::size_t i = 0; i != caches.size(); ++i)
791 os << std::setw(fix) << caches[i].partitions();
794 os <<
"Ways of associative ";
795 for (std::size_t i = 0; i != caches.size(); ++i)
796 os << std::setw(fix) << caches[i].ways();
799 os <<
"Number of sets ";
800 for (std::size_t i = 0; i != caches.size(); ++i)
801 os << std::setw(fix) << caches[i].sets();
804 os <<
"Self initializing ";
805 for (std::size_t i = 0; i != caches.size(); ++i) {
807 << (caches[i].self_initializing() ?
"Yes" :
"No");
811 os <<
"Fully associative ";
812 for (std::size_t i = 0; i != caches.size(); ++i) {
814 << (caches[i].fully_associative() ?
"Yes" :
"No");
818 os <<
"Write-back invalidate ";
819 for (std::size_t i = 0; i != caches.size(); ++i) {
821 << (caches[i].wbinvd() ?
"Yes" :
"No");
825 os <<
"Cache inclusiveness ";
826 for (std::size_t i = 0; i != caches.size(); ++i) {
828 << (caches[i].inclusiveness() ?
"Yes" :
"No");
832 os <<
"Complex cache indexing ";
833 for (std::size_t i = 0; i != caches.size(); ++i) {
835 << (caches[i].complex_indexing() ?
"Yes" :
"No");
840 template <
typename CharT,
typename Traits>
841 static void print_feature (std::basic_ostream<CharT, Traits> &os)
843 if (max_eax() >= 0x01) {
844 std::vector<std::string> feats;
846 if (feats.size() != 0) {
847 os <<
"Processor info and features\n";
849 print_feature(os, feats);
852 if (max_eax() >= 0x07) {
853 std::vector<std::string> feats;
855 if (feats.size() != 0) {
857 os <<
"Extended features\n";
859 print_feature(os, feats);
862 if (max_eax_ext() >= ext0_ + 1U) {
863 std::vector<std::string> feats;
864 feature_str_ext1(feats);
865 if (feats.size() != 0) {
867 os <<
"Extended processor info and features\n";
869 print_feature(os, feats);
874 template <
typename CharT,
typename Traits>
875 static void print_feature (std::basic_ostream<CharT, Traits> &os,
876 std::vector<std::string> &feats)
878 std::sort(feats.begin(), feats.end());
879 for (std::size_t i = 0; i != feats.size(); ++i) {
880 print_feat(os, feats[i], 15);
881 if (i % 6 == 5 || i == feats.size() - 1)
886 template <
typename CharT,
typename Traits>
887 static void print_feat (std::basic_ostream<CharT, Traits> &os,
888 std::string &str, std::size_t fix)
891 if (str.size() < fix)
892 os << std::string(fix - str.size(),
' ');
895 static void feature_str1 (std::vector<std::string> &feats)
897 feature_str<CPUIDFeatureSSE3> (feats);
898 feature_str<CPUIDFeaturePCLMULQDQ> (feats);
899 feature_str<CPUIDFeatureDTES64> (feats);
900 feature_str<CPUIDFeatureMONITOR> (feats);
901 feature_str<CPUIDFeatureDS_CPL> (feats);
902 feature_str<CPUIDFeatureVMX> (feats);
903 feature_str<CPUIDFeatureSMX> (feats);
904 feature_str<CPUIDFeatureEST> (feats);
905 feature_str<CPUIDFeatureTM2> (feats);
906 feature_str<CPUIDFeatureSSSE3> (feats);
907 feature_str<CPUIDFeatureCNXT_ID> (feats);
908 feature_str<CPUIDFeatureFMA> (feats);
909 feature_str<CPUIDFeatureCX16> (feats);
910 feature_str<CPUIDFeatureXTPR> (feats);
911 feature_str<CPUIDFeaturePDCM> (feats);
912 feature_str<CPUIDFeaturePCID> (feats);
913 feature_str<CPUIDFeatureDCA> (feats);
914 feature_str<CPUIDFeatureSSE4_1> (feats);
915 feature_str<CPUIDFeatureSSE4_2> (feats);
916 feature_str<CPUIDFeatureX2APIC> (feats);
917 feature_str<CPUIDFeatureMOVBE> (feats);
918 feature_str<CPUIDFeaturePOPCNT> (feats);
919 feature_str<CPUIDFeatureTSC_DEADLINE>(feats);
920 feature_str<CPUIDFeatureAES> (feats);
921 feature_str<CPUIDFeatureXSAVE> (feats);
922 feature_str<CPUIDFeatureOSXSAVE> (feats);
923 feature_str<CPUIDFeatureAVX> (feats);
924 feature_str<CPUIDFeatureF16C> (feats);
925 feature_str<CPUIDFeatureRDRAND> (feats);
926 feature_str<CPUIDFeatureHYPERVISOR> (feats);
928 feature_str<CPUIDFeatureFPU> (feats);
929 feature_str<CPUIDFeatureVME> (feats);
930 feature_str<CPUIDFeatureDE> (feats);
931 feature_str<CPUIDFeaturePSE> (feats);
932 feature_str<CPUIDFeatureTSC> (feats);
933 feature_str<CPUIDFeatureMSR> (feats);
934 feature_str<CPUIDFeaturePAE> (feats);
935 feature_str<CPUIDFeatureMCE> (feats);
936 feature_str<CPUIDFeatureCX8> (feats);
937 feature_str<CPUIDFeatureAPIC> (feats);
938 feature_str<CPUIDFeatureSEP> (feats);
939 feature_str<CPUIDFeatureMTRR> (feats);
940 feature_str<CPUIDFeaturePGE> (feats);
941 feature_str<CPUIDFeatureMCA> (feats);
942 feature_str<CPUIDFeatureCMOV> (feats);
943 feature_str<CPUIDFeaturePAT> (feats);
944 feature_str<CPUIDFeaturePSE_36> (feats);
945 feature_str<CPUIDFeaturePSN> (feats);
946 feature_str<CPUIDFeatureCLFSH> (feats);
947 feature_str<CPUIDFeatureDS> (feats);
948 feature_str<CPUIDFeatureACPI> (feats);
949 feature_str<CPUIDFeatureMMX> (feats);
950 feature_str<CPUIDFeatureFXSR> (feats);
951 feature_str<CPUIDFeatureSSE> (feats);
952 feature_str<CPUIDFeatureSSE2> (feats);
953 feature_str<CPUIDFeatureSS> (feats);
954 feature_str<CPUIDFeatureHTT> (feats);
955 feature_str<CPUIDFeatureTM> (feats);
956 feature_str<CPUIDFeatureIA64> (feats);
957 feature_str<CPUIDFeaturePBE> (feats);
960 static void feature_str7 (std::vector<std::string> &feats)
962 feature_str<CPUIDFeatureFSGSBASE> (feats);
963 feature_str<CPUIDFeatureBMI1> (feats);
964 feature_str<CPUIDFeatureHLE> (feats);
965 feature_str<CPUIDFeatureAVX2> (feats);
966 feature_str<CPUIDFeatureSMEP> (feats);
967 feature_str<CPUIDFeatureBMI2> (feats);
968 feature_str<CPUIDFeatureERMS> (feats);
969 feature_str<CPUIDFeatureINVPCID> (feats);
970 feature_str<CPUIDFeatureRTM> (feats);
971 feature_str<CPUIDFeatureMPX> (feats);
972 feature_str<CPUIDFeatureAVX512F> (feats);
973 feature_str<CPUIDFeatureAVX512DQ> (feats);
974 feature_str<CPUIDFeatureRDSEED> (feats);
975 feature_str<CPUIDFeatureADX> (feats);
976 feature_str<CPUIDFeatureSMAP> (feats);
977 feature_str<CPUIDFeatureAVX512IFMA52>(feats);
978 feature_str<CPUIDFeatureCLFLUSHOPT> (feats);
979 feature_str<CPUIDFeatureINTEL_TRACE> (feats);
980 feature_str<CPUIDFeatureAVX512PF> (feats);
981 feature_str<CPUIDFeatureAVX512ER> (feats);
982 feature_str<CPUIDFeatureAVX512CD> (feats);
983 feature_str<CPUIDFeatureSHA> (feats);
984 feature_str<CPUIDFeatureAVX512BW> (feats);
985 feature_str<CPUIDFeatureAVX512VL> (feats);
987 feature_str<CPUIDFeaturePREFETCHWT1> (feats);
988 feature_str<CPUIDFeatureAVX512VBMI> (feats);
991 static void feature_str_ext1 (std::vector<std::string> &feats)
993 feature_str<CPUIDFeatureExtLAHF_LM> (feats);
994 feature_str<CPUIDFeatureExtCMP_LEGACY> (feats);
995 feature_str<CPUIDFeatureExtSVM> (feats);
996 feature_str<CPUIDFeatureExtEXTAPIC> (feats);
997 feature_str<CPUIDFeatureExtCR8_LEGACY> (feats);
998 feature_str<CPUIDFeatureExtABM> (feats);
999 feature_str<CPUIDFeatureExtSSE4A> (feats);
1000 feature_str<CPUIDFeatureExtMISALIGNSSE> (feats);
1001 feature_str<CPUIDFeatureExt3DNOWPREFETCH>(feats);
1002 feature_str<CPUIDFeatureExtOSVW> (feats);
1003 feature_str<CPUIDFeatureExtIBS> (feats);
1004 feature_str<CPUIDFeatureExtXOP> (feats);
1005 feature_str<CPUIDFeatureExtSKINIT> (feats);
1006 feature_str<CPUIDFeatureExtWDT> (feats);
1007 feature_str<CPUIDFeatureExtLWP> (feats);
1008 feature_str<CPUIDFeatureExtFMA4> (feats);
1009 feature_str<CPUIDFeatureExtTCE> (feats);
1010 feature_str<CPUIDFeatureExtNODEID_MSR> (feats);
1011 feature_str<CPUIDFeatureExtTBM> (feats);
1012 feature_str<CPUIDFeatureExtTOPOEXT> (feats);
1013 feature_str<CPUIDFeatureExtPERFCTR_CORE> (feats);
1014 feature_str<CPUIDFeatureExtPERFCTR_NB> (feats);
1015 feature_str<CPUIDFeatureExtDBX> (feats);
1016 feature_str<CPUIDFeatureExtPERFTSC> (feats);
1017 feature_str<CPUIDFeatureExtPCX_L2I> (feats);
1019 feature_str<CPUIDFeatureExtFPU> (feats);
1020 feature_str<CPUIDFeatureExtVME> (feats);
1021 feature_str<CPUIDFeatureExtDE> (feats);
1022 feature_str<CPUIDFeatureExtPSE> (feats);
1023 feature_str<CPUIDFeatureExtTSC> (feats);
1024 feature_str<CPUIDFeatureExtMSR> (feats);
1025 feature_str<CPUIDFeatureExtPAE> (feats);
1026 feature_str<CPUIDFeatureExtMCE> (feats);
1027 feature_str<CPUIDFeatureExtCX8> (feats);
1028 feature_str<CPUIDFeatureExtAPIC> (feats);
1029 feature_str<CPUIDFeatureExtSYSCALL> (feats);
1030 feature_str<CPUIDFeatureExtMTRR> (feats);
1031 feature_str<CPUIDFeatureExtPGE> (feats);
1032 feature_str<CPUIDFeatureExtMCA> (feats);
1033 feature_str<CPUIDFeatureExtCMOV> (feats);
1034 feature_str<CPUIDFeatureExtPAT> (feats);
1035 feature_str<CPUIDFeatureExtPSE36> (feats);
1036 feature_str<CPUIDFeatureExtMP> (feats);
1037 feature_str<CPUIDFeatureExtNX> (feats);
1038 feature_str<CPUIDFeatureExtMMX> (feats);
1039 feature_str<CPUIDFeatureExtMMXEXT> (feats);
1040 feature_str<CPUIDFeatureExtFXSR> (feats);
1041 feature_str<CPUIDFeatureExtFXSR_OPT> (feats);
1042 feature_str<CPUIDFeatureExtGBPAGES> (feats);
1043 feature_str<CPUIDFeatureExtRDTSCP> (feats);
1044 feature_str<CPUIDFeatureExtLM> (feats);
1045 feature_str<CPUIDFeatureExt3DNOWEXT> (feats);
1046 feature_str<CPUIDFeatureExt3DNOW> (feats);
1049 template <CPUIDFeature Feat>
1050 static void feature_str (std::vector<std::string> &feats)
1052 if (has_feature<Feat>())
1053 feats.push_back(CPUIDFeatureInfo<Feat>::str());
1059 template <
typename CharT,
typename Traits>
1061 std::basic_ostream<CharT, Traits> &os,
const CPUID &)
1066 #endif // VSMC_UTILITY_CPUID_HPP
EAX = 0x07, ECX = 0x00; EBX[29].
EAX = 0x01, ECX = 0x00; ECX[10].
EAX = 0x07, ECX = 0x00; ECX[01].
EAX = 0x01, ECX = 0x00; EDX[26].
EAX = 0x80000001, ECX = 0x00; ECX[23].
#define VSMC_DEFINE_UTILITY_CPUID_FEATURE_INFO(feat, a, c, i, b)
EAX = 0x07, ECX = 0x00; EBX[04].
EAX = 0x01, ECX = 0x00; ECX[09].
EAX = 0x01, ECX = 0x00; ECX[00].
EAX = 0x07, ECX = 0x00; EBX[05].
EAX = 0x01, ECX = 0x00; ECX[19].
EAX = 0x80000001, ECX = 0x00; EDX[07].
static const reg_type & info()
Get the CPUID information stored in EAX, EBX, ECX and EDX, given input EAX and ECX values...
static constexpr const unsigned eax
The value of the calling parameter EAX.
#define VSMC_DEFINE_UTILITY_CPUID_FEATURE_INFO_EXT(feat, a, c, i, b)
static std::string vendor()
Vendor ID (EAX = 0x00; EBX, EDX, ECX)
EAX = 0x80000001, ECX = 0x00; EDX[06].
EAX = 0x80000001, ECX = 0x00; EDX[00].
EAX = 0x01, ECX = 0x00; ECX[08].
EAX = 0x80000001, ECX = 0x00; ECX[04].
EAX = 0x80000001, ECX = 0x00; ECX[19].
EAX = 0x80000001, ECX = 0x00; ECX[16].
EAX = 0x07, ECX = 0x00; EBX[19].
EAX = 0x80000001, ECX = 0x00; EDX[27].
EAX = 0x80000001, ECX = 0x00; ECX[17].
EAX = 0x80000001, ECX = 0x00; EDX[31].
EAX = 0x80000001, ECX = 0x00; ECX[26].
static constexpr const unsigned index
The index of in CPUID::reg_type of the output register.
#define VSMC_CONSTEXPR
constexpr
EAX = 0x01, ECX = 0x00; EDX[04].
bool inclusiveness() const
Cache inclusiveness.
EAX = 0x80000001, ECX = 0x00; EDX[29].
EAX = 0x80000001, ECX = 0x00; EDX[14].
EAX = 0x80000001, ECX = 0x00; ECX[13].
EAX = 0x01, ECX = 0x00; EDX[31].
EAX = 0x01, ECX = 0x00; EDX[17].
EAX = 0x80000001, ECX = 0x00; ECX[28].
EAX = 0x01, ECX = 0x00; EDX[02].
EAX = 0x01, ECX = 0x00; ECX[21].
unsigned line_size() const
Coherency line size in byte.
EAX = 0x80000001, ECX = 0x00; EDX[24].
EAX = 0x07, ECX = 0x00; EBX[11].
CPUIDCacheType type() const
The type of this cache.
EAX = 0x07, ECX = 0x00; EBX[08].
EAX = 0x01, ECX = 0x00; EDX[27].
static cache_param_type cache_param(unsigned cache_index)
Get the cache parameters (EAX = 0x04; EAX, EBX, ECX, EDX)
unsigned max_proc_sharing() const
Maximum number of addressable logical processors sharing this cache.
EAX = 0x01, ECX = 0x00; ECX[15].
EAX = 0x07, ECX = 0x00; EBX[03].
EAX = 0x07, ECX = 0x00; EBX[18].
EAX = 0x80000001, ECX = 0x00; EDX[04].
EAX = 0x80000001, ECX = 0x00; EDX[13].
EAX = 0x80000001, ECX = 0x00; ECX[08].
EAX = 0x01, ECX = 0x00; EDX[22].
EAX = 0x80000001, ECX = 0x00; EDX[09].
EAX = 0x07, ECX = 0x00; EBX[17].
EAX = 0x01, ECX = 0x00; EDX[00].
EAX = 0x80000001, ECX = 0x00; EDX[25].
EAX = 0x80000001, ECX = 0x00; EDX[12].
EAX = 0x80000001, ECX = 0x00; ECX[10].
EAX = 0x80000001, ECX = 0x00; ECX[07].
EAX = 0x01, ECX = 0x00; EDX[15].
EAX = 0x01, ECX = 0x00; EDX[18].
EAX = 0x80000001, ECX = 0x00; ECX[05].
EAX = 0x01, ECX = 0x00; EDX[30].
EAX = 0x01, ECX = 0x00; EDX[01].
EAX = 0x07, ECX = 0x00; EBX[27].
EAX = 0x07, ECX = 0x00; EBX[00].
EAX = 0x01, ECX = 0x00; ECX[12].
unsigned max_proc_physical() const
Maximum number of addressable processor cores in the physical package.
EAX = 0x01, ECX = 0x00; ECX[17].
EAX = 0x01, ECX = 0x00; EDX[06].
integral_constant< bool, false > false_type
static constexpr const unsigned bit
The bit number of the feature in the register.
EAX = 0x07, ECX = 0x00; EBX[10].
EAX = 0x07, ECX = 0x00; EBX[07].
EAX = 0x80000001, ECX = 0x00; EDX[03].
EAX = 0x01, ECX = 0x00; ECX[26].
EAX = 0x80000001, ECX = 0x00; EDX[02].
EAX = 0x80000001, ECX = 0x00; EDX[01].
unsigned level() const
The level of this cache.
EAX = 0x01, ECX = 0x00; ECX[06].
EAX = 0x01, ECX = 0x00; ECX[02].
EAX = 0x01, ECX = 0x00; EDX[29].
static constexpr const unsigned ecx
The value of the calling parameter ECX.
EAX = 0x80000001, ECX = 0x00; ECX[01].
EAX = 0x07, ECX = 0x00; EBX[31].
EAX = 0x80000001, ECX = 0x00; EDX[16].
EAX = 0x01, ECX = 0x00; EDX[03].
EAX = 0x80000001, ECX = 0x00; ECX[21].
EAX = 0x01, ECX = 0x00; EDX[08].
EAX = 0x01, ECX = 0x00; EDX[25].
EAX = 0x01, ECX = 0x00; ECX[18].
EAX = 0x07, ECX = 0x00; EBX[23].
EAX = 0x80000001, ECX = 0x00; ECX[09].
EAX = 0x80000001, ECX = 0x00; ECX[03].
static unsigned max_eax_ext()
Maximum extended calling parameter EAX (EAX = 0x80000000; EAX)
static unsigned base_freq()
Base frequency in MHz (EAX = 0x16; EAX[15:0])
EAX = 0x80000001, ECX = 0x00; ECX[24].
EAX = 0x80000001, ECX = 0x00; ECX[15].
std::basic_ostream< CharT, Traits > & operator<<(std::basic_ostream< CharT, Traits > &os, const Sampler< T > &sampler)
EAX = 0x01, ECX = 0x00; EDX[05].
static bool intel_turbo_boost()
Intel Turbo Boost (EAX = 0x06; EAX[1])
EAX = 0x07, ECX = 0x00; EBX[25].
EAX = 0x07, ECX = 0x00; EBX[21].
EAX = 0x80000001, ECX = 0x00; EDX[08].
EAX = 0x01, ECX = 0x00; ECX[05].
EAX = 0x01, ECX = 0x00; EDX[24].
EAX = 0x80000001, ECX = 0x00; EDX[19].
static bool has_feature()
CPU feature.
unsigned size() const
Cache size in byte.
EAX = 0x80000001, ECX = 0x00; ECX[00].
static std::string str()
A short string representing the feature.
EAX = 0x01, ECX = 0x00; ECX[20].
static unsigned max_eax()
Maximum calling parameter EAX (EAX = 0x00; EAX)
bool wbinvd() const
Write-back invalidate/invalidate behavior on lower level caches.
EAX = 0x01, ECX = 0x00; ECX[25].
EAX = 0x01, ECX = 0x00; ECX[14].
EAX = 0x01, ECX = 0x00; ECX[24].
EAX = 0x01, ECX = 0x00; EDX[28].
EAX = 0x01, ECX = 0x00; ECX[31].
EAX = 0x01, ECX = 0x00; ECX[30].
EAX = 0x01, ECX = 0x00; ECX[29].
unsigned partitions() const
Physical line partitions.
integral_constant< bool, true > true_type
EAX = 0x01, ECX = 0x00; ECX[01].
bool complex_indexing() const
Complex cache indexing.
EAX = 0x80000001, ECX = 0x00; EDX[05].
CPUIDFeature
CPU features.
EAX = 0x07, ECX = 0x00; EBX[28].
EAX = 0x01, ECX = 0x00; ECX[23].
EAX = 0x80000001, ECX = 0x00; EDX[15].
void * memcpy(void *dst, const void *src, std::size_t n)
SIMD optimized memcpy with non-temporal store for large buffers.
bool self_initializing() const
Self initializing cache (does not need SW initialization)
EAX = 0x01, ECX = 0x00; ECX[04].
EAX = 0x80000001, ECX = 0x00; ECX[11].
EAX = 0x80000001, ECX = 0x00; EDX[17].
EAX = 0x80000001, ECX = 0x00; ECX[06].
Array< unsigned, 4 > reg_type
The array type that holds EAX, EBX, ECX, and EDX, in that order.
EAX = 0x01, ECX = 0x00; EDX[21].
EAX = 0x01, ECX = 0x00; EDX[23].
EAX = 0x80000001, ECX = 0x00; ECX[02].
Structure of deterministic cache parameter.
static unsigned cache_param_num()
Get the number of caches.
EAX = 0x07, ECX = 0x00; EBX[09].
bool fully_associative() const
Fully associative cache.
EAX = 0x80000001, ECX = 0x00; ECX[27].
EAX = 0x80000001, ECX = 0x00; EDX[23].
EAX = 0x80000001, ECX = 0x00; EDX[22].
EAX = 0x01, ECX = 0x00; ECX[22].
CPUIDCacheType
Type of CPU caches.
EAX = 0x01, ECX = 0x00; EDX[11].
cache_param_type(const reg_type ®)
EAX = 0x80000001, ECX = 0x00; EDX[20].
EAX = 0x80000001, ECX = 0x00; EDX[30].
unsigned sets() const
Number of sets.
void cpuid(unsigned eax, unsigned ecx, unsigned *reg)
Get the CPUID information stored in EAX, EBX, ECX and EDX, given input EAX and ECX values...
EAX = 0x01, ECX = 0x00; ECX[13].
reference at(size_type pos)
EAX = 0x01, ECX = 0x00; EDX[12].
EAX = 0x01, ECX = 0x00; EDX[13].
unsigned ways() const
Ways of associative.
EAX = 0x80000001, ECX = 0x00; EDX[11].
EAX = 0x01, ECX = 0x00; EDX[07].
EAX = 0x07, ECX = 0x00; EBX[20].
EAX = 0x01, ECX = 0x00; EDX[09].
EAX = 0x07, ECX = 0x00; EBX[14].
static unsigned max_freq()
Maximum frequency in MHz (EAX = 0x16; EBX[15:0])
EAX = 0x07, ECX = 0x00; ECX[00].
EAX = 0x01, ECX = 0x00; ECX[07].
static unsigned bus_freq()
Bus (reference) frequency in MHz (EAX = 0x16; ECX[15:0])
EAX = 0x01, ECX = 0x00; EDX[16].
EAX = 0x01, ECX = 0x00; EDX[19].
EAX = 0x01, ECX = 0x00; ECX[28].
EAX = 0x80000001, ECX = 0x00; EDX[26].
EAX = 0x07, ECX = 0x00; EBX[26].
EAX = 0x07, ECX = 0x00; EBX[30].
static std::string brand()
Processor brand string (EAX = 0x80000002,0x80000003,0x80000004; EAX, EBX, ECX, EDX) ...
EAX = 0x07, ECX = 0x00; EBX[16].
EAX = 0x01, ECX = 0x00; ECX[03].
EAX = 0x01, ECX = 0x00; ECX[27].
EAX = 0x80000001, ECX = 0x00; ECX[12].
EAX = 0x01, ECX = 0x00; EDX[14].
static std::basic_ostream< CharT, Traits > & info(std::basic_ostream< CharT, Traits > &os)
Get CPU feature using CPUID.
EAX = 0x80000001, ECX = 0x00; ECX[22].