23 cout <<
"Eigen's L1, L2, L3 = " << l1 <<
" " << l2 <<
" " << l3 << endl;
29 char* string_char = (
char*)(
string);
32 EIGEN_CPUID(abcd, 0x0, 0);
38 cout <<
"vendor id = " << string_char << endl;
40 int max_funcs = abcd[0];
42 internal::queryCacheSizes_intel_codes(l1, l2, l3);
43 cout <<
"Eigen's intel codes L1, L2, L3 = " << l1 <<
" " << l2 <<
" " << l3 << endl;
45 internal::queryCacheSizes_intel_direct(l1, l2, l3);
46 cout <<
"Eigen's intel direct L1, L2, L3 = " << l1 <<
" " << l2 <<
" " << l3 << endl;
48 internal::queryCacheSizes_amd(l1, l2, l3);
49 cout <<
"Eigen's amd L1, L2, L3 = " << l1 <<
" " << l2 <<
" " << l3 << endl;
58 abcd[0] = abcd[1] = abcd[2] = abcd[3] = 0;
59 EIGEN_CPUID(abcd, 0x4, cache_id);
60 cache_type = (abcd[0] & 0x0F) >> 0;
61 int cache_level = (abcd[0] & 0xE0) >> 5;
62 int ways = (abcd[1] & 0xFFC00000) >> 22;
63 int partitions = (abcd[1] & 0x003FF000) >> 12;
64 int line_size = (abcd[1] & 0x00000FFF) >> 0;
66 int cache_size = (ways + 1) * (partitions + 1) * (line_size + 1) * (sets + 1);
68 cout <<
"cache[" << cache_id <<
"].type = " << cache_type <<
"\n";
69 cout <<
"cache[" << cache_id <<
"].level = " << cache_level <<
"\n";
70 cout <<
"cache[" << cache_id <<
"].ways = " << ways <<
"\n";
71 cout <<
"cache[" << cache_id <<
"].partitions = " << partitions <<
"\n";
72 cout <<
"cache[" << cache_id <<
"].line_size = " << line_size <<
"\n";
73 cout <<
"cache[" << cache_id <<
"].sets = " << sets <<
"\n";
74 cout <<
"cache[" << cache_id <<
"].size = " << cache_size <<
"\n";
77 }
while (cache_type > 0 && cache_id < 16);
81 std::cout << endl <<
"Raw dump:" << endl;
94 cout <<
"EIGEN_CPUID is not defined" << endl;
int i
Definition: BiCGSTAB_step_by_step.cpp:9
#define DUMP_CPUID(CODE)
Definition: check_cache_queries.cpp:9
void queryCacheSizes(int &l1, int &l2, int &l3)
Definition: Memory.h:1263
int queryTopLevelCacheSize()
Definition: Memory.h:1307
int queryL1CacheSize()
Definition: Memory.h:1299