Skip to content

Commit

Permalink
Output main CPU features.
Browse files Browse the repository at this point in the history
  • Loading branch information
Quake4 committed Nov 21, 2017
1 parent d49944d commit 92273de
Showing 1 changed file with 26 additions and 7 deletions.
33 changes: 26 additions & 7 deletions src/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,33 @@ using std::endl;
#include "x86/cpu_x86.h"
using namespace FeatureDetector;

int main(){
void WriteFeature(bool feature, char* visual, bool &has)
{
if (feature)
{
if (has) { cout << ", "; }
cout << visual;
has = true;
}
}

cout << "CPU Vendor String: " << cpu_x86::get_vendor_string() << endl;
cout << endl;
int main(){

cpu_x86::print_host();
// detect CPU features
cpu_x86 features;
features.detect_host();

#if _WIN32
system("pause");
#endif
// output main CPU features
cout << "Features: ";
bool has = false;
WriteFeature(features.HW_MMX, "MMX", has);
WriteFeature(features.HW_SSE, "SSE", has);
WriteFeature(features.HW_SSE2, "SSE2", has);
WriteFeature(features.HW_SSE42, "SSE42", has);
WriteFeature(features.HW_AES, "AES", has);
WriteFeature(features.HW_SHA, "SHA", has);
WriteFeature(features.HW_AVX && features.OS_AVX, "AVX", has);
WriteFeature(features.HW_AVX2 && features.OS_AVX, "AVX2", has);
WriteFeature(features.HW_AVX512_F && features.OS_AVX512, "AVX512", has);
cout << endl;
}

0 comments on commit 92273de

Please sign in to comment.