aboutsummaryrefslogtreecommitdiffstats
path: root/doc/examples/cpuid.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2013-12-31 14:59:48 +0000
committerlloyd <[email protected]>2013-12-31 14:59:48 +0000
commit98991e5c9326a480b890ef7ce112ebfb1216f1ae (patch)
tree829715d1432a39824368617048e8ee63f63f34d0 /doc/examples/cpuid.cpp
parentabefc88850c37fe97b4a8588aa13fcdefd9f7b5e (diff)
Add CPUID::print
Diffstat (limited to 'doc/examples/cpuid.cpp')
-rw-r--r--doc/examples/cpuid.cpp34
1 files changed, 1 insertions, 33 deletions
diff --git a/doc/examples/cpuid.cpp b/doc/examples/cpuid.cpp
index c231397e4..0a94d8717 100644
--- a/doc/examples/cpuid.cpp
+++ b/doc/examples/cpuid.cpp
@@ -10,41 +10,9 @@
using namespace Botan;
-namespace {
-
-void print_if_feature(const std::string& feature_name, bool exists)
- {
- std::cout << (exists ? '+' : '-') << " " << feature_name << "\n";
- }
-
-void print_header(const std::string& descr)
- {
- std::cout << "\n" << descr << "\n-----\n";
- }
-
-}
-
int main()
{
CPUID::initialize();
- std::cout << "Cache line size = " << CPUID::cache_line_size() << "\n";
-
- print_header("SIMD instruction sets");
- print_if_feature("SSE2", CPUID::has_sse2());
- print_if_feature("SSSE3", CPUID::has_ssse3());
- print_if_feature("SSE4.1", CPUID::has_sse41());
- print_if_feature("SSE4.2", CPUID::has_sse42());
- print_if_feature("AVX2", CPUID::has_avx2());
- print_if_feature("AVX-512F", CPUID::has_avx512f());
- print_if_feature("AltiVec", CPUID::has_altivec());
-
- print_header("Other extensions");
- print_if_feature("RDTSC", CPUID::has_rdtsc());
- print_if_feature("BMI2", CPUID::has_bmi2());
- print_if_feature("PCMUL", CPUID::has_pcmuludq());
- print_if_feature("AES-NI", CPUID::has_aes_ni());
- print_if_feature("RDRAND", CPUID::has_rdrand());
- print_if_feature("RDSEED", CPUID::has_rdseed());
- print_if_feature("SHA", CPUID::has_intel_sha());
+ CPUID::print(std::cout);
}