Refs #335. Added the fallback of L2 size detection for some virtual machines.

This commit is contained in:
Zhang Xianyi 2014-01-08 11:16:21 +08:00
parent ab69443bd4
commit 7b8604ea29
1 changed files with 6 additions and 0 deletions

View File

@ -1558,8 +1558,14 @@ void get_cpuconfig(void){
printf("#define L2_SIZE %d\n", info.size * 1024); printf("#define L2_SIZE %d\n", info.size * 1024);
printf("#define L2_ASSOCIATIVE %d\n", info.associative); printf("#define L2_ASSOCIATIVE %d\n", info.associative);
printf("#define L2_LINESIZE %d\n", info.linesize); printf("#define L2_LINESIZE %d\n", info.linesize);
} else {
//fall back for some virtual machines.
printf("#define L2_SIZE 1048576\n");
printf("#define L2_ASSOCIATIVE 6\n");
printf("#define L2_LINESIZE 64\n");
} }
get_cacheinfo(CACHE_INFO_L3, &info); get_cacheinfo(CACHE_INFO_L3, &info);
if (info.size > 0) { if (info.size > 0) {
printf("#define L3_SIZE %d\n", info.size * 1024); printf("#define L3_SIZE %d\n", info.size * 1024);